function toggleSubMenu(newState, menuId) {
	submenu = document.getElementById('submenu' + menuId);
	if (newState == 'hide') {
		//if a request to hide a menu has been made
		if (submenu) submenu.style.visibility = 'hidden';
		submenuShowing = 0;	
		return;
	} else if (newState == 'show') {
		//if display of a new menu has been requested
		
		if (submenuShowing > 0) {
			//don't do anything if there is already a menu showing
			//return;
			oldMenu = document.getElementById('submenu' + submenuShowing);
			if (oldMenu) oldMenu.style.visibility = 'hidden';
		}
		if (submenu) {
			submenu.style.visibility = 'visible';
			submenuShowing = menuId;
		} else {
			//don't do anything if the requested submenu doesn't exist
			return;	
		}
	}
	/*
	//show the requested submenu if any, and hide all the others
	for (i = 0; i < menuIds.length; i++) {
		curId = menuIds[i];
		submenu = document.getElementById('submenu' + curId);
		if (submenu) {
			if (curId == menuId) {
				submenu.style.visibility = useVisibility;
			} else {
				submenu.style.visibility = 'hidden';
			}
		}
	}
	*/
	//record which submenu is now being displayed
}