﻿
$(window).load(function(){
  dolayout();
});

function getMastercontentHeight(mastercontent)
{
  return mastercontent.height();
}

function dolayout()
{
  var mastercontent = $("#masterContent");
  var masterleft = $("#masterColumnLeft");
  var mastercontentHeight = getMastercontentHeight(mastercontent);
  
  if (mastercontentHeight >= masterleft.height())
  {
    adjustmasterleft(mastercontent, masterleft);
  }
  else
  {
    adjustmastercontent(mastercontent, masterleft);
  }
}

function adjustmasterleft(mastercontent, masterleft)
{
  var height = mastercontent.height();
  setframedecorationheight(height);
  masterleft.height(height);
}

function adjustmastercontent(mastercontent, masterleft)
{
  var height = masterleft.height();
  setframedecorationheight(height);
  mastercontent.height(height);
  positioncontentfooter(height);
}

function setframedecorationheight(height)
{
  $("#frameDecorationLeft").height(height);
  $("#frameDecorationRight").height(height);
}

function positioncontentfooter(height)
{
  var contentfooter = $("#footer");    
  var masterfooter = $("#masterFooter"); 
  if (masterfooter != null && contentfooter != null)
  {
    var contentfootertop = masterfooter.position().top - contentfooter.height();    
    contentfooter.css({"position":"absolute", "top": contentfootertop + "px"});    
  }
}


