	//Stores the visible menu's name
	var visibleMenu = '';
	
	//Fires when the user clicks a menu header button to turn
	//the menu on or off
	function menuClick(parentId, menuId){
		//Retrieves the menu
		var menu = document.getElementById(menuId);
		var pnt = document.getElementById(parentId);
		
		//If turning off the currently visible menu
		if (visibleMenu == menuId) {
			
			//Clears the visible menu
			visibleMenu = '';
			menu.style.visibility = 'hidden';
			destroyBacking();
		}
		else { //Turns on the new menu
			//Turns off an existing menu
			if (visibleMenu != '') {
				var currentMenu = document.getElementById(visibleMenu);
				currentMenu.style.visibility = 'hidden';
			}
			
			//Turns on the new menu
			menu.style.visibility = 'visible';
			menu.style.left = getXCoord(pnt) + 'px';
			menu.style.top = getYCoord(pnt.offsetParent) + pnt.offsetParent.offsetHeight + 'px';
			visibleMenu = menuId;
			createBacking(menu);
		}
	}
	

	//Creates a backing for a menu
	function createBacking(menuObj) {
		//Removes any existing backings
		destroyBacking();
		
		//Creates and adds the controls
		div = document.createElement('div');
		div.id = 'BackingDiv';
		frm = document.createElement('IFRAME');
		frm.id = 'BackingFrame';
		frm.name = 'BackingFrame';
		div.appendChild(frm);
		document.body.appendChild(div);
		
		//Sets the position and height of the menu
		div.className = 'N3Backing';
		div.style.left = menuObj.style.left;
		div.style.top = getYCoord(menuObj) + 'px';
		div.style.height = menuObj.style.height;
		
		frm.marginHeight = '0';
		frm.marginWidth = '0';
		frm.src = '';
		frm.frameBorder = '0';
		frm.width = menuObj.offsetWidth;
		frm.height = menuObj.offsetHeight;
	}
	

	//Destroyes any existing backings
	function destroyBacking() {
	
		//Retrieves the frame and div
		var div = document.getElementById('BackingDiv');
		
		//Removes the controls from the document
		if (div != null) {
			document.body.removeChild(div);
		}
	}