function formatindexheight()
{
  var oEle = document.getElementById('header');
  var iHeadH = oEle.clientHeight;
  oEle = document.getElementById('subhead');
  iHeadH = iHeadH + oEle.clientHeight;

  oEle = document.getElementById('content');
  var iCHeight = oEle.clientHeight;

  var iFudge = 20;
  var iPFudge = 5;
  var iBBorder = 0;
  if ((BrowserDetect.browser == 'Explorer') && ((BrowserDetect.version < 7) || (BrowserDetect.version > 7)))
  {
    iFudge = 15; iFudge = 20;
    iPFudge = 0; iPFudge = 5;
    iBBorder = 0;
  }
  var iWHeight = document.all ? document.body.clientHeight : window.innerHeight;
  if (iWHeight > 600)
  {
    var n = oEle.clientHeight;
    var t = iWHeight - iHeadH - 45 - 10 - iFudge;
    if (t < 310)
    {
      t = 310;
    }
    oEle.style.height = (t + 'px');
    n = oEle.clientHeight - n;
    oEle = document.getElementById('partners');
    oEle.style.borderTop = (n + 45 - iFudge + iPFudge) + 'px solid #ffffff';
    var t = oEle.style.top;
    oEle.style.top = '1px';
    oEle = document.getElementById('rightfill');
    oEle.style.height = (oEle.clientHeight + n) + 'px';
    oEle = document.getElementById('partners');
    oEle.style.top = t;
    if (iBBorder)
    {
      oEle.style.borderBottom = iBBorder + 'px solid #ffffff';
    }
  }
}


function formatcontactusheight()
{
  var oEle, iCHeight, iBWHeight, iTMHeight, iICLOHeight, iWeight, iHeight, iFudge;
  var iBMHeight = 0;

  oEle = document.getElementById('mytable');
  if (oEle)
  {
    iCHeight = (oEle.clientHeight) + 30;
  }
  else
  {
    oEle = document.getElementById('content');
    if (oEle)
    {
      iCHeight = (oEle.clientHeight) + 30;
    }
  }


  oEle = document.getElementById('banner_wrapper');
  iBWHeight = oEle.clientHeight;

  oEle = document.getElementById('tm_wrapper');
  iTMHeight = oEle.clientHeight;

  oEle = document.getElementById('ic_lo');
  iICLOHeight = oEle.clientHeight;

  oEle = document.getElementById('bottommenu');
  if (oEle)
  {
    iBMHeight = oEle.clientHeight;
  }

  iFudge = -20;
  if (BrowserDetect.browser == 'Explorer')
  {
    iFudge = -5;
  }

  iWHeight = document.all ? document.body.clientHeight : window.innerHeight;
  if (iWHeight > (iCHeight + iTMHeight + iICLOHeight + iBWHeight + iBMHeight))
  {
    iCHeight = iWHeight - iTMHeight - iICLOHeight - iBWHeight - iBMHeight - 45 - iFudge;
  }

  iHeight = iCHeight + iTMHeight + iICLOHeight + iBWHeight;

  if (BrowserDetect.browser == 'Explorer')
  {
    oEle = document.getElementById('stretch');
    if (oEle)
    {
      oEle.style.height = '17px';
    }
  }

  oEle = document.getElementById('content');
  oEle.style.height = (iCHeight) + 'px';
  oEle = document.getElementById('rightcontent');
  oEle.style.height = (iCHeight) + 'px';
}


function formattableheight()
{
  var oEle = document.getElementById('mytable');
  iCHeight = oEle.clientHeight;
  oEle = document.getElementById('toptable');
  if (oEle)
  {
    iCHeight = iCHeight + oEle.clientHeight;
  }

  oEle = document.getElementById('banner_wrapper');
  var iTopH = oEle.clientHeight;
  oEle = document.getElementById('tm_wrapper');
  if (oEle)
  {
    iTopH = iTopH + oEle.clientHeight;
  }
  oEle = document.getElementById('ic_lo');
  iTopH = iTopH + oEle.clientHeight;
  var iWHeight = document.all ? document.body.clientHeight : window.innerHeight;
  var iFudge = 0;
  if ((BrowserDetect.browser == 'Explorer') && ((BrowserDetect.version < 7) || (BrowserDetect.version > 7)))
  {
    iFudge = 15;
  }
  if ((iCHeight + iTopH + 30) < iWHeight)
  {
    iCHeight = iWHeight - iTopH - 45;
  }
  var oBdg = document.getElementById('building');
  var oImg = document.getElementById('building_image');
  if (oImg)
  {
    if (iCHeight < (oImg.clientHeight + 86 - 86))
    {
      iCHeight = oImg.clientHeight + 86 - 86;
    }
  }
  oEle = document.getElementById('content');
  if (oEle)
  {
    oEle.style.height = (iCHeight - iFudge) + 'px';
  }
  oEle = document.getElementById('rightcontent');
  if (oEle)
  {
    oEle.style.height = (iCHeight - iFudge) + 'px';
  }
  oEle = document.getElementById('left_panel');
  if (oEle)
  {
    oEle.style.height = (iCHeight - 45 - iFudge) + 'px';
  }
  if (oBdg)
  {
    if (oImg)
    {
      oBdg.style.top = (oEle.clientHeight - oImg.clientHeight - 45) + 'px';
    }
  }
  var p4 = document.getElementById('p4');
  if (p4)
  {
    oEle = document.getElementById('content');
    if (oEle)
    {
      p4.style.height = oEle.clientHeight + 'px';
    }
  }
}


function formatheight()
{
  var sType = '';
  var oEle = document.getElementById('templatetype');
  if (oEle)
  {
    var sType = oEle.innerHTML;
  }
  if (sType == 'table')
  {
    formattableheight();
  }
  if (sType == 'contactus')
  {
    formatcontactusheight();
  }
  if (sType == 'index')
  {
    formatindexheight();
  }
  if (sType == 'links')
  {
    formattableheight();
  }
}
