var currentMenuItem

function toggleSubMenu(menuItemID)
{
	var menuItem = document.getElementById(menuItemID);
	var isTopLevelNav;
		
	menuItem.className = switchClassName(menuItem.className);	
	if(currentMenuItem!=null)
	{	
		if(currentMenuItem!=menuItem)
		{
			ensureMenuItemClosed(currentMenuItem);
		}
	}
	
	currentMenuItem = menuItem;	
}

function switchClassName(className)
{
	className = className.indexOf('Show')>-1?className.replace('Show','Hide'):className.replace('Hide','Show');
	return className;
}

function ensureMenuItemClosed(menuItem)
{
	if(menuItem.className.indexOf('Show')>-1)
	{
		menuItem.className = switchClassName(menuItem.className);
	}
}

function openPopupWindow(URL,width,height,showScroll,winName)
	{
	// Set the window position to the center...
	if (document.all) 
		var widthMax = screen.width, heightMax = screen.height;
	else
		if (document.layers)
			var widthMax = window.outerWidth, heightMax = window.outerHeight;
		else
			var widthMax = 800, heightMax=600;
	var widthOffSet = (widthMax - width) / 2, heightOffSet = (heightMax - height) / 2;
	childWindow = window.open(URL,winName,'width='+width+',height='+height+',status=no,scrollbars='+showScroll+',resizable=yes,menubar=no,screenX='+widthOffSet+',screenY='+heightOffSet+',top='+heightOffSet+',left='+widthOffSet+'');
	if (childWindow.opener == null) childWindow.opener = self;
}

