//---------------------------------------------------------------
//--multiLayerScript.js' -- version 1.2.2 - (2004.02.09) -- BM --
//---------------------------------------------------------------
//--use this variables to move the all layers down/right
var moveDown = 31;
var moveRight = -10;
//--delayed hide of all layers (msec), timer - onmouseOut
var delayedHide = 500;
//--------------------------------------------------------
//--layers basic functions: show/hide DIV's
//--------------------------------------------------------
var iexpl;
var netsc4;
var netsc6;
netsc4 = (document.layers) ? 1:0;
iexpl = (document.all) ? 1:0;
netsc6 = (!document.all && document.getElementById) ? 1:0;
if (navigator.userAgent.indexOf('Opera') > -1) {//--opera
	iexpl = 0;
	netsc6 = 1;
}

//--onmouseOut-timer functions: to hide all the DIV's
var runTime;
function startTimer() {
	runTime = setTimeout('hideAll()',delayedHide);
}
function resetTimer() {
	clearTimeout(runTime);
}

//--show the menu (DIV)
function showMenu(myDiv) {
	hideAll();
	showDiv(myDiv);
}

//--hide all DIV's
function hideAll() {
	var divArray = null;
	if (iexpl) {
		divArray = document.all.tags('div');
	}
	if (netsc4) {
		divArray = document.layers;
	}
	if (netsc6) {
		divArray = document.getElementsByTagName('div');
	}
	totalDivs = divArray.length;
	for ( i=0; i<totalDivs; i++ ) {
		var myDiv = '';
		if ( !netsc6) {//--IE, NS4
			if (divArray[i].name!=null) {
				myDiv = ''+divArray[i].name;
			} else if (divArray[i].NAME!=null) {
				myDiv = ''+divArray[i].NAME;
			}
		} else {//--NS6, Opera
			if (divArray[i].id!=null) {
				myDiv = ''+divArray[i].id;
			} else if (divArray[i].ID!=null) {
				myDiv = ''+divArray[i].ID;
			}
		}
		if ( myDiv.indexOf('sub') > -1 ) {
			hideDiv(myDiv);
		}
	}
}

//--hide a DIV with specific name/id = 'myDiv'
function hideDiv(myDiv) {
	var myDiv;
	if (iexpl) {
		myDiv = document.all[myDiv];
		if (myDiv) {
			myDiv.style.visibility='hidden';
		}
	}
	if (netsc4) {
		myDiv = document.layers[myDiv];
		if (myDiv) {
			myDiv.visibility='hide';
		}
	}
	if (netsc6) {
		myDiv = document.getElementById(myDiv);
		if (myDiv) {
			myDiv.style.visibility='hidden';
		}
	}
}

//--show the DIV ('subx'), and moves it's left-top position to the anchor ('a_subx')
function showDiv(myDiv) {
	var coordinates = getCoor('a_' + myDiv);
	var xPos = coordinates.x + moveRight;
	var yPos = coordinates.y + moveDown;
	if (iexpl) { 
		myDiv = document.all[myDiv];
		if (myDiv) {
			myDiv.style.left=xPos;
			myDiv.style.top=yPos;
			myDiv.style.visibility='visible';
		}
	}
	if (netsc4) {
		myDiv = document.layers[myDiv];
		if (myDiv) {
			myDiv.left=xPos;
			myDiv.top=yPos;
			myDiv.visibility='show';
		}
	}
	if (netsc6) {
		myDiv = document.getElementById(myDiv);
		if (myDiv) {
			myDiv.style.left=xPos;
			myDiv.style.top=yPos;
			myDiv.style.visibility='visible';
		}
	}
}

//--get the postion of an object via 'name' / 'id'
function getCoor(n) {
	var coo = new Object();
	if (netsc4)	{//--workaround for NS4
		var anchObj;
		coo.x = window.event.target.x;
		coo.y = window.event.target.y;
	} else {
		var i,x;
		if(!(x=document[n])&&document.all) {//--IE
			x=document.all[n];
		}
		if(!x && document.getElementById) {//--NS6
			x=document.getElementById(n);
		}
		var ol=x.offsetLeft;
		var ot=x.offsetTop;
		while ((x=x.offsetParent) != null) {
			ol += x.offsetLeft;
			ot += x.offsetTop;
		}
		coo.x = ol;
		coo.y = ot;
	}
	return coo;
}

//--NS 4.x specific
//--functions to capture the onClick AND onmouseOver-events
//--detecting the onmouseOver-events work only with <A HREF="#" onmouseOver="... ==> OK
//--not on <TD>'s: e.g.: <TD onmouseOver="... ==> NOT OK
if (netsc4) {
	if(!window.event && window.captureEvents) {
		//window.captureEvents(Event.MOUSEOVER|Event.MOUSEOUT|Event.CLICK|Event.DBLCLICK);
		window.captureEvents(Event.MOUSEOVER|Event.CLICK);
		window.onmouseover = getCursorHandler;
		window.onclick = getCursorHandler;
		window.event = new Object;
	}
}
function getCursorHandler(e) {
	window.event.target = e.target;
	if (e.type=='click') {
		hideAll();
	}
	if ( routeEvent(e) == false ) {
		return false;
	} else {
		return true;
	}
}

//---------------------------------------------------------------------------
//--author: Winsome Benelux - Benny Meyns
//--www.webengine.be - www.winsome.be
//------------------------
//--BROWSER-COMPATIBILITY:
//--PC - IE6.0: OK
//--PC - NS7.0: OK
//--PC - NS6.0: OK
//--PC - NS4.0: OK, if onmouseOver="showMenu('subx');" on <A HREF , not on <TD
//--PC - Opera 7.01: OK
//-----------------
//--MAC - IE5.1: OK
//--MAC - NS6.0: OK
//---------------------------------------------------------------------------