var timeout = 1000;
var hidemen;
var hidesubmen;
var current_displayed = 0;
var calling = null;
var current_subMenu = 0;
function keep_menu()
{
	clearTimeout(hidemen);
}
function clear_menu()
{
	hidemen = window.setTimeout("remove_menu()", timeout);
}
function keep_subMenu()
{
	clearTimeout(hidesubmen);
}
function clear_subMenu()
{
	hidesubmen = window.setTimeout("remove_subMenu()", timeout);
}
function remove_menu()
{
	if(calling != null)
		calling.className = "menu_item";
	if(current_displayed != 0)
		document.getElementById("men_tble_"+current_displayed).style.display = 'none';
	current_displayed = 0;
}
function remove_subMenu()
{
	if(current_subMenu != 0)
		document.getElementById("men_tble_"+current_subMenu).style.display = 'none';
	current_subMenu = 0;
}
function display_menu(obj,id)
{
	if(id != current_displayed)
	{
	clearTimeout(hidemen);
	remove_menu();
	calling = obj;
	pos = new Array();
	pos = findPos(obj);
	var submenu;
	submenu = document.getElementById('men_tble_'+id);
	submenu.style.left = pos[0] - "1" + "px";
	submenu.style.top = pos[1] + "px";
	submenu.style.display = "block";
	current_displayed = id;
	calling.className = "menu_item_hover";
	}
}
function display_submenu(obj,id)
{
	if(id != current_subMenu)
	{
	clearTimeout(hidesubmen);
	remove_subMenu();
	pos = new Array();
	pos = findPos(obj);
	var submenu;
	submenu = document.getElementById('men_tble_'+id);
	submenu.style.left = pos[0]  + "px";
	submenu.style.top = pos[1] + "px";
	submenu.style.display = "";
	current_subMenu = id;
	}
}
