
//Script resizes middle containers in pages to ensure page appears to be 100% height all the time, on load and also on resize of page.
//by plastique.

	
/*
NOTES, PLASTIQUE 23.02.2009:
header height = 93px
footer height = 35px
intro text height = ???
also allow for padding space...
BOX HEIGHT = winHeight - (hdrHeight + ftrHeight + introHeight + otherPadding)
*/

function findPageHeight(){
	//define values on load/reload/resize
	var winWidth, winHeight, d=document;
	var headerContainerHeight = d.getElementById('header_container').offsetHeight; //get current header container height
	var footerContainerHeight = d.getElementById('footer_container').offsetHeight; //get current footer container height
	var introTextContainerHeight = d.getElementById('intro_container').offsetHeight; //get current intro text container height
	
	if(typeof window.innerWidth!='undefined'){
		winWidth = window.innerWidth;
		winHeight = window.innerHeight;
	}else if(d.documentElement && typeof d.documentElement.clientWidth!='undefined' && d.documentElement.clientWidth!=0){
		winWidth = d.documentElement.clientWidth;
		winHeight = d.documentElement.clientHeight;
	}else if(d.body && typeof d.body.clientWidth!='undefined'){
		winWidth = d.body.clientWidth;
		winHeight = d.body.clientHeight;
	}
	
	var right_col_height = winHeight - (headerContainerHeight + footerContainerHeight + introTextContainerHeight + 24);
	if( document.getElementById('c1b') ){
		document.getElementById('c1b').style.height = right_col_height + 'px';
	}
	if( document.getElementById('rowA') ){
		document.getElementById('rowA').style.height = (right_col_height/2 - 6) + 'px';
	}
	if( document.getElementById('rowB') ){
		document.getElementById('rowB').style.height = (right_col_height/2 - 6) + 'px';
	}

	//secondary.html page adjustments x 1 column: to adjust the height if you change page, just adjust the number being subtracted below until the footer matches perfectly to the bottom of the browser.
	if( document.getElementById('c2a') ){
		document.getElementById('c2a').style.height = (winHeight - (headerContainerHeight + footerContainerHeight + introTextContainerHeight + 63)) + 'px';
	}
}
window.onload = findPageHeight;
window.onresize = findPageHeight;
