/*
|-----------------------------------------------
| Adjust CSS Layout
|-----------------------------------------------
*/

function adjustLayout()
{
  // Get natural heights
  var cHeight = xHeight("pageBodyData");
  var lHeight = xHeight("pageLeftData");
  var rHeight = xHeight("pageRightData");

  // Find the maximum height
  var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));
  maxHeight = maxHeight + 10;

  // Assign maximum height to all columns
  xHeight("pageBody", maxHeight);
  xHeight("pageLeft", maxHeight);
  xHeight("pageRight", maxHeight);

  // Show the footer
  xShow("pageFooter");
}

function adjustLayoutSpanRight()
{
  // Get natural heights
  var cHeight = xHeight("pageBodyData");
  var lHeight = xHeight("pageLeftData");

  // Find the maximum height
  var maxHeight = Math.max(cHeight, lHeight);
  maxHeight = maxHeight + 10;

  // Assign maximum height to all columns
  xHeight("pageBody", maxHeight);
  xHeight("pageLeft", maxHeight);

  // Show the footer
  xShow("pageFooter");
}

function xVisibility(e, bShow)
{
  if(!(e=xGetElementById(e))) return null;
  if(e.style && xDef(e.style.visibility)) {
    if (xDef(bShow)) e.style.visibility = bShow ? 'visible' : 'hidden';
    return e.style.visibility;
  }
  return null;
}

function xShow(e)
{
  return xVisibility(e,1);
}
