// 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 className = '.' + cl;
    var maxHeight = 0;
    //var contentHeight = document.getElementById('divmaintext').offsetHeight - 35;
    var contentHeight1 = document.getElementById('divmaintext').offsetHeight 
    var contentHeight2 = document.getElementById('Middle_Main_Text2').offsetHeight - 50;


    var div1 = document.getElementById('ctl00_Div1').offsetHeight;
    var div2 = document.getElementById('ctl00_Div2').offsetHeight;

    var max = contentHeight1;
    if (div1 > max) {
        max = div1;
    }
    if (div2 > max) {
        max = div2;
    }
    max = max - 20;

    if (document.all) {

        document.getElementById('divmaintextbodytext').style.height = max;
        document.getElementById('ctl00_Div1').style.height = max;
        document.getElementById('ctl00_Div2').style.height = max;
        
        document.getElementById('ctl00_Div4').style.height = contentHeight2;
    } else {
    document.getElementById('divmaintextbodytext').setStyle("height", max);
    document.getElementById('ctl00_Div1').setStyle("height", max);
    document.getElementById('ctl00_Div2').setStyle("height", max);
    
        document.getElementById('ctl00_Div4').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');

});