// hide all the menu sections
function hideMenuSections() {
	// find all menu section - div of class = menuSection
	// and hide them
	dojo.query("div.menuSection").forEach(
		function(menuSection) {
			menuSection.style.display = "none";
		});
}

// link the anchor tag onclick event to the showMenuSection function
// and set the href to the click spot so it postions the anchor 
// at the top of the page 
function linkMenuSections() {
	dojo.query("a.menuSection").forEach(
		function(secLink) {
			secLink.href = "javascript:";
			dojo.connect(secLink, "onclick", showHideMenuSection);
		});
}

// show the menu section associated with the link
function showHideMenuSection(event) {
	// hide them all again
	hideMenuSections();
	
	// the section to show/hide is the id of the clicked link + MS
	var targetId = event.target.id;
	
	var showHideId = targetId.substr(0, targetId.length - 1) + "MS";
	// show it
	var showHide = dojo.byId(showHideId);
	// if its currently hidden show it
	if (showHide.style.display == "none") {
		showHide.style.display = "block";
		location.hash = "#menutop";
	} else {
		showHide.style.display = "none";
	}
	dojo.stopEvent(event)
	return false;				
}
