// 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 contentHeight = document.getElementById('divmaintext').offsetHeight - 35;
    var contentHeight1 = document.getElementById('divmaintext').offsetHeight 
    var contentHeight2 = document.getElementById('divmaintext2').offsetHeight - 50;

    var div1 = document.getElementById('ctl00_Div1').offsetHeight;
    var div2 = document.getElementById('ctl00_Div2').offsetHeight;

    var max = contentHeight1 - removeHeight;
 
    if (div1>max) 
    {
        max=div1;
    }
      if (div2>max)
    {
        max=div2;
    }
    
    if (max < 342) 
    {max = 342; }
    if (document.all) {

        document.getElementById('divmaintextbodytext').style.height = (max + removeHeight) - removeBodyHeight;
        document.getElementById('ctl00_Div1').style.height = max;
        document.getElementById('ctl00_Div2').style.height = max;
       // document.getElementById('ctl00_Div3').style.height = contentHeight2;

    } else {
        //contentHeight = contentHeight - 10;

    // contentHeight2 = contentHeight2 - 10;
    document.getElementById('divmaintextbodytext').setStyle("height", (max + removeHeight) - removeBodyHeight);
    document.getElementById('ctl00_Div1').setStyle("height", max);
    document.getElementById('ctl00_Div2').setStyle("height", max);
     //   document.getElementById('ctl00_Div3').setStyle("height", contentHeight2);
    }

    $$(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');

});