// JavaScript Document

<!-- dd menu -->
var timeout         = 300;
var closetimer		= 0;
var ddmenuitem      = 0;
var menuItemButton	= "";
// open hidden layer
function mopen(id, menuElement)
{	
	var modMargin = menuElement.offsetWidth;
	menuItemButton = menuElement;
	ddmenuitem = document.getElementById(id);
	var menuImage = menuItemButton.id;
	// cancel close timer
	mcancelclosetime();

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

	// get new layer and show it
	menuItemButton.setAttribute("style", "background:url(images/navBar/"+menuItemButton.id+"_drop.gif) bottom center no-repeat; height:31px; padding:15px 0 0 0");
	menuItemButton.style.background = "url(images/navBar/"+menuItemButton.id+"_drop.gif) bottom center no-repeat";
	menuItemButton.style.height = "31px";
	menuItemButton.style.padding = "15px 0 0 0";
	
	menuItemButton.firstChild.setAttribute("style", "font-weight:bold;color:#6799C8");
	menuItemButton.firstChild.style.fontWeight = "bold";
	menuItemButton.firstChild.style.color = "#6799C8";
	
	ddmenuitem.style.marginLeft = "-64px";
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	if(menuItemButton) {
		menuItemButton.setAttribute("style", "background:url(images/navBar/"+menuItemButton.id+".gif) bottom center no-repeat;");
		menuItemButton.style.background = "url(images/navBar/"+menuItemButton.id+".gif) bottom center no-repeat";
		menuItemButton.style.height = "5px";
		menuItemButton.style.padding = "20px 0 0 0";
		
		menuItemButton.firstChild.setAttribute("style", "font-weight:normal;color:#FFFFFF");
		menuItemButton.firstChild.style.fontWeight = "normal";
		menuItemButton.firstChild.style.color = "#FFFFFF";
	}
}

// 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;