/****************************************************************************************
/	Active Sub Menus v1.0 (c) 2004 Intuitive Solution, http://www.intuitivesolution.net	/
/	Altering this notice or redistributing this file is prohibited.						/
/***************************************************************************************/

/***** Common and Cross-Browser Stuff *****/
var brDOM=document.getElementById?1:0, brIE=document.all?1:0, brNS4=navigator.appName=='Netscape'&&!brDOM?1:0, brOp=self.opera?1:0, brDyn=brDOM||brIE||brNS4; function GetRef(i, p){ p=!p?document:p.navigator?p.document:p; return brIE ? p.all[i] : brDOM ? (p.getElementById?p:p.ownerDocument).getElementById(i) : brNS4 ? p.layers[i] : null;}; function GetBrowserType(i, p){ var r=GetRef(i, p); return r?brNS4?r:r.style:null;}; if (!self.LayerObj) var LayerObj = new Function('i', 'p', 'this.ref=GetRef(i, p); this.sty=GetBrowserType(i, p); return this'); function GetLayer(i, p) { return new LayerObj(i, p) }; function LayerFunc(n, f){ LayerObj.prototype[n] = new Function('var a=arguments,p=a[0],px=brNS4||brOp?0:"px"; ' + 'with (this) { '+f+' }');}; LayerFunc('x','if (!isNaN(p)) sty.left=p+px; else return parseInt(sty.left)'); LayerFunc('y','if (!isNaN(p)) sty.top=p+px; else return parseInt(sty.top)'); function AddEvent(o, n, f){ var a='AddEventListener', h='on'+n; if (o[a]) return o[a](n, f, false); if (o[h]) { o._c |= 0; var b = '_b' + (++o._c); o[b] = o[h]; } o[h] = function(e) { e=e||self.event; var r = true; if (o[b]) r = o[b](e) != false && r; o._f=f; r = o._f(e) != false && r; return r; }};

/***** Menu Object, Properties and Methods *****/
function ASMenu(menuName, nested, cssPrp, cssVis, cssHid){ this.menuName = menuName; this.nested = nested; this.cssPrp = cssPrp; this.cssVis = cssVis; this.cssHid = cssHid; this.cssLitClass = ''; this.menus = { root: new ASMenuNode('root', this) }; this.mnuToShow = []; this.mnuTimer = null; this.showDelay = 0; this.switchDelay = 125; this.hideDelay = 500;}; ASMenu.prototype.show = function(mN) { with (this){ mnuToShow.length = arguments.length; for (var i = 0; i < arguments.length; i++) mnuToShow[i] = arguments[i]; clearTimeout(mnuTimer); mnuTimer = setTimeout(menuName + '.menus.root.over()', 10);}}; ASMenu.prototype.hide = function(mN) { with (this){ clearTimeout(mnuTimer ); if (menus[mN]) menus[mN].out();}}; function ASMenuNode(id, obj){ this.id = id; this.obj = obj; this.lyr = this.child = this.par = this.timer = this.visible = null; this.args = []; var node = this; this.over = function(evt) { with (node) with (obj) { if (brNS4 && evt && lyr.ref) lyr.ref.routeEvent(evt); clearTimeout(timer);  clearTimeout(mnuTimer ); if (mnuToShow.length) { var a = mnuToShow, m = a[0]; if (!menus[m] || !menus[m].lyr.ref) menus[m] = new ASMenuNode(m, obj); var c = menus[m]; if (c == node) { mnuToShow.length = 0; return } clearTimeout(c.timer); if (c != child && c.lyr.ref) { c.args.length = a.length; for (var i = 0; i < a.length; i++) c.args[i] = a[i]; var delay = child ? switchDelay : showDelay; c.timer = setTimeout('with(' + menuName + ') { menus["' + c.id + '"].par = menus["' + node.id + '"]; menus["' + c.id + '"].show() }', delay ? delay : 1); } mnuToShow.length = 0; } if (!nested && par) par.over(); }}; this.out = function(evt) { with (node) with (obj) { if (brNS4 && evt && lyr && lyr.ref) lyr.ref.routeEvent(evt); clearTimeout(timer); timer = setTimeout(menuName + '.menus["' + id + '"].hide()', hideDelay); if (!nested && par) par.out(); }}; if (id != 'root') with (this) with (lyr = GetLayer(id)) if (ref) { if (brNS4) ref.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT); AddEvent(ref, 'mouseover', this.over); AddEvent(ref, 'mouseout', this.out); }}; ASMenuNode.prototype.show = function() { with (this) with (obj){ if (!lyr || !lyr.ref) return; if (par.child && par.child != this) par.child.hide(); par.child = this; var offR = args[1], offX = args[2], offY = args[3], lX = 0, lY = 0, doX = ''+offX!='undefined', doY = ''+offY!='undefined'; if (self.page && offR && (doX||doY)) { with (page.elmPos(offR, par.lyr ? par.lyr.ref : 0)) lX = x, lY = y; if (doX) lyr.x(lX + eval(offX)); if (doY) lyr.y(lY + eval(offY)); } if (offR) lightParent(offR, 1); visible = 1; if (obj.onshow) obj.onshow(id); setVis(1);}}; ASMenuNode.prototype.hide = function() { with (this) with (obj){ if (!lyr || !lyr.ref) return; if (brNS4 && self.isMouseIn && isMouseIn(lyr.ref)) return show(); if (args[1]) lightParent(args[1], 0); if (lyr) { visible = 0; if (obj.onhide) obj.onhide(id); setVis(0); } if (child) child.hide(); if (par && par.child == this) par.child = null; par = null;}}; ASMenuNode.prototype.lightParent = function(elm, lit) { with (this) with (obj){ if (!cssLitClass || brNS4) return; if (lit) elm.className += (elm.className?' ':'') + cssLitClass; else elm.className = elm.className.replace(new RegExp('\\s*' + cssLitClass + '$'), '');}}; ASMenuNode.prototype.setVis = function(sh) { with (this) with (obj){ lyr.sty[cssPrp] = sh ? cssVis : cssHid;}};

/***** List Menu Activation *****/
ASMenu.prototype.activateMenu = function(id, subIText) { with (this){ if (!brDOM) return; var a, ul, li, mRoot = GetRef(id), nodes, count = 1; var lists = mRoot.getElementsByTagName('ul'); for (var i = 0; i < lists.length; i++) { li = ul = lists[i]; while(li) { if (li.nodeName.toLowerCase() == 'li') break; li = li.parentNode; } if (!li) continue; a = null; for (var j = 0; j < li.childNodes.length; j++) { if (li.childNodes[j].nodeName.toLowerCase() == 'a') a = li.childNodes[j];/* wtf */} if (!a) continue; var menuID = menuName + '-id-' + count++; if (ul.id) menuID = ul.id; else ul.setAttribute('id', menuID); AddEvent(a, 'mouseover', new Function('e', menuName + '.show("' + menuID + '", this)')); AddEvent(a, 'mouseout', new Function('e', menuName + '.hide("' + menuID + '")')); if (subIText){ var subI = document.createElement ? document.createElement('span') : 0; if (subI){ subI.innerHTML = subIText; subI.className = 'subind'; a.insertBefore(subI, a.firstChild); }} ul.style.display = 'none'; }}};