
var selectedDrop = '';
var lastSelected = '';

function showsubnav( theId )
{
	if( document.getElementById( theId ).style.display != 'block' )
		document.getElementById( theId ).style.display = 'block';
	else
		document.getElementById( theId ).style.display = 'none';
}

function showdrop( theID )
{
	if( document.getElementById( lastSelected ) != null && lastSelected != theID  )
		document.getElementById( lastSelected).style.display = "none";
	selectedDrop = theID;
	document.getElementById( theID ).style.display = "block";
}
function hidedrop( theID, secs )
{
	if( secs == null )
	{
		secs = 1;
		lastSelected = selectedDrop;
		selectedDrop = '';
	}
    if (secs==0)
    {
        if(timerRunning)
        	clearTimeout(timerID);
    	timerRunning = false;
    	if( selectedDrop != theID )
        	document.getElementById( theID ).style.display = "none";
    }
    else
    {
        self.status = secs;
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout("hidedrop('"+ theID +"',"+ secs +")", 1000);
    }
}
