
var isDOM = document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
var isOpera = isOpera5 = window.opera && isDOM //Opera 5+
var isMSIE = document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
var isNetscape4 = document.layers //Netscape 4.*
var isMozilla = isDOM && navigator.appName=="Netscape" //Mozilla øûø Netscape 6.*



window.onload = function() {
    var i, k;
    var startObjContentName = 'content';
    var startObjRightName = 'right';
    var startObjChilds = null;
    var brHeight = 18;

    var minus1 = 40; var minus2 = 20;
    if (isOpera) { minus1 = 25; minus2 = 19; }
    if (isMozilla) { minus1 = 25; minus2 = 21; }

    var startObjContent = document.getElementById(startObjContentName);
    var startObjRight = document.getElementById(startObjRightName);
    var bigHeightContent = startObjContent.offsetHeight;
    var bigHeightRight = startObjRight.offsetHeight;

    var thisBody = null;
    var newHeight = 0;
    var blockAllHeight = 0;
    var blockLastChildIndex = 0;
    var blockChilds = null;


    if (bigHeightContent > bigHeightRight) {
        startObjChilds = startObjRight.childNodes;
    
        if (startObjChilds != null) {
            for (i=0; i<startObjChilds.length; i++)      
              if (startObjChilds.item(i).nodeType==1 && startObjChilds.item(i).nodeName=="DIV") {
                blockLastChildIndex = i;
                blockAllHeight += startObjChilds.item(i).offsetHeight + brHeight;          
            }

            newHeight = startObjChilds.item(blockLastChildIndex).offsetHeight + (bigHeightContent - minus1 - blockAllHeight) + "px";

            var tmp = startObjChilds.item(blockLastChildIndex).getAttribute('id') + "_body1";
            thisBody = startObjChilds.item(blockLastChildIndex).getElementsByTagName("DIV");
            for (k=0; k<thisBody.length; k++) {
              if (thisBody.item(k).nodeType==1 && thisBody.item(k).getAttribute('id')==tmp) {
                thisBody = thisBody.item(k);
                break;
              }
            }
                      
            if (thisBody != null) thisBody.style.height = newHeight;        
        }
    }
    
    if (bigHeightContent < bigHeightRight) {
        startObjChilds = startObjContent.firstChild.childNodes;
        if (isMozilla || isOpera) startObjChilds = startObjContent.childNodes.item(1).childNodes;
    
        if (startObjChilds != null) {
            for (i=0; i<startObjChilds.length; i++)
              if (startObjChilds.item(i).nodeType==1 && startObjChilds.item(i).nodeName=="DIV") {
                blockLastChildIndex = i;
                blockAllHeight += startObjChilds.item(i).offsetHeight + brHeight;
            }

            newHeight = startObjChilds.item(blockLastChildIndex).offsetHeight + (bigHeightRight - minus2 - blockAllHeight) + "px";

            var tmp = startObjChilds.item(blockLastChildIndex).getAttribute('id') + "_body1";
            thisBody = startObjChilds.item(blockLastChildIndex).getElementsByTagName("DIV");
            for (k=0; k<thisBody.length; k++) {
              if (thisBody.item(k).nodeType==1 && thisBody.item(k).getAttribute('id')==tmp) {
                thisBody = thisBody.item(k);
                break;
              }
            }

            if (thisBody != null) thisBody.style.height = newHeight;        
        }
    }
}
