function layout(id1, id2, minus) {
	if (minus == null) {
		var sm = document.getElementById('submenu');
		minus = sm == null ? 0 : getHeight(sm);
	}
	
	var lc = document.getElementById(id1);
	var rc = document.getElementById(id2);
	if (lc == null || rc == null) return;
	var lh = getHeight(lc);
	var rh = getHeight(rc);
	
	if (lh > rh) {
		rc.style.height = (lh - minus) + 'px';
	} else if (rh > lh) {
		lc.style.height = (rh - minus) + 'px';
	}
}

function getHeight(element) {
	return getDimensions(element).height;
}

function getDimensions(element) {
    var display = element.style.display;
    if (display != 'none' && display != null)
      return { width: element.offsetWidth, height: element.offsetHeight };

    var els = element.style;
    var originalVisibility = els.visibility;
    var originalPosition = els.position;
    var originalDisplay = els.display;
    els.visibility = 'hidden';
    els.position = 'absolute';
    els.display = 'block';
    var originalWidth = element.clientWidth;
    var originalHeight = element.clientHeight;
    els.display = originalDisplay;
    els.position = originalPosition;
    els.visibility = originalVisibility;
    
	return { width: originalWidth, height: originalHeight };
};

function addOnLoad(handler) {
	if (typeof window.addEventListener != "undefined")
		window.addEventListener("load", handler, false);
	else if (typeof window.attachEvent != "undefined") {
		window.attachEvent("onload", handler);
	}
	else {
		if (window.onload != null) {
			var oldOnload = window.onload;
			window.onload = function(e) {
				oldOnload(e);
				handler();
			};
		}
		else window.onload = handler;
	}	
}
