// JavaScript Document
// Used by the CSS layout page to adjust the height and width of columns depending on content.

function adjustHeight() {
	
	// Get the height of nav and content
	var navHeight =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('nav').offsetHeight;
	var contentHeight =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('content').offsetHeight;
	
	// Set the height of the main container to the same as the tallest column.
	 _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('main').style.height = Math.max(navHeight, contentHeight) + 50;
}


function adjustLayout(n, c) {

	// Get the height of nav and content
	var navHeight =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('nav').offsetHeight;
	var contentHeight =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('content').offsetHeight;
	
	// Set the height of the main container to the same as the tallest column.
	 _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('main').style.height = Math.max(navHeight, contentHeight);
	
	// This needs to be used when the done when using relative positioning
	// Check if nav height is taller than content height
	//if(navHeight > contentHeight) {
		// sets height of main container to nav height plus 100 for IE
		//document.getElementById('main').style.height = navHeight;
	//}
	
	// Get width of nav, content, and main
	var navWidth =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('nav').offsetWidth;
	var contentWidth =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('content').offsetWidth;
	var wrapWidth =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('wrap').offsetWidth;
	var wrapWidthFlag = false;
			
	if(navWidth > wrapWidth * n) {
		// pushes the content column to the right.
		wrapWidthFlag = true;
	}
	
	if((contentWidth > wrapWidth * c) || wrapWidthFlag == true)
	{
		// expands the width of the wrap.
		if ((navWidth + contentWidth) > 800)
		{
			 _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('wrap').style.width =  (navWidth + contentWidth + (wrapWidth * 0.03)) * 1.03;
			
			if(navigator.appName == 'Microsoft Internet Explorer')
			{
				 _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('content').style.left = navWidth + (0.02 * wrapWidth);
				 _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('nav').style.width = navWidth;
				 _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('content').style.width = contentWidth;
			}
			else
			{	
				 _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('content').style.left =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('nav').offsetWidth + (0.02 * wrapWidth);
			}
		}
	}
}
 ;
_proxy_jslib_flush_write_buffers() ;