// All code contained herein written by Chris Marks
// Works in Mozilla, Netscape 6+, IE 4+, Opera 5+
// Opera 5&6 - other elements not pushed out of the way when opening a panel
var agt = navigator.userAgent.toLowerCase();var aver = navigator.appVersion;var is_major = parseInt(aver);var dom = document.getElementById ? 1 : 0;var lay = document.layers ? 1 : 0;var dall = document.all ? 1 : 0;var is_opera = window.opera ? 1 : 0;var is_hotjava = agt.indexOf('hotjava') != -1 ? 1 : 0;var is_ie4 = (dall && !dom && !is_opera) ? 1 : 0;var is_ie5 = (dall && dom && !is_opera) ? 1 : 0;var is_ie6 = (dall && document.createComment && document.fireEvent && !is_opera) ? 1 : 0;var is_ie = (is_ie4 || is_ie5 || is_ie6) ? 1 : 0;var is_ien = (is_ie && !is_ie4) ? 1 : 0;var is_n4=(lay && !dom && !is_hotjava) ? 1 : 0;var is_opera7 = (is_opera && document.createComment) ? 1 : 0;var is_operao = (is_opera && !is_opera7) ? 1 : 0;var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1) ? 1 : 0;var dx = 20;var ran = 16;var yc = 120;var narrow = 120;var xbc = -1;var shorts = new Array;var bluea = 0;var deepness = 0;var spotted = narrow + 2;var blanked = yc + 2;var below = -1;var bah = new Array;var buh = new Array;
function makeMenu() {
	if ((!is_opera && !is_ie && !dom && !dall) || is_n4) window.alert("Because your browser sucks, you cannot use our menu.  Please upgrade to a browser that's less than 6 years old");
	var newday = "-1";
	if (is_ie) {spotted += 2;narrow += 2;yc += 2;blanked += 2;dx += 2;}
	deepness = blanked;
	document.write("<div id='overmenu' style='position: relative; padding: 0px; left: 3px;"+(is_operao?("pixelWidth: "+spotted+"px; pixelHeight: "+dx+"px;"):("width: "+spotted+"px; height: "+(is_ie?dx:(dx+2))+"px;"))+"'>");
	for (var i = 0; i < links.length; i++) {
		parts = links[i].split("|");
		if (parts[0] == "0" || parts[0] == "3") {
			if (newday == "1") document.write("</div></div>");
			else if (newday == "0" || newday == "3") document.write("</div>");
			if (below>=0) bluea -= 1;
			if (is_ie6 && below>=1) {
				var obj = getme("down"+below);
				obj.style.clip = "rect(0px,"+spotted+"px,0px,0px)";
			}
			below++;
			shorts[below] = 0;
			buh[below]=bah[below]=0;
			document.write("<div id='menu"+below+"' style='position: absolute; top: "+bluea+"px; width:"+yc+"px;'>");
			if (parts[0] == "0") {
				document.write("<div id='up"+below+"' class='heading' onmouseover='untap(this.id)' onmouseout='redown(this.id)' onclick='dropme("+below+")' style='height:"+dx+"px; width:"+yc+"px; background-color: gold; color: black; border: 1px solid darkblue; position:absolute");
				if (is_operao) document.write("; left: 0px");
				bluea+=is_ie?dx:(dx+2);
				if (!is_operao) document.write("; cursor: default");
				document.write(";'>"+parts[1]+"</div>");
			}
			else if (parts[0] == "3") {
				document.write("<a id='up"+below+"' class='headlink' href='"+parts[2]+"' target='"+parts[3]+"' style='display: block; height:"+dx+"px; width:"+yc+"px; border: 1px solid darkblue; position:absolute;");
				if (is_operao) document.write("left: 0px; background-color: gold;");
				bluea+=is_ie?dx:(dx+2);
				if (!is_operao) document.write("cursor:"+(is_ie5?"hand":"pointer")+";");
				document.write(";'>"+parts[1]+"</a>");
			}
		}
		else if (parts[0] == "1") {
			if (newday == "0" || newday == "3") {
				document.write("<div id='down"+below+"' class='panel' style='"+(is_ie4?"pixelTop:":"top:")+(dx+(is_ie?0:2))+"px;");
				document.write(is_operao?" visibility: hidden;":" clip:rect(0px, "+spotted+"px, 0px, 0px);");
				document.write(" left:"+((blanked - spotted) / 2)+"px; width:"+narrow+"px; position:absolute;'>");
			}
			document.write("<a class='item' id='item"+i+"' href='"+parts[2]+"'  style='display: block; height:"+ran+"px; width:"+narrow+"px;");
			if (!is_operao) document.write("cursor:"+(is_ie5?"hand":"pointer")+";");
			if (i==links.length-1) {
				document.write("; border-bottom: 1px solid darkblue");
				shorts[below] += 2;
			}
			document.write("; border-left: 1px solid darkblue; border-right: 1px solid darkblue;' target='"+parts[3]+"'>&nbsp;&nbsp;"+parts[1]+"</a>");
			shorts[below] += ran;
		}
	newday = parts[0];
	}
	if (newday == "1") document.write("</div>");
	document.write("</div></div>");
	var om = getme("overmenu");
	is_operao?om.style.pixelHeight = bluea:om.style.height = bluea+"px";
	is_operao?om.style.pixelWidth = deepness:om.style.width = deepness+"px";
	if (is_ie6 && getme("down"+below)) {
		om = getme("down"+below);
		om.style.clip = "rect(0px,"+spotted+"px,0px,0px)";
	}
}
function untap(obj) {
var p = parseInt(obj.substring(2, obj.length));
bah[p]=1;
getme(obj).style.backgroundColor = "gold";
getme(obj).style.color = "blue";
}
function redown(obj) {
var p = parseInt(obj.substring(2, obj.length));
bah[p]=0;
getme(obj).style.backgroundColor = "gold";
getme(obj).style.color = "black";
}
function dropme(num) {if (xbc != -1) {buh[xbc] = 1;setTimeout("curl("+xbc+","+(shorts[xbc]-((xbc != below)?0:1))+")", 0);}if (num == xbc || shorts[num] == 0) xbc = -1;else {buh[num] = 2;xbc = num;setTimeout("spread("+num+", "+(shorts[num]-((num != below)?0:1))+",0)", 0);}}function spread(num, to, now) {var name="down"+num;var obj = getme(name);if (now + 2 <= to && buh[num]==2) {now += 2;if (!is_operao) obj.style.clip = "rect(0px,"+spotted+"px,"+now+"px,0px)";for (var j = num+1; j<shorts.length; j++) {name="menu"+j;obj = getme(name);is_ie4?obj.style.pixelTop=parseInt(obj.style.pixelTop)+2+"px":obj.style.top=parseInt(obj.style.top)+2+(is_operao?"":"px");}obj = getme("overmenu");if (!is_operao) obj.style.height = parseInt(obj.style.height)+2+"px";setTimeout("spread("+num+","+to+","+now+")", 0);} else {is_operao? obj.style.visibility = "visible":(obj.style.clip = "rect(0px,"+spotted+"px,"+to+"px,0px)");var shift=to-now;for (var j = num+1; j<shorts.length; j++) {name="menu"+j;obj = getme(name);is_ie4?obj.style.pixelTop=parseInt(obj.style.pixelTop)+shift+"px":obj.style.top=parseInt(obj.style.top)+shift+(is_operao?"":"px");}obj = getme("overmenu");is_operao?obj.style.pixelHeight=obj.style.pixelHeight+to:obj.style.height = parseInt(obj.style.height)+shift+"px";}}function curl(num, now) {var name="down"+num;var obj = getme(name);if (now - 3 > 0 && buh[num]==1) {now -= 3;is_operao?obj.style.visibility = "hidden":obj.style.clip = "rect(0px,"+spotted+"px,"+now+"px,0px)";for (var j = num+1; j<shorts.length; j++) {name="menu"+j;obj = getme(name);is_ie4?obj.style.pixelTop=(parseInt(obj.style.pixelTop)-3)+"px":obj.	style.top=(parseInt(obj.style.top)-3)+(is_operao?"":"px");}obj = getme("overmenu");is_operao?obj.style.pixelHeight=obj.style.pixelHeight-3:obj.style.height = parseInt(obj.style.height)-3+"px";setTimeout("curl("+num+","+now+")", 0);} else {if (!is_operao) obj.style.clip = "rect(0px,"+spotted+"px,0px,0px)";for (var j = num+1; j<shorts.length; j++) {name="menu"+j;obj = getme(name);is_ie4?obj.style.pixelTop=(parseInt(obj.style.pixelTop)-now)+"px":obj.style.top=(parseInt(obj.style.top)-now)+(is_operao?"":"px");}obj = getme("overmenu");is_operao?obj.style.pixelHeight=obj.style.pixelHeight-now:obj.style.height = parseInt(obj.style.height)-now+"px";}}function getme(name) {return document.getElementById?document.getElementById(name):document.all[name];}
