var moveDown	= 0;
var moveRight 	= 40;
var delayedHide = 600;
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) {
	iexpl	= 0;
	netsc6	= 1;
}
var runTime;
function startTimer() {
	runTime = setTimeout('hideAll()',delayedHide);
}
function resetTimer() {
	clearTimeout(runTime);
}
function showMenu(myDiv) {
	hideAll();
	showDiv(myDiv);
}
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) {
				if (divArray[i].name!=null) {
					myDiv = ''+divArray[i].name;
				} else if (divArray[i].NAME!=null) {
					myDiv = ''+divArray[i].NAME;
				}
			} else {
				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(myDiv).style.backgroundPosition = "0% -78px";
				document.getElementById(myDiv).firstChild.style.backgroundPosition = "100% -78px";
			} else {
				document.getElementById(myDiv).style.backgroundPosition = "0% 0px";
				document.getElementById(myDiv).firstChild.style.backgroundPosition = "100% 0px";
			}
		}
	}
}
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';
		}
	}
}
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';
		}
	}
}
function getCoor(n) {
	var coo = new Object();
	if (netsc4) {
		var anchObj;
		coo.x = window.event.target.x;
		coo.y = window.event.target.y;
	} else {
		var i,x;
		if(!(x=document[n])&&document.all) {
			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.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;
	}
}
