var backgroundDark = "#2D5997";
var backgroundLight = "#aaaadd";

var myColor = "#6699FF";


// The highlight/changeback functions are not strictly required if I only want to highlight the link itself,
// These causes the entire background box behind the link to be highlighted/turned off
//  Code should work with IE and Netscape 6

function highlight(itemname, color) {
	document.getElementById(itemname).style.background = color;
}

function changeback(objectname) {
	document.getElementById(objectname).style.background = "transparent";
}



function contains(a, b) {

  	while (b.parentNode) {	
		if ((b = b.parentNode) == a)  return true;
	}
 	return false;

}


function hideMenu(event) {

	var mouseFrom, movingTo;

	if (window.event) {
		mouseFrom = this;
		movingTo = window.event.toElement;
  	}
  	else {
    		mouseFrom = event.currentTarget;
    		movingTo = event.relatedTarget;
 	 }

 	 if (mouseFrom != movingTo && !contains(mouseFrom, movingTo)) {
    		mouseFrom.style.visibility = "hidden";
		hideAll(true);
	}
}

function hideAll(hide) {
	if (hide) {
		document.getElementById('menu0').style.visibility = "hidden"; 
		document.getElementById('menu1').style.visibility = "hidden"; 
		document.getElementById('menu2').style.visibility = "hidden"; 
		document.getElementById('menu3').style.visibility = "hidden"; 

}
	else {
		document.getElementById('menu0').style.zIndex = 100;
		document.getElementById('menu0').style.background = backgroundLight;
		document.getElementById('menu1').style.zIndex = 100;
		document.getElementById('menu1').style.background = backgroundLight;
		document.getElementById('menu2').style.zIndex = 100;
		document.getElementById('menu2').style.background = backgroundLight;							document.getElementById('menu3').style.zIndex = 100;
		document.getElementById('menu3').style.background =backgroundLight;
 }

}

function showMenu(menuToShow) {
	hideAll(true);
	var myMenu = document.getElementById(menuToShow);
	myMenu.style.visibility = "visible";
	myMenu.style.zIndex = 120;
//	myMenu.style.background =  backgroundDark;
}
