var moveDown = 40;
var moveRight = -4;
//--delayed hide of all layers (msec), timer - onmouseOut
var delayedHide = 100;
//--------------------------------------------------------
//--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('layer') > -1 ) {
				hideDiv(myDiv);
			}
		}
		divArray = document.getElementsByTagName('a');
		totalDivs = divArray.length;
		for ( i=0; i<totalDivs; i++ ) {
			var myDiv = '';
			if (divArray[i].id!=null) {
				myDiv = ''+divArray[i].id;
			}
			if ( myDiv.indexOf('a_layer') > -1 ) {
				if (document.getElementById(myDiv).className == "selected") {
					document.getElementById('a_' + myDiv).style.backgroundColor = '';
					document.getElementById('a_' + myDiv).style.border = '0px';
				} else {
					document.getElementById('a_' + myDiv).style.backgroundColor = '';
					document.getElementById('a_' + myDiv).style.border = '0px';
				}
			}
		}
	}
//--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);
			//alert(myDiv.style.visibility);
			if (myDiv) {
				myDiv.style.visibility='hidden';
			}
		}
	}
//--show the DIV ('layerx'), and moves it's left-top position to the anchor ('a_layerx')
	function showDiv(myDiv) {
		var coordinates = getCoor('a_' + myDiv);
		var xPos = coordinates.x + moveRight;
		var yPos = coordinates.y + moveDown;
		if (netsc6 || netsc4) {
			myDiv = document.getElementById(myDiv);
			if (myDiv) {
				myDiv.style.left=xPos.toString()+'px';
				myDiv.style.top=yPos.toString()+'px';
				myDiv.style.visibility='visible';
			}
		}
		if (iexpl) {
			myDiv = document.getElementById(myDiv);
			if (myDiv) {
				myDiv.style.left=xPos.toString()+'px';	
				myDiv.style.top=yPos.toString()+'px';
				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;
	}
if (netsc4) {
	if(!window.event && window.captureEvents) {
		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;
	}
}