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