//Copyright 2006 WalshWorks Media. All rights reserved

window.onload = function() {
  setFooter();
  setScreenSize();
}
window.onresize = function() {
  setFooter();
  setScreenSize();
}

function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	}
	else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
		}
		else {
			if (document.body&&document.body.clientHeight) {
			windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth=0;
	if (typeof(window.innerWidth)=='number') {
		windowWidth=window.innerWidth;
	}
	else {
		if (document.documentElement&&document.documentElement.clientWidth) {
			windowWidth=document.documentElement.clientWidth;
		}
		else {
			if (document.body&&document.body.clientWidth) {
			windowWidth=document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

function setScreenSize(){
	if (document.getElementById) {
		var windowWidth=getWindowWidth();		
		if (windowWidth < 1000) {
			document.getElementById('left_sidebar').style.display='none';		
			//document.getElementById('right_sidebar').style.display='none';		
			document.getElementById('container').style.width='775px';
			document.getElementById('container').style.backgroundPosition='top left';
			document.getElementById('container').style.backgroundImage='url(../images/header_bg_775.jpg)';
			document.getElementById('footer').style.width='775px';
			document.getElementById('footer').style.backgroundImage='url(../images/footer_bg_775.jpg)';
		}
		else {
			document.getElementById('left_sidebar').style.display='block';		
			//document.getElementById('right_sidebar').style.display='block';		
			document.getElementById('container').style.width='1000px';
			document.getElementById('container').style.backgroundImage='url(../images/header_bg.jpg)';
			document.getElementById('container').style.backgroundPosition='top center';
			document.getElementById('footer').style.width='1000px';
			document.getElementById('footer').style.backgroundImage='url(../images/footer_bg.jpg)';
		}
	}
}

function setFooter() {
	if (document.getElementById) {
		var windowHeight=getWindowHeight();
		if (windowHeight>0) {
			var contentHeight=document.getElementById('container').offsetHeight;
			var footerElement=document.getElementById('footer_back');		
			var footerHeight=footerElement.offsetHeight;
			if (windowHeight-(contentHeight+footerHeight)>=0) {
				footerElement.style.top=(windowHeight-(contentHeight+footerHeight))+'px';
			}
			else {
				footerElement.style.top='0px';
				
			}
		}
	}
}



