/* The following functions allow resizing of the window to automatically
	cause the web page columns to fill the available space ie all equal height */
function fillthescreen(){
	var htfoot=60, htheader=120, htpadding=64;
	//This returns the screen height
	winH = windowHeight();
	//alert(winH);
	//We need to substract the footer height and header height and 1em =16px*4 maincontentwrap padding
	heightNeeded=winH-htfoot-htheader-htpadding;
	//Explorer doesn't recognize minHeight
	if( typeof( window.innerWidth ) != 'number' ) {
		//So, we use height (and explorer bug)
		document.getElementById('sidebar').style.height=heightNeeded+'px';
		}else{
		//For every other browser, we use minHeight - Opera OK
		// Firefox 3 - not needed
		document.getElementById('maincontent').style.minHeight=heightNeeded+'px';
	}
}

function windowHeight(){
	var alto= 0;
	// Non-IE
	if( typeof( window.innerWidth ) == 'number' ) {
		alto= window.innerHeight;
	}
	// Standards compliant mode = IE-win (DTD) , Firefox (DTD) , Netscape (DTD)
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		alto= document.documentElement.clientHeight;
	}
	//  DOM browsers = IE-win (no DTD) , IE-Mac , Firefox (no DTD) , Netscape (no DTD) , Opera
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		alto= document.body.clientHeight;
	}
	return alto;
}


// on load function to fill the columns for all pages except popup window
window.onload = fillthescreen;

// on resize function fills the columns when window is resized except for popup window
window.onresize = fillthescreen;
