// ***********************
// CONTENT HEIGHT
// Based on http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=16
//  and http://www.themaninblue.com/experiment/BrowserWidth/
// ***********************

function scaleHeight() {

	// Height of whatever elements are above the element that scales (px)
	var topElHeight = 122;

	// Space you want to leave on the bottom (px), or height of elements below
	var botMargin = 18;

	// Initialize windowHeight
	var windowHeight = 0;

	if (typeof(window.innerHeight) == 'number') {
		//Non-IE
		windowHeight = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientHeight)) {
		//IE 4 compatible
		windowHeight = document.body.clientHeight;
	}

	var mainElHeight = windowHeight - topElHeight - botMargin;
	//document.getElementById("mainEl").height = mainElHeight;
	document.getElementById("mainEl").style.height = mainElHeight + "px";
}

// setTimeout is used to avoid using onload in the body tag.
// onload will not work on pages that use any other onload event.
window.setTimeout('scaleHeight()', 150);

// This is used here because onresize is an
//  invalid attribute for the body element.
onresize = function() {
	scaleHeight();
}
