/* 
This program Requires x.js!!!

You need <div id="page"> that will hold the main content
	for each of the columns have 2 <div> tags ie
		<div id="outer1">
			<div id="inner1">
		<div id="outer2">
			<div id="inner2">

The program will look at the size's of the "inners" and change the "outer" to match the longest "inner" content.
Then the program will change the page to the longest size and then add the title (headerSize)

*/
window.onload = function()
{
		xAddEventListener(window, "resize", adjustLayout, false);
		adjustLayout();
}

function adjustLayout()
{
	/*/ Setup the dectetion
	var ua = navigator.userAgent.toLowerCase(); 			
	this.isSafari = (ua.indexOf('safari') != - 1);
	this.isOpera  = (ua.indexOf('opera') != -1); 
	this.isIE     = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
	this.isNS     = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
	
	// Size of the Title and navigation
	var headderSize = 110;
	
	// Get natural width of the browser / screen
	if ( this.isNS ) { var availSize = window.innerWidth; }	 // Width of the client's browser (Netscape and Mozilla)
	else { var availSize = xClientWidth(); }						 // Width of the client's browser (All other browsers IE and Opera)
	//	alert("Screen Size: "+availSize+"\n------------------------------\nBrowser IE?: "+this.isIE+"\nBrowser Safari?: "+this.isSafari+"\nBrowser Opera?: "+this.isOpera+"\nBrowser NutScrape(compat)?: "+this.isNS); 

	// Assign the width to the banner
	if ( this.isNS ) { xWidth("header", availSize-19); }
	else if ( this.isSafari ) { xWidth("header", availSize+16); }
	else { xWidth("header", availSize); }

	// Check for very old browsers and display message
	this.versionMinor = parseFloat(navigator.appVersion); 
	this.versionMajor = parseInt(this.versionMinor); 
	if ( this.isNS && this.versionMajor == 3 )	{ alert("Netscape 3 Browser Detected, please upgrade your browser to Netscape 4.7+ or another browser"); }
	*/

	// Get natural heights of all of the layers
	var aHeight = xHeight("leftside");
	var bHeight = xHeight("navigation");
	var cHeight = xHeight("rightside");
	//alert("Leftside: "+aHeight+"\nNav: "+bHeight+"\nRightside: "+cHeight+"\nWindow: "+availSize);

	// Find the maximum height
	var dHeight = Math.max(aHeight, bHeight);
	var eHeight = Math.max(cHeight, dHeight);
	var maxHeight = eHeight;//+headderSize;
	
	
	// Assign maximum height to all columns
	xHeight("navigation", maxHeight);
	xHeight("rightside", maxHeight);
	xHeight("leftside", maxHeight);
	
	// Assign the height to the main page div tag + headerSize.
	//xHeight("page", pageHeight);
	
	// Show the footer
	//xShow("footer");
}

