﻿var cssdropdown={disappeardelay:500,disablemenuclick:false,enableswipe:1,dropmenuobj:null,ie:document.all,firefox:document.getElementById&&!document.all,swipetimer:undefined,bottomclip:0,getposOffset:function(c,d){var b=d=="left"?c.offsetLeft:c.offsetTop,a=c.offsetParent;while(a!=null){b=d=="left"?b+a.offsetLeft:b+a.offsetTop;a=a.offsetParent}return b},swipeeffect:function(){if(this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){this.bottomclip+=10+this.bottomclip/10;this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"}else return;this.swipetimer=setTimeout("cssdropdown.swipeeffect()",10)},showhide:function(a,b){if(this.ie||this.firefox)this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px";if(b.type=="click"&&a.visibility==hidden||b.type=="mouseover"){if(this.enableswipe==1){if(typeof this.swipetimer!="undefined")clearTimeout(this.swipetimer);a.clip="rect(0 auto 0 0)";this.bottomclip=0;this.swipeeffect()}a.visibility="visible"}else if(b.type=="click")a.visibility="hidden"},iecompattest:function(){return document.compatMode&&document.compatMode!="BackCompat"?document.documentElement:document.body},clearbrowseredge:function(b,e){var a=0;if(e=="rightedge"){var c=this.ie&&!window.opera?this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15:window.pageXOffset+window.innerWidth-15;this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth;if(c-this.dropmenuobj.x<this.dropmenuobj.contentmeasure)a=this.dropmenuobj.contentmeasure-b.offsetWidth}else{var d=this.ie&&!window.opera?this.iecompattest().scrollTop:window.pageYOffset,c=this.ie&&!window.opera?this.iecompattest().scrollTop+this.iecompattest().clientHeight-15:window.pageYOffset+window.innerHeight-18;this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight;if(c-this.dropmenuobj.y<this.dropmenuobj.contentmeasure){a=this.dropmenuobj.contentmeasure+b.offsetHeight;if(this.dropmenuobj.y-d<this.dropmenuobj.contentmeasure)a=this.dropmenuobj.y+b.offsetHeight-d}}return a},dropit:function(a,c,b){if(this.dropmenuobj!=null)this.dropmenuobj.style.visibility="hidden";this.clearhidemenu();if(this.ie||this.firefox){a.onmouseout=function(){cssdropdown.delayhidemenu()};a.onclick=function(){return !cssdropdown.disablemenuclick};this.dropmenuobj=document.getElementById(b);this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()};this.dropmenuobj.onmouseout=function(a){cssdropdown.dynamichide(a)};this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()};this.showhide(this.dropmenuobj.style,c);this.dropmenuobj.x=this.getposOffset(a,"left");this.dropmenuobj.y=this.getposOffset(a,"top");this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(a,"rightedge")+"px";this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(a,"bottomedge")+a.offsetHeight+1+"px"}},contains_firefox:function(b,a){while(a.parentNode)if((a=a.parentNode)==b)return true;return false},dynamichide:function(b){var a=window.event?window.event:b;if(this.ie&&!this.dropmenuobj.contains(a.toElement))this.delayhidemenu();else if(this.firefox&&b.currentTarget!=a.relatedTarget&&!this.contains_firefox(a.currentTarget,a.relatedTarget))this.delayhidemenu()},delayhidemenu:function(){this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay)},clearhidemenu:function(){if(this.delayhide!="undefined")clearTimeout(this.delayhide)},startchrome:function(){for(var c=0;c<arguments.length;c++){var b=document.getElementById(arguments[c]).getElementsByTagName("a");for(var a=0;a<b.length;a++)if(b[a].getAttribute("rel")){var d=b[a].getAttribute("rel");b[a].onmouseover=function(a){var b=typeof a!="undefined"?a:window.event;cssdropdown.dropit(this,b,this.getAttribute("rel"))}}}}}