<!--
//**************************************************************
//Alexander Bennion 2000
// EDITED BY TRASH80 ... OR DISTROYED THAT IS ;p
//**************************************************************



var rX, rY;			// Root location
var aMenu = new Array();	// Active menu
var aItem = new Array();	// Active item
var w = window;			// Window object
var d = w.document;		// Document object
var tId = null;			// Timeout id

function hideAllMenus () {
	if (is_ie5up || is_nav6) {
		tId = w.setTimeout("hideMenus(0)", 100);
	}	
}

function showRootMenu (e, id, i, l) {
	if (is_ie5up || is_nav6) {
		e = e || w.Event || w.event;
		rX = e.clientX - e.offsetX - 2 || e.pageX - 20;
//		rY = e.clientY - e.offsetY + 9 || 80;
		rY = 217;	
//		if (is_nav6) { rY = rY + 26; }
		if (is_mac && is_ie5up) { rY = rY + 2; rX = rX + 2; }
		w.clearTimeout(tId);  
		//tId = w.setTimeout("showMenu(\"" + id + "\", " + i + ", " + l + ")", 300); 
		showMenu(id, i, l);
	}
	
	
}

function setLocation (link) {
	
	d.location = link;

}

if (is_ie5up && d.all) {
	d.onmouseup = function (e) { hideMenus(0);}
	w.hideMenus = function (l) {
		while (aMenu.length > l) {
			aMenu[aMenu.length - 1].style.visibility = "hidden";
			aMenu.length--;
		}
		if(l == 0 ) displayState();
	}	
	w.displayState = function(lay){
		if(d.all.state)
 			d.all.state.style.visibility="inherit";
	}

	w.showMenu = function (id, i, l) {
		hideMenus(l - 1);
		var el = d.all[id];
		if (l > 1) { 
			var a = aMenu[aMenu.length - 1];
			if (rX + parseInt(a.style.pixelLeft) < parseInt(d.body.clientWidth)+200 || rX < 185) {
				el.style.pixelLeft = parseInt(a.style.pixelLeft) + 125; 
			}
			else { el.style.pixelLeft = parseInt(a.style.pixelLeft) - 139;}
			el.style.pixelTop = parseInt(a.style.pixelTop) + (i * 20)+2; 
		}
		else {
			el.style.pixelLeft = rX; 
			el.style.pixelTop = rY; 
		}
		displayState(el);
		el.style.visibility = "visible";
		aMenu[aMenu.length] = el;
	}
		
	w.loadMenus = function () {
		for (i = 0; i < d.all.tags("DIV").length; i++) {
			var el = d.all.tags("DIV")[i];
			if (el.id.substr(0, 1) == "m") {
				el.style.position = "relative";
				el.style.backgroundColor = bgColor;
				el.onmouseout = function () { 
					this.style.backgroundColor = bgColor;
					tId = w.setTimeout("hideMenus(0)", 200); 
				}
				el.onmouseover = function () {
					w.clearTimeout(tId);  
					var level = parseInt(this.id.substr(7, 1));
					this.style.backgroundColor = fgColor;
					if (this.id.substr(8, 1) == "1") {
						showMenu(this.id.substr(10, 40), 
							parseInt(this.id.substr(4, 3), 10), level); 
							displayState(this.parentNode);
					}
					else { hideMenus(level - 1); }
				}
				el.onmouseup = function () { 
					if (this.id.substr(9, 1) == "1") {
						setLocation(this.id.substr(10, this.id.length));
					}
					else { w.event.cancelBubble = true; }
				}
			}
		}
	}				
}
else if (is_nav6) {

	d.onmouseup = function (e) { hideMenus(0); }
		
	w.hideMenus = function (l) {
		while (aMenu.length > l) {
			aMenu[aMenu.length - 1].style.visibility = "hidden";
			aMenu.length--; 
		}
		if(l == 0 ) displayState();
	}
	w.displayState = function(lay){
		findIt = d.getElementById("IMAGE2");

		if(findIt) findIt.style.visibility="inherit";

	}

	w.showMenu = function (id, i, l) {
		hideMenus(l - 1);

		var el = d.getElementById(id);
		if (l > 1) { 
			var a = aMenu[aMenu.length - 1];
			if (rX + parseInt(a.style.left) + 130 < parseInt(w.innerWidth)+200 || rX < 155) {	
				el.style.left = parseInt(a.style.left) + 125; 
			}
			else { el.style.left = parseInt(a.style.left) - 138; }
			el.style.top = parseInt(a.style.top) + (i * 20); 
		}
		else { el.style.left = rX; el.style.top = rY-6; }
		displayState(el);
		el.style.visibility = "visible";
		aMenu[aMenu.length] = el;
	}
		
	w.loadMenus = function () {
		var els = d.getElementsByTagName("DIV");
		for (i = 0; i < els.length; i++) {
			var el = els[i];
			if (el.id.substr(0, 1) == "m") {
				el.style.background = bgColor;
				el.style.position = "relative";
				el.onmouseout = function () { 
					this.style.backgroundColor = bgColor;
					tId = w.setTimeout("hideMenus(0)", 200); 
				}
				el.onmouseover = function () { 
					w.clearTimeout(tId);  
					var level = parseInt(this.id.substr(7, 1)); 
					while (level - 1 <= aItem.length) {
						aItem[aItem.length - 1].style.background = bgColor;
						aItem.length--;
					}
					aItem[aItem.length] = this;
					this.style.background = fgColor;
					if (this.id.substr(8, 1) == "1") { 
						showMenu(this.id.substr(10, 40), 
							parseInt(this.id.substr(4, 3), 10), level); 
							displayState(this.parentNode);
					}
					else { hideMenus(level - 1); }
				}
				el.onmouseup = function (e) { 
					if (this.id.substr(9, 1) == "1") {
						setLocation(this.id.substr(10, this.id.length));
					}
				}
			}
		}
	}	
}

//-->

