//Chrome Drop Down Menu v2.01- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: November 14th 06- added iframe shim technique

var cssdropdown2={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: true, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj2: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset2:function(what, offsettype){
var totaloffset2=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl2=what.offsetParent;
while (parentEl2!=null){
totaloffset2=(offsettype=="left")? totaloffset2+parentEl2.offsetLeft : totaloffset2+parentEl2.offsetTop;
parentEl2=parentEl2.offsetParent;
}
return totaloffset2;
},

swipeeffect2:function(){
if (this.bottomclip<parseInt(this.dropmenuobj2.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj2.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown2.swipeeffect2()", 10)
},

showhide2:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj2.style.left=this.dropmenuobj2.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect2()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest2:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge2:function(obj, whichedge){
var edgeoffset2=0
if (whichedge=="rightedge"){
var windowedge2=this.ie && !window.opera? this.iecompattest2().scrollLeft+this.iecompattest2().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj2.contentmeasure=this.dropmenuobj2.offsetWidth
if (windowedge2-this.dropmenuobj2.x < this.dropmenuobj2.contentmeasure)  //move menu to the left?
edgeoffset2=this.dropmenuobj2.contentmeasure-obj.offsetWidth
}
else{
var topedge2=this.ie && !window.opera? this.iecompattest2().scrollTop : window.pageYOffset
var windowedge2=this.ie && !window.opera? this.iecompattest2().scrollTop+this.iecompattest2().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj2.contentmeasure=this.dropmenuobj2.offsetHeight
if (windowedge2-this.dropmenuobj2.y < this.dropmenuobj2.contentmeasure){ //move up?
edgeoffset2=this.dropmenuobj2.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj2.y-topedge2)<this.dropmenuobj2.contentmeasure) //up no good either?
edgeoffset2=this.dropmenuobj2.y+obj.offsetHeight-topedge2
}
}
return edgeoffset2
},

dropit2:function(obj, e, dropmenuID){
if (this.dropmenuobj2!=null) //hide previous menu
this.dropmenuobj2.style.visibility="hidden" //hide menu
this.clearhidemenu2()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown2.delayhidemenu2()}
obj.onclick=function(){return !cssdropdown2.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj2=document.getElementById(dropmenuID)
this.dropmenuobj2.onmouseover=function(){cssdropdown2.clearhidemenu2()}
this.dropmenuobj2.onmouseout=function(e){cssdropdown2.dynamichide2(e)}
this.dropmenuobj2.onclick=function(){cssdropdown2.delayhidemenu2()}
this.showhide2(this.dropmenuobj2.style, e)
this.dropmenuobj2.x=this.getposOffset2(obj, "left")
this.dropmenuobj2.y=this.getposOffset2(obj, "top")
this.dropmenuobj2.style.left=this.dropmenuobj2.x-this.clearbrowseredge2(obj, "rightedge")+"px"
this.dropmenuobj2.style.top=this.dropmenuobj2.y-this.clearbrowseredge2(obj, "bottomedge")+obj.offsetHeight+1+"px"
this.positionshim2() //call iframe shim function
}
},

positionshim2:function(){ //display iframe shim function
if (this.enableiframeshim && typeof this.shimobject!="undefined"){
if (this.dropmenuobj2.style.visibility=="visible"){
this.shimobject.style.width=this.dropmenuobj2.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj2.offsetHeight+"px"
this.shimobject.style.left=this.dropmenuobj2.style.left
this.shimobject.style.top=this.dropmenuobj2.style.top
}
this.shimobject.style.display=(this.dropmenuobj2.style.visibility=="visible")? "block" : "none"
}
},

hideshim2:function(){
if (this.enableiframeshim && typeof this.shimobject!="undefined")
this.shimobject.style.display='none'
},

contains_firefox2:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide2:function(e){
var evtobj2=window.event? window.event : e
if (this.ie&&!this.dropmenuobj2.contains(evtobj2.toElement))
this.delayhidemenu2()
else if (this.firefox&&e.currentTarget!= evtobj2.relatedTarget&& !this.contains_firefox2(evtobj2.currentTarget, evtobj2.relatedTarget))
this.delayhidemenu2()
},

delayhidemenu2:function(){
this.delayhide=setTimeout("cssdropdown2.dropmenuobj2.style.visibility='hidden'; cssdropdown2.hideshim2()",this.disappeardelay) //hide menu
},

clearhidemenu2:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome2:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems2=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems2.length; i++){
if (menuitems2[i].getAttribute("rel")){
var relvalue2=menuitems2[i].getAttribute("rel")
menuitems2[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown2.dropit2(this,event,this.getAttribute("rel"))
}
}
}
}
if (window.createPopup && !window.XmlHttpRequest){ //if IE5.5 to IE6, create iframe for iframe shim technique
document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
this.shimobject=document.getElementById("iframeshim") //reference iframe object
}
}

}
