﻿if(typeof dd_domreadycheck=="undefined")var dd_domreadycheck=false;var anylinkmenu={menusmap:{},preloadimages:[],effects:{delayhide:200,shadow:{enabled:true,opacity:.3,depth:[5,5]},fade:{enabled:false,duration:500}},dimensions:{},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"),h:a.offsetHeight}},getdimensions:function(a){this.dimensions={anchorw:a.anchorobj.offsetWidth,anchorh:a.anchorobj.offsetHeight,docwidth:(window.innerWidth||this.standardbody.clientWidth)-20,docheight:(window.innerHeight||this.standardbody.clientHeight)-15,docscrollx:window.pageXOffset||this.standardbody.scrollLeft,docscrolly:window.pageYOffset||this.standardbody.scrollTop};if(!this.dimensions.dropmenuw){this.dimensions.dropmenuw=a.dropmenu.offsetWidth;this.dimensions.dropmenuh=a.dropmenu.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(d){a=c}if(a==c)return true;else return false},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){var a=anylinkmenu.menusmap[d];clearTimeout(a.hidetimer);this.getoffsetof(a.anchorobj);this.getdimensions(a);var b=a.anchorobj._offsets.left+(a.orientation=="lr"?this.dimensions.anchorw:0),c=a.anchorobj._offsets.top+this.dimensions.anchorh-(a.orientation=="lr"?this.dimensions.anchorh:0);if(b+this.dimensions.dropmenuw+this.effects.shadow.depth[0]>this.dimensions.docscrollx+this.dimensions.docwidth)b=b-this.dimensions.dropmenuw+(a.orientation=="lr"?-this.dimensions.anchorw:this.dimensions.anchorw);if(c+this.dimensions.dropmenuh>this.dimensions.docscrolly+this.dimensions.docheight)c=Math.max(c-this.dimensions.dropmenuh-(a.orientation=="lr"?-this.dimensions.anchorh:this.dimensions.anchorh),this.dimensions.docscrolly);if(this.effects.fade.enabled){this.setopacity(a.dropmenu,0);if(this.effects.shadow.enabled)this.setopacity(a.shadow,0)}a.dropmenu.setcss({left:b+"px",top:c+"px",visibility:"visible"});if(this.effects.shadow.enabled)a.shadow.setcss({left:b+anylinkmenu.effects.shadow.depth[0]+"px",top:c+anylinkmenu.effects.shadow.depth[1]+"px",visibility:"visible"});if(this.effects.fade.enabled){clearInterval(a.animatetimer);a.curanimatedegree=0;a.starttime=(new Date).getTime();a.animatetimer=setInterval(function(){anylinkmenu.revealmenu(d)},20)}},revealmenu:function(c){var a=anylinkmenu.menusmap[c],b=(new Date).getTime()-a.starttime;if(b<this.effects.fade.duration){this.setopacity(a.dropmenu,a.curanimatedegree);if(this.effects.shadow.enabled)this.setopacity(a.shadow,a.curanimatedegree*this.effects.shadow.opacity)}else{clearInterval(a.animatetimer);this.setopacity(a.dropmenu,1);a.dropmenu.style.filter=""}a.curanimatedegree=(1-Math.cos(b/this.effects.fade.duration*Math.PI))/2},setcss:function(a){for(prop in a)this.style[prop]=a[prop]},setcssclass: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},hidemenu:function(b){var a=anylinkmenu.menusmap[b];clearInterval(a.animatetimer);a.dropmenu.setcss({visibility:"hidden",left:0,top:0});a.shadow.setcss({visibility:"hidden",left:0,top:0})},getElementsByClass:function(d){if(document.querySelectorAll)return document.querySelectorAll("."+d);else{var e=new RegExp("(^|\\s+)"+d+"($|\\s+)","i"),c=[],b=document.all?document.all:document.getElementsByTagName("*");for(var a=0;a<b.length;a++)if(typeof b[a].className=="string"&&b[a].className.search(e)!=-1)c[c.length]=b[a];return c}},addDiv:function(c,d,b){var a=document.createElement("div");if(c)a.id=c;a.className=d;if(b!=""&&typeof a.style.cssText=="string")a.style.cssText=b;else if(b!="")a.setAttribute("style",b);document.body.appendChild(a);return a},getmenuHTML:function(a){var d=[],c="";for(var b=0;b<a.items.length;b++){c+='<li><a href="'+a.items[b][1]+'" target="'+a.linktarget+'">'+a.items[b][0]+"</a></li>\n";if(a.items[b][2]=="efc"||b==a.items.length-1){d.push(c);c=""}}if(typeof a.cols=="undefined")return "<ul>\n"+d.join("")+"\n</ul>";else{c="";for(var b=0;b<d.length;b++)c+='<div class="'+a.cols.divclass+'" style="'+a.cols.inlinestyle+'">\n<ul>\n'+d[b]+"</ul>\n</div>\n";return c}},addEvent:function(c,b,d){if(c.length>0){var a=c.shift();if(a.addEventListener)a.addEventListener(d,b,false);else if(a.attachEvent)a.attachEvent("on"+d,function(){return b.call(a,window.event)});this.addEvent(c,b,d)}},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)if(document.documentElement.doScroll&&window==window.top)(function(){if(dd_domreadycheck)return;try{document.documentElement.doScroll("left")}catch(b){setTimeout(arguments.callee,0);return}a();dd_domreadycheck=true})();if(document.attachEvent&&parent.length>0)this.addEvent(window,function(){a()},"load")},addState:function(a,c){if(a.getAttribute("data-image")){var b=a.tagName=="IMG"?a:a.getElementsByTagName("img")[0];if(b)b.src=c=="add"?a.getAttribute("data-overimage"):a.getAttribute("data-image")}else anylinkmenu.setcssclass(a,"selectedanchor",c)},addState:function(a,c){if(a.getAttribute("data-image")){var b=a.tagName=="IMG"?a:a.getElementsByTagName("img")[0];if(b)b.src=c=="add"?a.getAttribute("data-overimage"):a.getAttribute("data-image")}else anylinkmenu.setcssclass(a,"selectedanchor",c)},setupmenu:function(b,e,c){this.standardbody=document.compatMode=="CSS1Compat"?document.documentElement:document.body;var g=e.getAttribute("rel");dropmenuid=g.replace(/\[(\w+)\]/,"");var d=window[dropmenuid],f=this.addDiv(null,d.divclass,d.inlinestyle);f.innerHTML=this.getmenuHTML(d);var a=this.menusmap[b+c]={id:b+c,anchorobj:e,dropmenu:f,revealtype:g.length!=dropmenuid.length&&RegExp.$1=="click"?"click":"mouseover",orientation:e.getAttribute("rev")=="lr"?"lr":"ud",shadow:this.addDiv(null,"anylinkshadow",null)};a.anchorobj._internalID=b+c;a.anchorobj._isanchor=true;a.dropmenu._internalID=b+c;a.shadow._internalID=b+c;a.dropmenu.setcss=this.setcss;a.shadow.setcss=this.setcss;a.shadow.setcss({width:a.dropmenu.offsetWidth+"px",height:a.dropmenu.offsetHeight+"px"});this.setopacity(a.shadow,this.effects.shadow.opacity);this.addEvent([a.anchorobj,a.dropmenu,a.shadow],function(b){var a=anylinkmenu.menusmap[this._internalID];if(this._isanchor&&a.revealtype=="mouseover"&&!anylinkmenu.isContained(this,b)){anylinkmenu.showmenu(a.id);anylinkmenu.addState(this,"add")}else if(typeof this._isanchor=="undefined")clearTimeout(a.hidetimer)},"mouseover");this.addEvent([a.anchorobj,a.dropmenu,a.shadow],function(b){if(!anylinkmenu.isContained(this,b)){var a=anylinkmenu.menusmap[this._internalID];a.hidetimer=setTimeout(function(){anylinkmenu.addState(a.anchorobj,"remove");anylinkmenu.hidemenu(a.id)},anylinkmenu.effects.delayhide)}},"mouseout");this.addEvent([a.anchorobj,a.dropmenu],function(b){var a=anylinkmenu.menusmap[this._internalID];if(this._isanchor&&a.revealtype=="click"){if(a.dropmenu.style.visibility=="visible")anylinkmenu.hidemenu(a.id);else{anylinkmenu.addState(this,"add");anylinkmenu.showmenu(a.id)}if(b.preventDefault)b.preventDefault();return false}else a.hidetimer=setTimeout(function(){anylinkmenu.hidemenu(a.id)},anylinkmenu.effects.delayhide)},"click")},init:function(a){this.domready(function(){anylinkmenu.trueinit(a)})},trueinit:function(d){var c=this.getElementsByClass(d),a=this.preloadimages;for(var b=0;b<c.length;b++){if(c[b].getAttribute("data-image")){a[a.length]=new Image;a[a.length-1].src=c[b].getAttribute("data-image")}if(c[b].getAttribute("data-overimage")){a[a.length]=new Image;a[a.length-1].src=c[b].getAttribute("data-overimage")}this.setupmenu(d,c[b],b)}}}