
// MENUS

	// find the screen position of the given DOM object
	// (used to position drop-down menus
	
	function findPosX(obj) {
		var curleft = 0;
		if(obj.offsetParent)
			while(1) {
				curleft += obj.offsetLeft;
				if(!obj.offsetParent)
					break;
				obj = obj.offsetParent;
			}
		else if(obj.x)
			curleft += obj.x;
		return curleft;
	}
		
	function findPosY(obj) {
		var curtop = 0;
		if(obj.offsetParent)
			while(1) {
				curtop += obj.offsetTop;
				if(!obj.offsetParent)
					break;
				obj = obj.offsetParent;
			}
		else if(obj.x)
			curtop += obj.x;
		return curtop;
	}
	
	// Show and hide the dropdown menu
		
	var gMenu = 0;
	function ShowMenu(pThis) {
		gMenu += 1
		var xMenuSub = pThis;
		if (xMenuSub.nodeName == 'A') {
			xMenuSub = xMenuSub.nextSibling.nextSibling;
		}
//		xMenuSub.style.left = findPosX(pThis) + 'px';
		xMenuSub.style.visibility = 'visible';
	}
	
	function HideMenu (pThis) {
		gMenu -= 1;
		if (gMenu == 0) {
			var xMenuSub = pThis;
			if (xMenuSub.nodeName == 'A') {
				xMenuSub = xMenuSub.nextSibling.nextSibling;
			}
			xMenuSub.style.visibility = 'hidden';
		}
	}
	
	// attach event handlers to the menu anchors (and their dropdowns)
	
	var xMenu = document.getElementById('Menu');
	var xNodes = xMenu.childNodes;
	for (var i = 0;  i < xNodes.length-2; i++) {
		var xNode = xNodes[i];
		if (xNode.nodeName == 'A' && xNode.nextSibling.nextSibling.nodeName == 'DIV') {
			xNode.onmouseover = function () { ShowMenu(this) };
			xNode.onmouseout = function () { HideMenu(this) };
			xNode = xNode.nextSibling.nextSibling;
			xNode.onmouseover = function () { ShowMenu(this) };
			xNode.onmouseout = function () { HideMenu(this) };
		}
	};


