// layout3.js
// Cross-Browser.com & SitePoint.com - Equal Column Height Demo (3 Column)

if (document.getElementById || document.all) { // minimum dhtml support required
  /*document.write("<"+"style type='text/css'>#footer{visibility:hidden;}<"+"/style>");*/
  window.onload = winOnLoad;
}
function winOnLoad()
{
  var ele = xGetElementById('leftcontent');
  if (ele && xDef(ele.style, ele.offsetHeight)) { // another compatibility check
    adjustLayout();
    xAddEventListener(window, 'resize', winOnResize, false);
  }
}
function winOnResize()
{
  adjustLayout();
}
function adjustLayout()
{
	// Get content heights
	var bHeight = xHeight('banner');
  var lHeight = xHeight('leftcontent');
  var cHeight = xHeight('centrecontent');
  var rHeight = xHeight('rightcontent');
	var fHeight = xHeight('footer');

  // Find the maximum height, allow for margins and padding
  var maxHeight = Math.max(380, Math.max(lHeight, Math.max(cHeight, rHeight)));

	// Assign maximum height to all columns
  xHeight('leftcontent', maxHeight);
  xHeight('centrecontent', maxHeight);
  xHeight('rightcontent', maxHeight);

	// Show the footer
	xTop('footer',maxHeight+bHeight);
  xShow('footer');
	
	xHeight('main', bHeight+maxHeight+fHeight);
}

