var menus=5;
var timer;

function menu(i) {
	var x;
	clearTimeout(timer);
	for(x=0; x<menus; x++) {
		if(x==i) {
			window.document.getElementById("menu" + x).style.visibility='visible';
			var color;
			color = 'black';
			window.document.getElementById("headmenu" + x).style.backgroundColor = color;
			
		} else {
			window.document.getElementById("menu" + x).style.visibility='hidden';
			window.document.getElementById("headmenu" + x).style.backgroundColor = '';
		}
		
	}
}

function hideall() {
	var x;
	for(x=0; x<menus; x++) {
		window.document.getElementById("menu" + x).style.visibility='hidden';
		window.document.getElementById("headmenu" + x).style.backgroundColor = '';
		window.document.getElementById("headmenu" + x).style.borderStyle = 'none';
	}
}

function delayhide(i) {
	timer = setTimeout('hideall()', 500);
}