

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