/*
var lcMenuCloser = "&#054;"
var lcMenuExpander = "&#052;"
var lcMenuCloser = "<img src='/skins/closer.jpg' />"
var lcMenuExpander = "<img src='/skins/expander.jpg' />"
*/
var lcMenuCloser = "^"
var lcMenuExpander = "+"

var hoverTimeOut = 750
var timerId = 0
var DontStartHover=0
var oFocalObj = null
var oBrowser = {ie : document.all ? true : false}

function LoadURL(sURL) {
window.status = sURL;
	if(oBrowser.ie) {
		oXMLReq = new ActiveXObject("Microsoft.XMLHTTP");
		} /* if(oBrowser.ie) */
		else {
			oXMLReq = new XMLHttpRequest();
			} /* ELSE: if(oBrowser.ie) */
			
	oXMLReq.open('GET', sURL, false);
	oXMLReq.send(null);

	return oXMLReq;
	
	} /* LoadURL(sURL) */
	
function getMenu(toThis) {
	/* cancel the hover timer, clear flags/references (user must have clicked) */
	if(timerId) {clearTimeout(timerId);	timerId = 0;}
	DontStartHover=0
	oFocalObj = null
	toThis.className = toThis.className.replace(/ MenuHover/,'')

	/* object referenct to parent element */
	var loP = toThis.parentNode
	/* if the contents of the element is only the collapsed menu item */
	if (loP.lastChild == toThis) {	
		/* remove "...Loading" */

		//toThis.innerHTML = toThis.name
		/* if there is no contentCache property already defined */
		if (loP.contentCache==(undefined) ) {
			/* retrieve submenu from server */
			var loMenuBranch = LoadURL("/scripts/menusrvr.asp?MR=" + toThis.id )
			//var ns = get_nextsibling(this);
			/* create a menu collapser */
			var lcCollapser =	"<span " +
									"class='MenuECc' " +
									"onClick='getMenu(this.nextSibling);'" +
									">" + 
									lcMenuCloser +
								"</span>"
			/* assign contentCache property with this item and retrieved contents */
			if (loMenuBranch.responseText.length > 0) {
				loP.contentCache = lcCollapser + (toThis.outerHTML) + loMenuBranch.responseText
				}
				else {
					loP.contentCache = toThis.outerHTML;
					}
			} /* (loP.childstr!=(undefined) ) */
		/* set the parent's contents to be the value of contentCache */	
		loP.innerHTML = loP.contentCache
		} /* if (loP.lastChild == toThis) */
		else {
			/* update loP.contentCache with current state */
			loP.contentCache = loP.innerHTML
			var ns = get_nextsibling(this);
			loP.innerHTML =		"<span class='MenuECe' onClick='getMenu(this.nextSibling);'>" + lcMenuExpander + "</span>" + toThis.outerHTML
			DontStartHover=1
			} /* ELSE: if (loP.lastChild == toThis) */
	} /* getMenu(toThis) */
	
function hoverStart(toThis) {
	/* set the style */
	toThis.className = toThis.className + ' MenuHover'
	/* if flag not set */
	if (DontStartHover == 0) {
		/* menu needs loading */
		if (toThis.parentNode.lastChild == toThis) {
			/* set a global reference to this object */
			oFocalObj = toThis
			/* set up the timer */
			timerId = setTimeout("getMenu(oFocalObj)", hoverTimeOut);
			} /* (toThis.parentNode.lastChild == toThis) */
		} /* if (toThis.DontStartHover!=1) */
	} /* hoverStart(toThis) */
	
function hoverStop(toThis) {
	/* cancel the hover timer */
	if(timerId) {
		clearTimeout(timerId);
		timerId  = 0;
		}
	/* clear the global flags/references */
	DontStartHover=0
	oFocalObj = null
	/* reset the style */	
	toThis.className = toThis.className.replace(/ MenuHover/,'')
	} /* hoverStop(toThis) */
	
function RootMenu(tcExpandTo) {	
	var lcURL = "/scripts/menusrvr.asp?MR=null&MF=" + tcExpandTo
	var loReq = LoadURL( lcURL )
	document.write( "<span style='position:relative; left:-10;'>" )
	document.write( loReq.responseText )
	document.write( "</span>" )
	} /* RootMenu() */
	
function MenuClick(toMenuObj) {
	var rt = window.location.toString().split("//")[1].split("/")[1].split("?")[0]
	location = "/" + rt + "?mId=" + ( (toMenuObj.mId) ? toMenuObj.mId : toMenuObj.id );
	} /* MenuClick(toMenuObj) */
	
function selectCurrentMenu(tcMenuId) {
	var loMenuPad = document.getElementById(tcMenuId)
	if (loMenuPad) {loMenuPad.className = loMenuPad.className + " MenuSel" }
	}	
	

	
	
/* helper function to allow moz to fake an outerHTML so this once-IE-only script will work in moz */
/* from http://webfx.eae.net/dhtml/ieemu/htmlmodel.html */
var _emptyTags = {"IMG":true,"BR":true,"INPUT":true,"META":true,"LINK":true,"PARAM": true,"HR":true};
try {
	HTMLElement.prototype.__defineGetter__("outerHTML", function () {
			var attrs = this.attributes;
			var str = "<" + this.tagName;
			for (var i = 0; i < attrs.length; i++) {
				str += " " + attrs[i].name + "=\"" + attrs[i].value + "\"";
				}
			if (_emptyTags[this.tagName]) {
				return str + ">";
				}
			return str + ">" + this.innerHTML + "</" + this.tagName + ">";
			}
		);
	}
catch(err) {
	/* IE doesn't understand HTMLElement, so catch the error and do nothing 
		because IE already has outerHTML this function is not needed
	*/
	}
