// JavaScript Document
var keepMenuOpen = true;
var curMenu = '';
function setAllowRaise(isWhat)
{
	// sets the current menu as actively dropped	
	allowRaise = isWhat;
}
function drop(whichMenu)
{
	// hide ALL MENUS
	var testMenu = document.getElementById('properties_drop');
	testMenu.style.visibility = 'hidden';
	
	testMenu = document.getElementById('about_drop');
	testMenu.style.visibility = 'hidden';
	
	testMenu = document.getElementById('whatsnew_drop');
	testMenu.style.visibility = 'hidden';
	
	
	// get the menu
	var theMenu = document.getElementById(whichMenu + '_drop');
	
	// get the main menu that was clicked
	var parentMenu = document.getElementById(whichMenu);
	
	// move the drop menu to the parent menu
	var newLeft = getAbsoluteLeft(parentMenu);
	

	theMenu.style.left = newLeft + "px";
	theMenu.style.visibility = 'visible';
	
	keepMenuOpen=true;
}
function raise(whichMenu)
{
	// set the timeout function to start
	keepMenuOpen = false;
	curMenu = whichMenu;
	setTimeout("raiseReal()",600);
	
}
function raiseReal()
{

	// and set the variable to close menu
	if (keepMenuOpen == false && curMenu != '')
	{
		var theMenu = document.getElementById(curMenu + '_drop');
		theMenu.style.visibility = 'hidden';
	}
}
function getAbsoluteLeft(objectId) {
	// Get an object left position from the upper left viewport corner
	// Tested with relative and nested objects
	//o = document.getElementById(objectId)
	o = objectId;
	oLeft = o.offsetLeft            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent left position
		o = oParent
	}
	// Return left postion
	return oLeft
}

function getAbsoluteTop(objectId) {
	// Get an object top position from the upper left viewport corner
	// Tested with relative and nested objects
	o = document.getElementById(objectId)
	oTop = o.offsetTop            // Get top position from the parent object
	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent  // Get parent object reference
		oTop += oParent.offsetTop // Add parent top position
		o = oParent
	}
	// Return top position
	return oTop
}
