var layoutHelper;

(function() {

  if(layoutHelper == null) {
		layoutHelper = new Object();
	}

  function $ (id)
  {
    return (document.all) ? document.all[id] : document.getElementById(id);
  }

  function $$ (obj, tag)
  {
    return obj.getElementsByTagName(tag);
  }
  
  function getStyle(obj, prop)
  {
    if (obj.currentStyle)
    {
      return obj.currentStyle[prop];
    }
    else if (document.defaultView && document.defaultView.getComputedStyle)
    {
      prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
      return document.defaultView.getComputedStyle(obj, null).getPropertyValue(prop);
    }
    else
    {
      return '';
    }
  } 
  
/*  
  layoutHelper.alignRightBlock = function ()
  {
    var i, rAllBlocks, sumSize, spaceSize, blockMargin, newMargin;
    var rBlocks = new Array();
    var contBlock = $('idContentContainer');
    var sContBlock = $('idSecondaryContentContainer');
    
    if (contBlock && sContBlock && contBlock.offsetHeight && sContBlock.offsetHeight)
    {
      rAllBlocks = $$(sContBlock, 'DIV');
      sumSize = 0;
      for (i = 0; i < rAllBlocks.length; i++)
      {
        if (rAllBlocks[i].className.toLowerCase() == 'block')
        {
          rBlocks.push(rAllBlocks[i]);
          sumSize += rAllBlocks[i].offsetHeight;
        }
      }
      if (contBlock.offsetHeight > sumSize)
      {
        spaceSize = contBlock.offsetHeight - sumSize;
        blockMargin = Math.floor(spaceSize / (rBlocks.length - 1));
        rBlocks[0].style.marginBottom = 0;
        for (i = 1; i < rBlocks.length; i++)
        {
          rBlocks[i].style.marginBottom = 0;
          newMargin = ((i == rBlocks.length - 1) ? blockMargin + (spaceSize - blockMargin * i) : blockMargin);
          if (newMargin)
          {
            rBlocks[i].style.marginTop = newMargin + 'px';
          }
        }
      }
      
      if(document.all && document.readyState != 'complete')
      {
        setTimeout('layoutHelper.alignRightBlock();', 10);
      }
    }
    else
    {
      setTimeout('layoutHelper.alignRightBlock();', 10);
    }
  }
*/
  
  layoutHelper.setBottomBlocksHeight = function ()
  {
    var divs, contentBox, curPadding;
    var leftBlock = $('idBottomLeftContentContainer');
    var rightBlock = $('idBottomRightContentContainer');
    
    if (leftBlock && rightBlock && leftBlock.offsetHeight && rightBlock.offsetHeight)
    {
      divs = (leftBlock.offsetHeight > rightBlock.offsetHeight) ? $$(rightBlock, 'DIV') : $$(leftBlock, 'DIV');
      for (i = 0; i < divs.length; i++)
      {
        if (divs[i].className == 'content')
        {
          curPadding = parseInt(getStyle(divs[i], 'paddingBottom'));
          if (!isNaN(curPadding))
          {
            divs[i].style.paddingBottom = (curPadding + Math.abs(leftBlock.offsetHeight - rightBlock.offsetHeight)) + 'px';
          }
        }
      }
    
      if(document.all && document.readyState != 'complete')
      {
        setTimeout('layoutHelper.setBottomBlocksHeight();', 10);
      }
    }
    else
    {
      setTimeout('layoutHelper.setBottomBlocksHeight();', 10);
    }
  }

}) ();

layoutHelper.setBottomBlocksHeight();
