
function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll,iStatus) {
	var winX, winY ;
	if (screen) {
		if ((screen.height - winH) < 150) {
			winX = (screen.width - winW) / 2;
			winY = 0;
		} else {
			winX = (screen.width - winW) / 2;
			winY = (screen.height - winH) / 2;
		}
		var popWindow = window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",status=" + iStatus + ",width=" + winW + ",height=" + winH + ",top=" + winY + ",left=" + winX + "");
		if (popWindow) popWindow.focus();
	} else {
		window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",status=" + iStatus + ",width=" + winW + ",height=" + winH);
	}
}

//<a href="/path/file.ext" onClick="popWinOpen(600,560,'/path/file.ext','myWin',0,0,0); return false">Linktext</a>


function setHeights(winH) {
	try {
		var oOuter    = document.getElementById("outer_container") ;
		var oInner    = document.getElementById("inner_container") ;
		var oBottom   = document.getElementById("bottom") ;
		var oLeft     = document.getElementById("leftmenu") ;
		var posBottom = getElementTop(oBottom) ;
		//alert(posBottom + ", " + winH) ;
		if (oOuter && oInner && (posBottom < winH)) {
			var posInner = getElementTop(oInner) ;
			var newH     = winH - posInner ;
			oInner.style.height = newH + "px" ;
		}
		if (oLeft) {
			setHeightsLeft() ;
		}
	} catch (e) {}
}

function setHeightsLeft() {
	try {
		var oLeft   = document.getElementById("leftmenu") ;
		var oBottom = document.getElementById("bottom") ;
		if (oLeft && oBottom) {
			var posBottom = getElementTop(oBottom) ;
			var posLeft   = getElementTop(oLeft) ;
			var newH      = posBottom - posLeft - 10 ;
			oLeft.style.height = newH + "px" ;
			//alert(posBottom + ", " + newH) ;
		}
	} catch (e) {}
}

function clearLastBorderBottom() {
	try {
		var oLeftBox1 = document.getElementById("leftBox1") ;
		var oLeftBox2 = document.getElementById("leftBox2") ;
		var oLeftBox3 = document.getElementById("leftBox3") ;
		if (oLeftBox3) {
			oLeftBox3.style.borderBottom = 0 ;
		} else if (oLeftBox2) {
			oLeftBox2.style.borderBottom = 0 ;
		} else if (oLeftBox1) {
			oLeftBox1.style.borderBottom = 0 ;
		}
	} catch (e) {}
	try {
		var oRightBox1 = document.getElementById("rightBox1") ;
		var oRightBox2 = document.getElementById("rightBox2") ;
		var oRightBox3 = document.getElementById("rightBox3") ;
		var oRightBox4 = document.getElementById("rightBox4") ;
		if (!oRightBox4) {
			if (oRightBox3) {
				oRightBox3.style.borderBottom = 0 ;
			} else if (oRightBox2) {
				oRightBox2.style.borderBottom = 0 ;
			} else if (oRightBox1) {
				oRightBox1.style.borderBottom = 0 ;
			}
		}
	} catch (e) {}
}

function getElementTop(el) {
	if (!el && this) {
		el = this;
	}
	var posTop = el.offsetTop;
	var elPar = el.offsetParent;
	while (elPar != null) {
		posTop += elPar.offsetTop;
		elPar = elPar.offsetParent;
	}
	return posTop;
}


var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function mopen(id, openAtObject) {
	mcancelclosetime();
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	ddmenuitem = document.getElementById(id);
	if (ddmenuitem) {
		moveObjectToObject(ddmenuitem,openAtObject, 23, 0) ;
	}
	ddmenuitem.style.visibility = 'visible';
}

function mclose() {
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

function mclosetime() {
	closetimer = window.setTimeout(mclose, timeout);
}

function mcancelclosetime() {
	if(closetimer) {
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}