var first_run;
var is_active;
var tab_id;

function tabOver(id) {
	hide_now = 100;
	if(first_run!=undefined) {
		hideMenu();
	}
	first_run = 1;
	menu_y = 30;
	tab_id = id;
	document.getElementById("menu_"+tab_id).style.display = "inline";
	document.getElementById("menu_"+tab_id).style.top = "30px";
	if(document.getElementById("tab_"+tab_id).className!="active") {
		is_active = 1;
	} else {
		is_active = 2;
	}
	document.getElementById("tab_"+tab_id).className = "activated";
}
function tabOut(id) {
	hide_now = 0;
	no_hide = 0;
	tab_id = id;
	hideInterval = setInterval(hideMenu, 100);
}

function subOver() {
	no_hide = 1;
}
function subOut() {
	hide_now = 0;
	no_hide = 0;
}

function hideMenu() {
	if(hide_now>=5 && no_hide == 0) {
		document.getElementById("menu_"+tab_id).style.display = "none";
		document.getElementById("menu_"+tab_id).style.top = "30px";
		if(is_active==1) {
			document.getElementById("tab_"+tab_id).className = "";
		} else {
			document.getElementById("tab_"+tab_id).className="active";
		}
		clearInterval(hideInterval);
	}
	else {
		hide_now++;
	}
}

