function addEvent( obj, type, fn ){ 
   if (obj.addEventListener){ 
      obj.addEventListener( type, fn, false );
   }
   else if (obj.attachEvent){ 
      obj["e"+type+fn] = fn; 
      obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
      obj.attachEvent( "on"+type, obj[type+fn] ); 
   } 
} 

var setFooter = {
	pageHeight : function(){
		return document.body.scrollHeight;
	},
	footerHeight : function(){
		var theFooter = document.getElementById("footer");
		return theFooter.style.height;
	},
	init : function(){
		var theFooter = document.getElementById("footer");
		theFooter.style.position = "relative";
		//var theHeight = theFooter.style.height;
		theFooter.style.top = (setFooter.pageHeight() - theHeight) + "px";
	}
}
var fixFlash = {
	init: function(){
		var wrapHeight = document.getElementById("wrap").scrollHeight;
		var flashElem = document.getElementById("flash");
		flashElem.style.height = wrapHeight + "px";
	}
}
var fixTranslucent = {
	init : function(){
		var theContent = document.getElementById("content");
		var theImage = "images/translucentfooter.png";
		theContent.style.background = "#FFF";
		var myImage = document.createElement("img");
		myImage.setAttribute("src", theImage);
		myImage.setAttribute("id", "translucent");
		theContent.appendChild(myImage);
		myImage.style.position ="absolute";
		myImage.style.top = (setFooter.pageHeight() - setFooter.footerHeight() - myImage.height) + "px";
		myImage.style.left = "0px";
		myImage.style.width = document.body.scrollWidth + "px";
	}
}
var allInOne = {
	init: function(){
		setFooter.init();
		fixFlash.init();
		fixTranslucent.init();
	},
	fixSize : function(){
		var image = document.getElementById("translucent");
		var parent = image.parentNode;
		parent.removeChild(image);
		allInOne.init();
	}
}
addEvent(window, 'load', allInOne.init);
addEvent(window, 'resize', allInOne.fixSize);
