var ddlevelsmenu={enableshim:!0,arrowpointers:{downarrow:["",0,0],rightarrow:["",1,1],showarrow:{toplevel:!1,sublevel:!1}},hideinterval:200,effects:{enableswipe:!0,enablefade:!0,duration:500},httpsiframesrc:"blank.htm",topmenuids:[],topitems:{},subuls:{},lastactivesubul:{},topitemsindex:-1,ulindex:-1,hidetimers:{},shimadded:!1,nonFF:!/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent),getoffset:function(b,a){return b.offsetParent?b[a]+this.getoffset(b.offsetParent,a):b[a]},getoffsetof:function(b){b._offsets=
{left:this.getoffset(b,"offsetLeft"),top:this.getoffset(b,"offsetTop")}},getwindowsize:function(){this.docwidth=window.innerWidth?window.innerWidth-10:this.standardbody.clientWidth-10;this.docheight=window.innerHeight?window.innerHeight-15:this.standardbody.clientHeight-18},gettopitemsdimensions:function(){for(var b=0;b<this.topmenuids.length;b++)for(var a=this.topmenuids[b],c=0;c<this.topitems[a].length;c++){var e=this.topitems[a][c],d=document.getElementById(e.getAttribute("rel"));e._dimensions=
{w:e.offsetWidth,h:e.offsetHeight,submenuw:d.offsetWidth,submenuh:d.offsetHeight}}},isContained:function(b,a){for(var a=window.event||a,c=a.relatedTarget||("mouseover"==a.type?a.fromElement:a.toElement);c&&c!=b;)try{c=c.parentNode}catch(e){c=b}return c==b?!0:!1},addpointer:function(b,a,c,e){var d=document.createElement("img");d.src=c[0];d.style.width=c[1]+"px";d.style.height=c[2]+"px";if("rightarrowpointer"==a)d.style.left=b.offsetWidth-c[2]-2+"px";d.className=a;(a=b.childNodes[1!=b.firstChild.nodeType?
1:0])&&"SPAN"==a.tagName&&(b=a);"before"==e?b.insertBefore(d,b.firstChild):b.appendChild(d)},css:function(b,a,c){var e=RegExp("(^|\\s+)"+a+"($|\\s+)","ig");if("check"==c)return e.test(b.className);"remove"==c?b.className=b.className.replace(e,""):"add"==c&&!e.test(b.className)&&(b.className+=" "+a)},addshimmy:function(b){var a=!window.opera?document.createElement("iframe"):document.createElement("div");a.className="ddiframeshim";a.setAttribute("src","https:"==location.protocol?this.httpsiframesrc:
"about:blank");a.setAttribute("frameborder","0");b.appendChild(a);try{a.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"}catch(c){}return a},positionshim:function(b,a,c,e,d){if(b._istoplevel){d=window.pageYOffset?window.pageYOffset:this.standardbody.scrollTop;a=b._offsets.top-d;c=d+this.docheight-b._offsets.top-b._dimensions.h;if(0<a)this.shimmy.topshim.style.left=e+"px",this.shimmy.topshim.style.top=d+"px",this.shimmy.topshim.style.width="99%",this.shimmy.topshim.style.height=
a+"px";if(0<c)this.shimmy.bottomshim.style.left=e+"px",this.shimmy.bottomshim.style.top=b._offsets.top+b._dimensions.h+"px",this.shimmy.bottomshim.style.width="99%",this.shimmy.bottomshim.style.height=c+"px"}},hideshim:function(){this.shimmy.topshim.style.width=this.shimmy.bottomshim.style.width=0;this.shimmy.topshim.style.height=this.shimmy.bottomshim.style.height=0},buildmenu:function(b,a,c,e,d,f){a._master=b;a._pos=e;(a._istoplevel=d)&&this.addEvent(a,function(){ddlevelsmenu.hidemenu(ddlevelsmenu.subuls[this._master][parseInt(this._pos)])},
"click");this.subuls[b][e]=c;a._dimensions={w:a.offsetWidth,h:a.offsetHeight,submenuw:c.offsetWidth,submenuh:c.offsetHeight};this.getoffsetof(a);c.style.left=0;c.style.top=0;c.style.visibility="hidden";this.addEvent(a,function(b){if(!ddlevelsmenu.isContained(this,b)){b=ddlevelsmenu.subuls[this._master][parseInt(this._pos)];this._istoplevel&&(ddlevelsmenu.css(this,"selected","add"),clearTimeout(ddlevelsmenu.hidetimers[this._master][this._pos]));ddlevelsmenu.getoffsetof(a);var c=window.pageXOffset?
window.pageXOffset:ddlevelsmenu.standardbody.scrollLeft,d=window.pageYOffset?window.pageYOffset:ddlevelsmenu.standardbody.scrollTop,e=this._offsets.top+this._dimensions.submenuh,g=this._istoplevel?this._offsets.left+("sidebar"==f?this._dimensions.w:0):this._dimensions.w;this._offsets.left+this._dimensions.submenuw+(this._istoplevel&&"topbar"==f?0:this._dimensions.w)-c>ddlevelsmenu.docwidth&&(g+=-this._dimensions.submenuw+(this._istoplevel&&"topbar"==f?this._dimensions.w:-this._dimensions.w));b.style.left=
g+"px";g=this._istoplevel?this._offsets.top+("sidebar"==f?0:this._dimensions.h):this.offsetTop;e-d>ddlevelsmenu.docheight&&(g=this._dimensions.submenuh<this._offsets.top+("sidebar"==f?this._dimensions.h:0)-d?g+(-this._dimensions.submenuh+(this._istoplevel&&"topbar"==f?-this._dimensions.h:this._dimensions.h)):g+(-(this._offsets.top-d)+(this._istoplevel&&"topbar"==f?-this._dimensions.h:0)));b.style.top=g+"px";ddlevelsmenu.enableshim&&(!1==ddlevelsmenu.effects.enableswipe||ddlevelsmenu.nonFF)?ddlevelsmenu.positionshim(a,
b,f,c,d):b.FFscrollInfo={x:c,y:d};ddlevelsmenu.showmenu(a,b,f)}},"mouseover");this.addEvent(a,function(a){var b=ddlevelsmenu.subuls[this._master][parseInt(this._pos)];this._istoplevel?!ddlevelsmenu.isContained(this,a)&&!ddlevelsmenu.isContained(b,a)&&ddlevelsmenu.hidemenu(b):!this._istoplevel&&!ddlevelsmenu.isContained(this,a)&&ddlevelsmenu.hidemenu(b)},"mouseout")},setopacity:function(b,a){b.style.opacity=a;if("string"!=typeof b.style.opacity&&(b.style.MozOpacity=a,b.filters))b.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+
100*a+")"},showmenu:function(b,a,c){if(this.effects.enableswipe||this.effects.enablefade){if(this.effects.enableswipe){var e=b._istoplevel&&"topbar"==c?b._dimensions.submenuh:b._dimensions.submenuw;a.style.width=a.style.height=0;a.style.overflow="hidden"}this.effects.enablefade&&this.setopacity(a,0);a._curanimatedegree=0;a.style.visibility="visible";clearInterval(a._animatetimer);a._starttime=(new Date).getTime();a._animatetimer=setInterval(function(){ddlevelsmenu.revealmenu(b,a,e,c)},10)}else a.style.visibility=
"visible"},revealmenu:function(b,a,c,e){var d=(new Date).getTime()-a._starttime;if(d<this.effects.duration)this.effects.enableswipe&&(0==a._curanimatedegree&&(a.style[b._istoplevel&&"topbar"==e?"width":"height"]="auto"),a.style[b._istoplevel&&"topbar"==e?"height":"width"]=a._curanimatedegree*c+"px"),this.effects.enablefade&&this.setopacity(a,a._curanimatedegree);else{clearInterval(a._animatetimer);if(this.effects.enableswipe)a.style.width="auto",a.style.height="auto",a.style.overflow="visible";if(this.effects.enablefade)this.setopacity(a,
1),a.style.filter="";this.enableshim&&a.FFscrollInfo&&this.positionshim(b,a,e,a.FFscrollInfo.x,a.FFscrollInfo.y)}a._curanimatedegree=(1-Math.cos(d/this.effects.duration*Math.PI))/2},hidemenu:function(b){"undefined"!=typeof b._pos&&(this.css(this.topitems[b._master][parseInt(b._pos)],"selected","remove"),this.enableshim&&this.hideshim());clearInterval(b._animatetimer);b.style.left=0;b.style.top="-1000px";b.style.visibility="hidden"},addEvent:function(b,a,c){b.addEventListener?b.addEventListener(c,
a,!1):b.attachEvent&&b.attachEvent("on"+c,function(){return a.call(b,window.event)})},init:function(b,a){this.standardbody="CSS1Compat"==document.compatMode?document.documentElement:document.body;this.ulindex=this.topitemsindex=-1;this.topmenuids.push(b);this.topitems[b]=[];this.subuls[b]=[];this.hidetimers[b]=[];if(this.enableshim&&!this.shimadded)this.shimmy={},this.shimmy.topshim=this.addshimmy(document.body),this.shimmy.bottomshim=this.addshimmy(document.body),this.shimadded=!0;var c=document.getElementById(b).getElementsByTagName("a");
this.getwindowsize();for(var e=0;e<c.length;e++)if(c[e].getAttribute("rel")){this.topitemsindex++;this.ulindex++;var d=c[e];this.topitems[b][this.topitemsindex]=d;var f=document.getElementById(d.getAttribute("rel"));document.body.appendChild(f);f.style.zIndex=2E3;f._master=b;f._pos=this.topitemsindex;this.addEvent(f,function(){ddlevelsmenu.hidemenu(this)},"click");var h="sidebar"==a?"rightarrowpointer":"downarrowpointer",i="sidebar"==a?this.arrowpointers.rightarrow:this.arrowpointers.downarrow;this.arrowpointers.showarrow.toplevel&&
this.addpointer(d,h,i,"sidebar"==a?"before":"after");this.buildmenu(b,d,f,this.ulindex,!0,a);f.onmouseover=function(){clearTimeout(ddlevelsmenu.hidetimers[this._master][this._pos])};this.addEvent(f,function(a){if(!ddlevelsmenu.isContained(this,a)&&!ddlevelsmenu.isContained(ddlevelsmenu.topitems[this._master][parseInt(this._pos)],a)){var b=this;ddlevelsmenu.enableshim&&ddlevelsmenu.hideshim();ddlevelsmenu.hidetimers[this._master][this._pos]=setTimeout(function(){ddlevelsmenu.hidemenu(b)},ddlevelsmenu.hideinterval)}},
"mouseout");d=f.getElementsByTagName("ul");for(f=0;f<d.length;f++)this.ulindex++,h=d[f].parentNode,this.arrowpointers.showarrow.sublevel&&this.addpointer(h.getElementsByTagName("a")[0],"rightarrowpointer",this.arrowpointers.rightarrow,"before"),this.buildmenu(b,h,d[f],this.ulindex,!1,a)}this.addEvent(window,function(){ddlevelsmenu.getwindowsize();ddlevelsmenu.gettopitemsdimensions()},"resize")},setup:function(b,a){this.addEvent(window,function(){ddlevelsmenu.init(b,a)},"load")}};

