function attachHandlers() {
	var m, a, i;
	m = document.getElementById("menu");
	a = m.getElementsByTagName("LI");
	for (i=0; i<a.length; i++) {
		if (a[i].id && a[i].id.indexOf("menu_") == 0) { // our menu
			if (selMen>=0 && a[i].id.indexOf("menu_" + selMen) == 0) {
				a[i].onmouseover = menuOver;
			} else {
				a[i].onmouseover = menuOver;
				a[i].onmouseout = menuOut;	
			}
		}
	}
}
var lastMenuOpened = null;

function menuOver() {
	var d;
	d = document.getElementById("sub" + this.id);
	if (!d) return;
	d.style.display = "block";
	if (window.lastMenuOpened && window.lastMenuOpened != d) {
		if (window.lastMenuOpened.id.indexOf("submenu_" + selMen) != 0) {
			window.lastMenuOpened.style.display = "none";
		}
	}
	clearTimeout(window["to_" + this.id]);
	window.lastMenuOpened = d;
	
}

function menuOut() {
	clearTimeout(window["to_" + this.id]);
	window["to_" + this.id] = setTimeout("hideMenu('" + this.id + "')", 1000);
}

function hideMenu(menu_id) {
	var menu = document.getElementById("sub" + menu_id);
	if (!menu) return;
	if (menu.id.indexOf("submenu_" + selMen) != 0) {
		menu.style.display = "none";
	}
}
