/*
		How the popup menu works 
		1. The document.body.onmouseover event is set to call the hidSelectedPopupMenu() function. (This is in the javascript below.)
		   (Note: Normally when you mouse over anything, then the event bubbles up and calls the body's onmouseover event.)
		2. You mouse over the tab. It calls the showPopupMenu() function.
		3. The onMouseOver event on both the tab and the popup menu tells the event not to bubble up. This is in order to stop the body's onMouseOver event from being fired and closing the popup.
		4. You mouse off of the popup menu and onto the body triggering the body's onMouseOver event, thus calling the hideSelectedPopupMenu() function (as set in Step 1).
*/
	

	var ActivePopup = false
	
	/*
	function hideSelectedPopupMenu(PopupMenu){
		document.getElementById(PopupMenu).style.display = 'none';
	}
	*/
	
	function hideSelectedPopupMenu(){
		if(ActivePopup){
			document.getElementById(ActivePopup).style.display = 'none';
			toggle("PopupIndustries", "none");
			toggle("PopupRegulations", "none");
			toggle("PopupNeeds", "none");
		}
	}
	
	function showPopupMenu(PopupMenu){
		// Hide the old selected menu
		hideSelectedPopupMenu();
		
		// Show the newly selected menu
		document.getElementById(PopupMenu).style.display = 'block';
	
		// Store the name of the active popup menu	
		ActivePopup = PopupMenu;
	}
	
	/*
	 * Tell the body onclick to hide the active popup menu when you click on the body
	 */
	/*
	document.body.onclick=function(){
		bodyMouseMove();
	}
	*/
	
	function bodyMouseOver(e){
		//document.getElementById("debug").innerText = window.event.cancelBubble;
		//document.title = window.event.srcElement.innerHTML;
		//if(window.event.srcElement.type != "DIV"){
		hideSelectedPopupMenu();
		//}
	}