function hideAll(ex)
{
	if(document.getElementsByTagName)
	{
		var divs = document.getElementsByTagName('div');
		//loop through the divs and hide the ones w/ class submenu
		for(var i=0; i<divs.length; i++)
		{
			if(divs[i].className == 'submenu' && divs[i].id != ex+"List")
			{
				//Hide the submenu
				divs[i].style.display = 'none';
				//Strip the "List" off the ID of the current div to get the ID of the menuheader
				var headerId = divs[i].id.substr(0,divs[i].id.length-4);
				//"Close" the menu header, so that it has a + next to it instead of a -
				document.getElementById(headerId).className = 'menuhead';
			}
		}
	}
}
	
function setupLinks()
{
	if(document.getElementById && document.getElementsByTagName)
	{
		var atags = document.getElementsByTagName('a');
		//loop through the atags and add an event handler to the menu headers
		for(var i=0; i<atags.length; i++)
		{
			if(atags[i].className == 'menuhead' || atags[i].className == 'menuheadOpen')
			{
				atags[i].onclick=function()
				{
					var submenu = document.getElementById(this.id + 'List');
					var thisItem = document.getElementById(this.id);
					if(submenu.style.display != 'none')
					{
						submenu.style.display = 'none';
						thisItem.className = 'menuhead';
					}
					else
					{
						submenu.style.display = "block";
						thisItem.className = 'menuheadOpen';
					}

				}
			}
		}
	}
}

setupLinks();
