SEP_PADDING = 5;
HANDLE_PADDING = 7;
var EditMode = false;
var SourceMode = true;
var h;
var w;
var l;
var t;
var topMar = 20;
var leftMar = -20;
var spaces = 1;
var isvisible;
var global = window.document;
global.fo_currentMenu = null;
global.fo_shadows = new Array;

function HideMenu() {
	var mX;
	var mY;
	var vDiv;
	var mDiv;

	if (isvisible == true) {
		vDiv = document.all("menuDiv");
		mX = window.event.clientX + document.body.scrollLeft;
		mY = window.event.clientY + document.body.scrollTop;

		if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight)) {
			vDiv.style.visibility = "hidden";
			isvisible = false;
		}

	}

}

function ShowMenu(vMnuCode,tWidth) {
	vSrc = window.event.srcElement;
	vMnuCode = "<TABLE id='submenu' CELLSPACING='1' cellpadding='3' STYLE='width:"+tWidth+"' onmouseout='HideMenu()'><TR><TD>" + vMnuCode + "</TD></TR></TABLE>";
	h = vSrc.offsetHeight;
	w = vSrc.offsetWidth;
	l = vSrc.offsetLeft + leftMar+4;
	t = vSrc.offsetTop + topMar + h + spaces-2;
	vParent = vSrc.offsetParent;

	while (vParent.tagName.toUpperCase() != "BODY") {
		l += vParent.offsetLeft;
		t += vParent.offsetTop;
		vParent = vParent.offsetParent;
	}

	menuDiv.innerHTML = vMnuCode;
	menuDiv.style.top = t;
	menuDiv.style.left = l;
	menuDiv.style.visibility = "visible";
	isvisible = true;
    makeRectangularDropShadow(submenu,4);
}

function makeRectangularDropShadow(el,size) {
	var i;

	for (i=size; i>0; i--) {
		var rect = document.createElement('div');
		var rs = rect.style;
		rs.position = 'absolute';
		rs.left = (el.style.posLeft + i) + 'px';
		rs.top = (el.style.posTop + i) + 'px';
		rs.width = el.offsetWidth + 'px';
		rs.height = el.offsetHeight + 'px';
		rs.zIndex = el.style.zIndex - i;
		var opacity = 1 - i / (i + 1);
		rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
		el.insertAdjacentElement('afterEnd', rect);
		global.fo_shadows[global.fo_shadows.length] = rect;
	}

}

function showsubmenu(sid) {
	whichEl = eval("submenu" + sid);
	imgmenu = eval("imgmenu" + sid);

	if (whichEl.style.display == "none") {
		eval("submenu" + sid + ".style.display=\"\";");
		imgmenu.background="";
	} else {
		eval("submenu" + sid + ".style.display=\"none\";");
		imgmenu.background="";
	}

}