//Height and width of browser's viewable area.
function returnViewPortHeight() {
	var myHeight; //This is all we need
	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;
		//alert('I am Internet Explorer');
	} else if( document.body && ( document.body.clientHeight ) ) { 
		//IE 4 compatible 
		myHeight = document.body.clientHeight; 
	}
	return myHeight;
}
function returnViewPortWidth() {
	var myWidth;
	if( typeof( window.innerWidth ) == 'number' ) { 
		//Non-IE 
		myWidth = window.innerWidth;
	} else if(document.documentElement && (document.documentElement.clientWidth)) {
		//IE 6+ in 'standards compliant mode' 
		myWidth = document.documentElement.clientWidth; 
		//alert('I am Internet Explorer');
	} else if( document.body && ( document.body.clientWidth) ) { 
		//IE 4 compatible 
		myWidth = document.body.clientWidth; 
	}
	return myWidth;
}

var viewportWidth = returnViewPortWidth();
var viewportHeight = returnViewPortHeight();

function adjustSiteHeight() {
	var div_site = document.getElementById('site');
	var div_site_height = div_site.offsetHeight;
	//alert('viewportHeight: '+viewportHeight);
	var targetHeight = viewportHeight-110; //minus top and bottom and etc
	//alert('targetHeight: '+targetHeight);
	if(div_site_height < targetHeight) {
		div_site.style.height = targetHeight+'px';
		//document.getElementById('rollover_darken').style.display = targetHeight+'px';
	}
	//document.getElementById('bottom').style.display = 'block'; //delayed show footer
}

function rollover_darken(turnon) {
	if(turnon == true) {
		document.getElementById('darken').style.display = 'block';
	} else {
		document.getElementById('darken').style.display = 'none';
	}
}

window.onload = adjustSiteHeight;
