// This Javascript is written by Peter Velichkov (www.creonfx.com)
// and is distributed under the following license : http://creativecommons.org/licenses/by-sa/3.0/
// Use and modify all you want just keep this comment. Thanks

function equalHeight(cl) {


    var removeHeight = 42;
    var removeBodyHeight = 0;
    if (document.getElementById('ctl00_H1_From_DB')) {
        removeBodyHeight = document.getElementById('ctl00_H1_From_DB').offsetHeight;
    }
    var className = '.' + cl;
    var maxHeight = 0;

    var contentHeight1 = document.getElementById('divmaintext').offsetHeight;
    var contentHeight2 = document.getElementById('ctl00_Div1').offsetHeight;

   // alert('contentHeight1' + contentHeight1);
    //alert('contentHeight2' + contentHeight2);
    var max = contentHeight1;

//    if (contentHeight2 > max) 
//    {
//        max = contentHeight2;
//    }
//   
    
    if (max < 435) 
    {max = 435; }
    if (document.all) {

        document.getElementById('divmaintext').style.height = max
        document.getElementById('ctl00_Div1').style.height = max-40

       } else {

    document.getElementById('divmaintext').setStyle("height", max);
     document.getElementById('ctl00_Div1').setStyle("height",max-40 );

      }

      if (document.getElementById('ctl00_UCContact1_TBContact')) {
          var divbottom = document.getElementById('ctl00_UCContact1_TBContact').offsetHeight;
          var Bcre8newstable = document.getElementById('Bcre8newstable').offsetHeight;
          var maxbottom = divbottom
          if (document.all) {
              document.getElementById('Bcre8newstable').style.height = maxbottom - 10

          } else {

              document.getElementById('Bcre8newstable').setStyle("height", maxbottom - 10);

          }
      }


   // ############### Footer ################

      var footerLeft = document.getElementById('f_left').offsetHeight;
      var footerCenter = document.getElementById('f_center').offsetHeight;
      var footerRight = document.getElementById('f_right').offsetHeight;

      var footerMax = footerLeft;
      if (footerCenter>footerMax) {
          footerMax = footerCenter;
      }
      if (footerRight > footerMax) {
          footerMax = footerRight;
      }

      if (document.all) {
          document.getElementById('f_center').style.height = footerRight   
      } else {
      document.getElementById('f_center').setStyle("height", footerRight);         
      }

  // ############### Footer ################






//    $$(className).each(function(el) {
//        if (el.offsetHeight > maxHeight) {
//            maxHeight = el.offsetHeight;
//        }
//    });

//    if ($$('.dummyExtender') != '') {
//        $$('.dummyExtender').each(function(el) {
//            el.setStyle('height', maxHeight - el.getParent().offsetHeight + el.offsetHeight);
//        });
//    } else {
//        $$(className).each(function(el) {
//            var curExtender = new Element('div', { 'class': 'dummyExtender' });
//            curExtender.injectInside(el);
//            ;
//            curExtender.setStyle('height', (maxHeight - el.offsetHeight) + (vIE() >= 6 ? 20 : 0));

//        });
//    }
}


 


function vIE()
{ return (navigator.appName == 'Microsoft Internet Explorer') ? parseFloat((new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})")).exec(navigator.userAgent)[1]) : -1; }

//window.onload = equalHeight('equals');
window.addEvent('load', function() {
    equalHeight('equals');

});
