/*********************************************************
File name:	TopNavigation.js 
Purpose:	Show / hide of 2nd level layers in the TopNavigation 
Created:	2004-06-28
Created by: Jes Jørgensen (JsJr) / Mads Blume Dam (MdBD)

Revisions:
Version	Date		Author	Nr/Description
1		2004-06-28	Mdbd	1/NEW

Notes: Delay on hide layer can be defined in startShortTimer()

***********************************************************/

var hideTimerID
var showTimerID
var activelayer=''
function show(id) {

	//alert(document.getElementById(id).style.display);
	
	if (activelayer!='' && activelayer!=id) {
		hide(activelayer);
	}
	
	// Cancel hide action
	clearTimeout(hideTimerID);
	clearTimeout(showTimerID);
	
	// wait for 0.3 sec
	// if mouse is still over the menu point, show the menu
	if (document.getElementById(id).style.display != "block") {
		showTimerID = setTimeout('show2(\''+id+'\');', 300);
	}
}

function show2(id) {
	if (activelayer!=id && activelayer!='')
		hide(activelayer);
	if (document.getElementById(id) != null)
		document.getElementById(id).style.display="block";
	activelayer=id;
}

function hide(id) {
	if (document.getElementById(id) != null)
		document.getElementById(id).style.display="none";
	activelayer='';
}
function startShortTimer(){
	clearTimeout(showTimerID);
	hideTimerID=setTimeout('hide(activelayer)',600);
}