/*
PURPOSE:
	[1] Provides Horizantal Drop Down Menu Functionality	

CREATION DATE:
	May 1, 2009

REVISION HISTORY:
	

STATUS OF THIS DOCUMENT:
	This is a operational document.

DEPENDANCIES:
	DropDown.css -- Provides mouse over background change and sub menu display. 

MAINTAINER:
	Mike Van Alstine
	m v a @ L 5 L . b i z

LEGAL NOTICE:
	Distribution of this document is limited.
	Copyright (C) The VAMM Group 2009. All Rights Reserved.
*/

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 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;
