/*================= Global variables==================*/
var MAINHEIGHT;	/*Container height*/
var HEADERHEIGHT;	/*Header height*/
var CONTHEIGHT;	/*Container height*/
var FOOTERHEIGT;	/*Footer height*/
/*=====================================================*/

/*setvariables function*/
function setVariables () {
	HEADERHEIGHT	= document.getElementById("header").offsetHeight;
	CONTHEIGHT	= document.getElementById("container").offsetHeight -140;
	FOOTERHEIGT	= document.getElementById("footer").offsetHeight;
	MAINHEIGHT	= HEADERHEIGHT + CONTHEIGHT + FOOTERHEIGT;
}

/*Fix Layout height IE*/
function fixLayoutIE () {
	if (document.documentElement.clientHeight > MAINHEIGHT ) {
		document.getElementById("content").style.height = document.documentElement.clientHeight - HEADERHEIGHT - FOOTERHEIGT + "px";
	} else {
		document.getElementById("content").style.height = CONTHEIGHT + "px";
	}
}
/*Fix Layout height*/
function fixLayout() {
	if (document.documentElement.clientHeight > MAINHEIGHT ) {
		document.getElementById("content").style.minHeight = document.documentElement.clientHeight - HEADERHEIGHT - FOOTERHEIGT + "px";
	} else {
		document.getElementById("content").style.minHeight = CONTHEIGHT + "px";
	}
}
/*Listeners*/
if (window.addEventListener){
	window.addEventListener("load", setVariables, false);
	window.addEventListener("load", fixLayout, false);
	window.addEventListener("resize", fixLayout, false);
}
else if (window.attachEvent){
	window.attachEvent("onload", fixLayoutIE);
	window.attachEvent("onload", setVariables);
	window.attachEvent("onresize", fixLayoutIE);
}