// Copyright 2006-2007 javascript-array.com

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;
var closetimer2	= 0;
var ddmenuitem2	= 0;



// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 


// open hidden layer

function mopen2(id)

{	

	// cancel close timer

	mcancelclosetime2();



	// close old layer

	if(ddmenuitem2) ddmenuitem2.style.visibility = 'hidden';



	// get new layer and show it

	ddmenuitem2 = document.getElementById(id);

	ddmenuitem2.style.visibility = 'visible';



}



// close showed layer

function mclose2()

{

	if(ddmenuitem2) ddmenuitem2.style.visibility = 'hidden';

}



// go close timer

function mclosetime2()

{

	closetimer2 = window.setTimeout(mclose2, timeout);

}



// cancel close timer

function mcancelclosetime2()

{

	if(closetimer2)

	{

		window.clearTimeout(closetimer2);

		closetimer2 = null;

	}

}


