
var oldID, oldMenu;
var DOM = (document.getElementById)?1:0;
var IE4 = (document.all)?1:0;

/**
 *currently only modified to work with MSIE.
 **/
function highlight(idName){
	if (DOM){
		var parentX = document.getElementById(idName);
		if (parentX) parentX.style.backgroundColor = "#FFFFFF";
		if ((oldID) && (oldID != idName)){	//check to see if the layer exists
			var oldX = document.getElementById(oldID);
			if (oldX) oldX.style.backgroundColor = "#CC9900";
		}
		//handle already visible menus
		if (oldMenu){				//see if there are any menus already showing
			oldX = document.getElementById(oldMenu);
			if (oldX) oldX.style.visibility = "hidden";
		}
		//show menu
		var x = document.getElementById(idName+"Menu");
		if (x){		//make sure the menu exists
			x.style.visibility = "visible";
			oldMenu = idName + "Menu";
		}
		oldID = idName;
	}else if (IE4){
		var x = document.all[idName];
		if (x) x.style.backgroundColor = "#FFFFFF";
		if ((oldID) && (oldID != idName)){	//see if the layer exists
			x = document.all[oldID];
			if (x) x.style.backgroundColor = "#CC9900";
		}
		if (oldMenu){	//any old menus?
			x = document.all[oldMenu];			
			if (x) x.style.visibility = "hidden"
		}
		var newID = idName + "Menu";
		x = document.all[newID];
		if (x){		//does this have a corresponding menu?
			x.style.visibility = "visible";
			oldMenu = newID;
		}
		oldID = idName;
	}

}

function hideMenu(idName){
	if (document.getElementById(idName))
		if (DOM){
			var oldMenu = document.getElementById(idName + "Menu")
			var oldID = document.getElementById(idName)
			oldMenu.style.visibility = "hidden"; oldMenu = null;
			oldID.style.background = "#CC9900"; oldID = null;

		} else if (IE4) {
			eval('document.all["'+idName+ 'Menu"].style.visibility ="hidden";'); oldMenu = null;
			eval('document.all["'+idName+ '"].style.background="#CC9900";'); oldID = null;
		}

}

function showMenu(idName){
	if (document.getElementById(idName))
		if (DOM){
			var oldMenu = document.getElementById(idName + "Menu")
			var oldID = document.getElementById(idName)
			if (oldMenu){ oldMenu.style.visibility = "visible"; oldMenu = idName + "Menu"; }
			if (oldID){ oldID.style.backgroundColor = "#FFFFFF"; oldID = idName; }

		} else if (IE4) {
			var idMenu = idName + "Menu";
			var oldMenu = document.all[idMenu];
			var oldID = document.all[idName];
			if (oldMenu){ oldMenu.style.visibility = "visible"; oldMenu = idName + "Menu"; }
			if (oldID){ oldID.style.backgroundColor = "#FFFFFF"; oldID = idName; }
		}

}

