
var timeOut	= 500;
var closeTimer	= 0;
var menuItem	= 0;


function mainOpen(id)
{	

	mainCancelCloseTime();


	if(menuItem) menuItem.style.visibility = 'hidden';


	menuItem = document.getElementById(id);
	menuItem.style.visibility = 'visible';

}

function mainClose()
{
	if(menuItem) menuItem.style.visibility = 'hidden';
}


function mainCloseTime()
{
	closeTimer = window.setTimeout(mainClose, timeOut);
}


function mainCancelCloseTime()
{
	if(closeTimer)
	{
		window.clearTimeout(closeTimer);
		closeTimer = null;
	}
}

document.onclick = mainClose; 
