// JavaScript Document

onload=function() {
	var h1;
	var h2;
	var h3;
	var t;
	var h;
	var CM;
	
	// match content container height with content div
	h1 = getH('contentTop')
	
	t = getT('contentTxt')
	h = getH ('contentTxt')
	h2 = getH ('contentMid')
	CM = getS('contentMid')
	tfinal = t + h - h1;  			// text height
	h3 = h1+h2;						// top & mid backgrnd heights

	st = getT('sideNav')
	sh = getH('sideNav')
	sFinal = st + sh  -h -h1;			// side nav height
	
	// make sure the final content height is not less than the top img (contentTop) and the repeating image(contentMid) heights
	
	if (tfinal < h3) {				// if text is less than backgrnd 
		final = h3;					// make content height of top&mid
	}else{									
		final = tfinal;  			// make content height of text
	}
	if (sFinal > final) {			// if sidebar is bigger than new content new height
		final = sFinal				// make sidebar final heigh
	}
	
	CM.height = final + 'px';		  // make content height of text
	
	t = getT('contentMid') 
	h = getH('contentMid')
	CM = getS('midContainer')
	CM.height = t + h +'px';

	
	// match side nav height with content container background height
	
	//CM = getS('sideNav');     
	//CM.height = h + 'px';
	
	t = getT('midContainer');
	h = getH('midContainer');
	CM = getS('bottContainer');
	CM.top =  h + t + 'px';
	CM.display = 'block';	
	
	// pairing content background with final height
	
	h = getH('bottContainer');
	t = getT('bottContainer');
	CM = getS('mainContainer');
	CM.height = t + h + 'px';
	
	
//	posshow('bgContainer', 'bottContainer', 0);
	
}

