// DropDownMenu.js
// Copyright (c) 2005, 2006 PeteSoft, LLC. All Rights Reverved

var fHideDropDown = false;
var CurrentDropDown = "";

var cnShow = 'visible';
var cnHide = 'hidden';

//-------------------------------------------------------------------------
function ShowDropDown(SubMenuID, Menu)
{
	if (CurrentDropDown != "")
	{
		fHideDropDown = true;
		HideDropDown1(CurrentDropDown);
	}
	
	fHideDropDown = false;
	
	var SubMenuStyle = GetStyle(SubMenuID);
	if (SubMenuStyle)
	{
		SubMenuStyle.top = GetY(Menu) + Menu.offsetHeight;
		SubMenuStyle.left = GetX(Menu);
		SubMenuStyle.visibility = cnShow;
		SubMenuStyle.display = "";
	}
	
	CurrentDropDown = SubMenuID;
}

//-------------------------------------------------------------------------
function HideDropDown(SubMenuID)
{
	// hiding the menu is delayed in case the onMouseOut event occurs
	// because the mouse is now over the drop down menu instead of the 
	// main menu item
	
	fHideDropDown = true;
	setTimeout("HideDropDown1('" + SubMenuID + "')", 100);
}

//-------------------------------------------------------------------------
function HideDropDown1(SubMenuID)
{
	if (fHideDropDown)
	{
		HideElement(SubMenuID);
		
		if (CurrentDropDown == SubMenuID)
		{
			CurrentDropDown = "";	
		}
		fHideDropDown = false;
	}
}
