var old_menu_obj= null;
var timer = null;

function menu(obj, status){

	menu_obj=document.getElementById(obj);
	
	if (status) {

		window.timer && window.clearTimeout(timer);
		
		if (menu_obj)
		{
			menu_obj.style.display='block';
		}	

		if (old_menu_obj && timer && old_menu_obj!=obj)
		{
			old_menu_object=document.getElementById(old_menu_obj);
			if (old_menu_object) {
				old_menu_object.style.display='none';
			}	
		}

		old_menu_obj = obj;
	}
	else {
		
		timer = setTimeout( function () { hide(menu_obj); } , 200 );
	}
}

function hide(obj){
	
	if (obj) 
	{
		obj.style.display = 'none';
	}	
		
	old_menu_obj = null;
}

function clear_time(){
	window.clearTimeout(timer);
}