function bodyLoad() {
	elementFullPageHeight("main");
	elementFullPageHeight("main-center");
	createMenu();
	footerPositionSet();
}

function bodyResize() {
	elementFullPageHeight("main");
	elementFullPageHeight("main-center");
	footerPositionSet();
}

function footerPositionSet() {
	var divMain = document.getElementById("mainbody-content");
	if(getWindowHeight() > (divMain.offsetHeight+60)) {
		document.getElementById("footer").style.position = "absolute";
	} else {
		document.getElementById("footer").style.position = "relative";
	}	
}

function elementFullPageHeight(element) {
	var div = document.getElementById(element);
	var divMain = document.getElementById("mainbody-content");
	div.style.height =	divMain.offsetHeight + "px";
	if(divMain.offsetHeight < getWindowHeight())
		div.style.height = getWindowHeight() + "px";
	else
		div.style.height = getScrollOffSet() + "px";
}

function getWindowHeight() {
	var myHeight = 0;
	if( typeof( window.innerHeight ) == "number" ) {
		//Non-IE
		myHeight = window.innerHeight;
	} else if( document.documentElement &&  document.documentElement.clientHeight ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if( document.body &&  document.body.clientHeight ) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

function getScrollOffSet() {
	var pageHeight = 0;
	if( window.innerHeight && window.scrollMaxY ) { // Firefox 
		pageHeight = window.innerHeight + window.scrollMaxY;
	} else if( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac
		pageHeight = document.body.scrollHeight; 
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
 		pageHeight = document.body.offsetHeight + document.body.offsetTop;
	}
	return pageHeight;
}

function createMenu() {
	var submenuoffset = 0;
  	var ultags = document.getElementById("menu-list").getElementsByTagName("ul");
    for (var t=0; t<ultags.length; t++) {
		ultags[t].style.top=ultags[t].parentNode.offsetHeight+submenuoffset+"px";
    	ultags[t].parentNode.onmouseover=function() {
			this.style.zIndex=100
    		this.getElementsByTagName("ul")[0].style.visibility="visible";
			this.getElementsByTagName("div")[0].style.visibility="visible";
			this.getElementsByTagName("div")[0].style.height=this.getElementsByTagName("ul")[0].offsetHeight+"px";
    	}
    	ultags[t].parentNode.onmouseout=function() {
			this.style.zIndex=0
			this.getElementsByTagName("ul")[0].style.visibility="hidden";
			this.getElementsByTagName("div")[0].style.visibility="hidden";
    	}
    }
}