/*

FREESTYLE MENUS v1.0 RC (c) 2001-2009 Angus Turnbull, http://www.twinhelix.com
Altering this notice or redistributing this file is prohibited.

*/

var isDOM=document.getElementById?1:0,isIE=document.all?1:0,isNS4=navigator.appName=='Netscape'&&!isDOM?1:0,isOp=self.opera?1:0,isDyn=isDOM||isIE||isNS4;function getRef(i,p){p=!p?document:p.navigator?p.document:p;return isIE?p.all[i]:isDOM?(p.getElementById?p:p.ownerDocument).getElementById(i):isNS4?p.layers[i]:null};function getSty(i,p){var r=getRef(i,p);return r?isNS4?r:r.style:null};if(!self.LayerObj)var LayerObj=new Function('i','p','this.ref=getRef(i, p); this.sty=getSty(i, p); return this');function getLyr(i,p){return new LayerObj(i,p)};function LyrFn(n,f){LayerObj.prototype[n]=new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px"; '+'with (this) { '+f+' }')};LyrFn('x','if (!isNaN(p)) sty.left=p+px; else return parseInt(sty.left)');LyrFn('y','if (!isNaN(p)) sty.top=p+px; else return parseInt(sty.top)');if(typeof addEvent!='function'){var addEvent=function(o,t,f,l){var d='addEventListener',n='on'+t;if(o[d]&&!l)return o[d](t,f,false);if(!o._evts)o._evts={};if(!o._evts[t]){o._evts[t]={};if(o[n])addEvent(o,t,o[n],l);o[n]=new Function('e','var r = true, o = this, a = o._evts["'+t+'"], i; for (i in a) {'+'o._f = a[i]; if (o._f._i) r = o._f(e||window.event) != false && r;'+'} o._f = null; return r')}if(!f._i)f._i=addEvent._i++;o._evts[t][f._i]=f;if(t!='unload')addEvent(window,'unload',function(){removeEvent(o,t,f,l)})};addEvent._i=1;var removeEvent=function(o,t,f,l){var d='removeEventListener';if(o[d]&&!l)return o[d](t,f,false);if(o._evts&&o._evts[t]&&f._i)delete o._evts[t][f._i]}}var addReadyEvent=function(f){var a=addReadyEvent,n=null;addEvent(a,'ready',f);if(!a.r){a.r=function(){clearInterval(t);if(a.r)a.onready();a.r=null};addEvent(document,'DOMContentLoaded',a.r);addEvent(window,'load',a.r);/*@if(@_win32)n=document.createElement('document:ready');/*@end@*/var t=setInterval(function(){if(/complete|loaded/.test(document.readyState)){if(!n)a.r();else try{n.doScroll('left');n=null;a.r()}catch(e){}}},50)}};function FSMenu(a,b,c,d,e){this.myName=a;this.nested=b;this.cssProp=c;this.cssVis=d;this.cssHid=e;this.cssLitClass='highlighted';this.menus=b?{}:{root:new FSMenuNode('root',true,this)};this.menuToShow=[];this.mtsTimer=null;this.showDelay=0;this.switchDelay=125;this.hideDelay=500;this.showOnClick=0;this.hideOnClick=true;this.animInSpeed=0.2;this.animOutSpeed=0.2;this.animations=[]};FSMenu.prototype.show=function(a){with(this){menuToShow.length=arguments.length;for(var i=0;i<arguments.length;i++)menuToShow[i]=arguments[i];clearTimeout(mtsTimer);if(!nested)mtsTimer=setTimeout(myName+'.menus.root.over()',10)}};FSMenu.prototype.hide=function(a){with(this){clearTimeout(mtsTimer);if(menus[a])menus[a].out()}};FSMenu.prototype.hideAll=function(){with(this){for(var m in menus)if(menus[m].visible&&!menus[m].isRoot)menus[m].hide(true)}};function FSMenuNode(e,f,g){this.id=e;this.isRoot=f;this.obj=g;this.lyr=this.child=this.par=this.timer=this.visible=null;this.args=[];var h=this;this.over=function(b){with(h)with(g){if(isNS4&&b&&lyr.ref)lyr.ref.routeEvent(b);clearTimeout(timer);clearTimeout(mtsTimer);if(!f&&!visible)h.show();if(menuToShow.length){var a=menuToShow,m=a[0];if(!menus[m]||!menus[m].lyr.ref)menus[m]=new FSMenuNode(m,false,g);var c=menus[m];if(c==h){menuToShow.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 d=child?switchDelay:showDelay;c.timer=setTimeout('with('+myName+') { menus["'+c.id+'"].par = menus["'+h.id+'"]; menus["'+c.id+'"].show() }',d?d:1)}menuToShow.length=0}if(!nested&&par)par.over()}};this.out=function(a){with(h)with(g){if(isNS4&&a&&lyr&&lyr.ref)lyr.ref.routeEvent(a);clearTimeout(timer);if(!f&&hideDelay>=0){timer=setTimeout(myName+'.menus["'+e+'"].hide()',hideDelay);if(!nested&&par)par.out()}}};if(e!='root')with(this)with(lyr=getLyr(e))if(ref){if(isNS4)ref.captureEvents(Event.MOUSEOVER|Event.MOUSEOUT);addEvent(ref,'mouseover',this.over);addEvent(ref,'mouseout',this.out);if(g.nested){addEvent(ref,'focus',this.over,1);addEvent(ref,'click',this.over);addEvent(ref,'blur',this.out,1)}}};FSMenuNode.prototype.show=function(a){with(this)with(obj){if(!lyr||!lyr.ref)return;if(par){if(par.child&&par.child!=this)par.child.hide();par.child=this}var b=args[1],offX=args[2],offY=args[3],lX=0,lY=0,doX=''+offX!='undefined',doY=''+offY!='undefined';if(self.page&&b&&(doX||doY)){with(page.elmPos(b,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(b)lightParent(b,1);visible=1;if(obj.onshow)obj.onshow(id);lyr.ref.parentNode.style.zIndex='2';setVis(1,a)}};FSMenuNode.prototype.hide=function(a){with(this)with(obj){if(!lyr||!lyr.ref||!visible)return;if(isNS4&&self.isMouseIn&&isMouseIn(lyr.ref))return show();if(args[1])lightParent(args[1],0);if(child)child.hide();if(par&&par.child==this)par.child=null;if(lyr){visible=0;if(obj.onhide)obj.onhide(id);lyr.ref.parentNode.style.zIndex='1';setVis(0,a)}}};FSMenuNode.prototype.lightParent=function(a,b){with(this)with(obj){if(!cssLitClass||isNS4)return;if(b)a.className+=(a.className?' ':'')+cssLitClass;else a.className=a.className.replace(new RegExp('(\\s*'+cssLitClass+')+$'),'')}};FSMenuNode.prototype.setVis=function(b,c){with(this)with(obj){if(lyr.forced&&!c)return;lyr.forced=c;lyr.timer=lyr.timer||0;lyr.counter=lyr.counter||0;with(lyr){clearTimeout(timer);var d=b?animInSpeed:animOutSpeed;if(!counter)sty[cssProp]=b?cssVis:cssHid;if(isDOM&&(d<1))for(var a=0;a<animations.length;a++)animations[a](ref,counter,b);if(isDOM&&(b?counter<1:counter>0))timer=setTimeout(myName+'.menus["'+id+'"].setVis('+b+','+(c||0)+')',50);else lyr.forced=false;counter=counter+d*(b?1:-1);if(counter<0.001)counter=0;if(counter>0.999)counter=1}}};FSMenu.animSwipeDown=function(a,b,c){var d=a.firstChild.style?a.firstChild:a.firstChild.nextSibling,isOldIE=/MSIE\s(5|6|7)\./.test(navigator.userAgent);if(!d)return;if(c&&(b==0)){if(!d._fsm_marg)d._fsm_marg={'top':d.style.marginTop};a._fsm_height=a.offsetHeight}if(b==1||(b<0.01&&!c)){a.style.overflow='visible';d.style.marginTop=d._fsm_marg.top;if(isOldIE)a.style.height=''}else{var e=Math.pow(Math.sin(Math.PI*b/2),0.75);a.style.overflow='hidden';if(isOldIE)a.style.height=(a._fsm_height*e)+'px';else d.style.marginTop=(0-a._fsm_height*(1-e))+'px'}};FSMenu.animFade=function(b,c,d){if(typeof b.filters=='unknown')return;var f=b.filters,done=(d?c==1:c<0.01),a=/MSIE\s(4|5)/.test(navigator.userAgent)?'alpha':'DXImageTransform.Microsoft.Alpha';if(f){if(!done&&b.style.filter.indexOf(a)==-1)b.style.filter+=' '+(a=='alpha'?a:'progid:'+a)+'(opacity='+(c*100)+')';else if(f.length&&f[a]){if(done)f[a].enabled=false;else{f[a].opacity=(c*100);f[a].enabled=true}}}else b.style.opacity=b.style.MozOpacity=c*0.999};FSMenu.animClipDown=function(a,b,c){var d=Math.pow(Math.sin(Math.PI*b/2),0.75);a.style.clip=(b==1?((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto, auto, auto, auto)'):'rect(0, '+a.offsetWidth+'px, '+(a.offsetHeight*d)+'px, 0px)')};FSMenu.prototype.activateMenu=function(b,c){with(this){if(!isDOM||!document.documentElement)return;var d=getRef('fsmenu-fallback');if(d){d.rel='alternate stylesheet';d.disabled=true}var a,ul,li,parUL,mRoot=getRef(b),nodes;if(!FSMenu._count)FSMenu._count=1;var e=navigator.userAgent.indexOf('Safari')>-1||isOp?'safRtnVal':'returnValue';var f=mRoot.getElementsByTagName('ul');for(var i=0;i<f.length;i++){li=ul=f[i];while(li){if(li.nodeName.toLowerCase()=='li')break;li=li.parentNode}if(!li)continue;parUL=li;while(parUL){if(parUL.nodeName.toLowerCase()=='ul')break;parUL=parUL.parentNode}a=li.getElementsByTagName('a');if(!a)continue;a=a.item(0);var g;if(ul.id)g=ul.id;else{g=myName+'-id-'+FSMenu._count++;ul.setAttribute('id',g)}if(menus[g]&&menus[g].lyr.ref==ul)continue;menus[g]=new FSMenuNode(g,false,this);var h=(li.parentNode==mRoot)?1:0;var j=new Function('with ('+myName+') { '+'var m = menus["'+g+'"], pM = menus["'+parUL.id+'"];'+'if (!showOnClick || (showOnClick == 1 && !'+h+') || '+'((showOnClick <= 2) && ((pM && pM.child) || (m && m.visible))))'+'show("'+g+'", this) }');var k=new Function('e','if (e.'+e+' != false) '+myName+'.hide("'+g+'")');addEvent(a,'mouseover',j);addEvent(a,'mouseout',k);addEvent(a,'focus',j);addEvent(a,'blur',k);addEvent(a,'click',new Function('e','var s = '+myName+'.showOnClick, '+'m = '+myName+'.menus["'+g+'"]; '+'if (!((s == 1 && '+h+') || s >= 2)) return; '+myName+'[m && m.visible ? "hide" : "show"]("'+g+'", this); '+'if (e.cancelable && e.preventDefault) e.preventDefault(); '+'e.'+e+' = false; return false'));if(c)a.insertBefore(c.cloneNode(true),a.firstChild)}var l=mRoot.getElementsByTagName('a');for(var i=0;i<l.length;i++){addEvent(l[i],'focus',new Function('e','var node = this.parentNode; while(node) { '+'if (node.onfocus) node.onfocus(e); node = node.parentNode }'));addEvent(l[i],'blur',new Function('e','var node = this.parentNode; while(node) { '+'if (node.onblur) node.onblur(e); node = node.parentNode }'))}if(hideOnClick)addEvent(mRoot,'click',new Function('e','if (e.'+e+' != false) '+myName+'.hideAll()'));menus[b]=new FSMenuNode(b,true,this)}};var page={win:self,minW:0,minH:0,MS:isIE&&!isOp,db:document.compatMode&&document.compatMode.indexOf('CSS')>-1?'documentElement':'body'};page.elmPos=function(e,p){var x=0,y=0,w=p?p:this.win;e=e?(e.substr?(isNS4?w.document.anchors[e]:getRef(e,w)):e):p;if(isNS4){if(e&&(e!=p)){x=e.x;y=e.y};if(p){x+=p.pageX;y+=p.pageY}}if(e&&this.MS&&navigator.platform.indexOf('Mac')>-1&&e.tagName=='A'){e.onfocus=new Function('with(event){self.tmpX=clientX-offsetX;'+'self.tmpY=clientY-offsetY}');e.focus();x=tmpX;y=tmpY;e.blur()}else while(e){x+=e.offsetLeft;y+=e.offsetTop;e=e.offsetParent}return{x:x,y:y}};if(isNS4){var fsmMouseX,fsmMouseY,fsmOR=self.onresize,nsWinW=innerWidth,nsWinH=innerHeight;document.fsmMM=document.onmousemove;self.onresize=function(){if(fsmOR)fsmOR();if(nsWinW!=innerWidth||nsWinH!=innerHeight)location.reload()};document.captureEvents(Event.MOUSEMOVE);document.onmousemove=function(e){fsmMouseX=e.pageX;fsmMouseY=e.pageY;return document.fsmMM?document.fsmMM(e):document.routeEvent(e)};function isMouseIn(a){with(a)return((fsmMouseX>left)&&(fsmMouseX<left+clip.width)&&(fsmMouseY>top)&&(fsmMouseY<top+clip.height))}}FSMenu.prototype.activePageHighlight=function(a){if(typeof a=='string')a=document.getElementById(a);if(!a)return;var b=a.getElementsByTagName('a'),chosen=null;for(var i=0;i<b.length;i++){if(location.href==b[i].href){chosen=b[i];break}if((b.item(i).href.indexOf(location.pathname)>-1)&&(!chosen||b[i].href.length>chosen.href.length)){chosen=b[i]}}while(chosen&&chosen.className.indexOf('menulist')==-1){if(chosen.nodeName.toLowerCase()=='li'){chosen.getElementsByTagName('a').item(0).className+=' current-page'}chosen=chosen.parentNode}};addEvent(window,'load',new Function('listMenu.activePageHighlight("listMenuRoot")'));var listMenu=new FSMenu('listMenu',true,'display','block','none');listMenu.animations[listMenu.animations.length]=FSMenu.animFade;listMenu.animations[listMenu.animations.length]=FSMenu.animSwipeDown;var listMenu=new FSMenu('listMenu',true,'display','block','none');listMenu.animations[listMenu.animations.length]=FSMenu.animFade;listMenu.animations[listMenu.animations.length]=FSMenu.animSwipeDown;
