var SUBMENU_HIDE_TIMEOUT = 500;
var currentMenu = ACTIVE_MENU_ITEM;
var cancelHide = false;

function getStyle(whichLayer) {
	var style2;
	if (document.getElementById) {
	// this is the way the standards work
		style2 = document.getElementById(whichLayer).style;
	} else if (document.all) {
	// this is the way old msie versions work
		style2 = document.all[whichLayer].style;
	} else if (document.layers[whichLayer]) {
	// this is the way nn4 works
		style2 = document.layers[whichLayer].style;
	}
	return style2;
}



function turnOn(whichLayerId) {
	self.status = "";
	cancelHide = true;
	for(i=1;i<NUM_MENU_ITEMS+1;i++) {
	//Turn off every submenu
		if(i == whichLayerId) {
			self.status = self.status + " / on" + whichLayerId;
			getStyle("secondary" + whichLayerId).display = "block"; //Get the style for the layer and turn on
			getStyle("primary" + i).color = "#ff0000"; //Get the style for the layer and turn on
			} else {
			self.status = self.status + " / off" + i;
			getStyle("secondary" + i).display = "none"; //Get the style for the layer and turn on
			getStyle("primary" + i).color = "#000000"; //Get the style for the layer and turn on
		}
	}
	
}

function turnOff() {
//	if(!cancelHide)
//		setTimeout("showOnlyActive();",SUBMENU_HIDE_TIMEOUT);
//	cancelHide = false;
}

function showOnlyActive(){
	if(!cancelHide) {
		turnOn(ACTIVE_MENU_ITEM);
	}
	cancelHide = false;
}