/******************************************
CM_ADD-IN - hideselectboxes (last updated: 11/13/02)
IE5+ and NS6+ only - ignores the other browsers

Because of the selectbox bug in the browsers that makes 
selectboxes have the highest z-index whatever you do 
this script will check for selectboxes that interfear with
your menu items and then hide them. 

Just add this code to the coolmenus js file
or link the cm_addins.js file to your page as well.
*****************************************/
if(bw.dom&&!bw.op){
  makeCM.prototype.sel=0
  makeCM.prototype.onshow+=";this.hideselectboxes(pm,pm.subx,pm.suby,maxw,maxh,pm.lev)"
  makeCM.prototype.hideselectboxes=function(pm,x,y,w,h,l){
    var selx,sely,selw,selh,i
    if(!this.sel){
      this.sel=this.doc.getElementsByTagName("SELECT")
		  this.sel.level=0
    }
    var sel=this.sel
    for(i=0;i<sel.length;i++){
			selx=0; sely=0; var selp;
			if(sel[i].offsetParent){selp=sel[i]; while(selp.offsetParent){selp=selp.offsetParent; selx+=selp.offsetLeft; sely+=selp.offsetTop;}}
			selx+=sel[i].offsetLeft; sely+=sel[i].offsetTop
			selw=sel[i].offsetWidth; selh=sel[i].offsetHeight			
			if(selx+selw>x && selx<x+w && sely+selh>y && sely<y+h){
				if(sel[i].style.visibility!="hidden"){sel[i].level=l; sel[i].style.visibility="hidden"; if(pm){ if(!pm.mout) pm.mout=""; pm.mout+=this.name+".sel["+i+"].style.visibility='visible';"}}
      }else if(l<=sel[i].level && !(pm&&l==0)) sel[i].style.visibility="visible"
    }
  }
}
/******************************************
CM_ADD-IN - checkscrolled (last updated: 01/29/02)
This is supported by all browsers
- IE5 for MAC has some screen refreshing problems 
- Using this for non-ie browsers might slow down the page
  because the other browsers do not support the onscroll event
  so the script uses a timer.

Now with two new features.
- Set scrollstop to 1 to get another scrolling effect.
  If you do it will work the way it does on DHTMLCentral.com.
  Note that this feature is not perfect on menus not in rows.
- If you have the hideselectboxes add-in as well this function
  will now check for interfearing selectboxes when you scroll as 
  well.

Just add this code to the coolmenus js file
or link the cm_addins.js file to your page as well.
*****************************************/
if(bw.ie) makeCM.prototype.onconstruct='document.body.onscroll=new Function(c.name+".checkscrolled("+c.name+")")'
else makeCM.prototype.onconstruct='setTimeout(c.name+".checkscrolled()",200)' //REMOVE THIS LINE TO HAVE SCROLLING ON FOR EXPLORER ONLY!!
makeCM.prototype.lscroll=0
makeCM.prototype.scrollstop=1 //Set this variable to 1 for another scrolling effect. Leave at 0 to scroll regular
makeCM.prototype.checkscrolled=function(obj){
	var i;
	if(bw.mac) return //REMOVE THIS LINE TO HAVE SCROLLING ON THE MAC AS WELL - unstable!
  var c=bw.ie?obj:this, o
	if(bw.ns4 || bw.ns6 || bw.op5) c.scrollY=window.pageYOffset
	else c.scrollY=document.body.scrollTop
	if(c.scrollY!=c.lscroll){
    c.hidesub()
    if(c.scrollY>c.fromTop&&c.scrollstop){
      for(i=0;i<c.l[0].m.length;i++){o=c.m[c.l[0].m[i]].b; o.moveIt(o.x,c.scrollY)}
      if(c.useBar) c.bar.moveIt(c.bar.x,c.scrollY)
    }else{
      if(c.scrollstop){
        for(i=0;i<c.l[0].m.length;i++){o=c.m[c.l[0].m[i]].b; o.moveIt(o.x,c.fromTop)}
        if(c.useBar) c.bar.moveIt(c.bar.x,c.barY)
      }else{
        for(i=0;i<c.l[0].m.length;i++){o=c.m[c.l[0].m[i]].b; o.moveIt(o.x,o.oy+c.scrollY)}
        if(c.useBar) c.bar.moveIt(c.bar.x,c.barY+c.scrollY)
      }
    }
		c.lscroll=c.scrollY; cmpage.y=c.scrollY; cmpage.y2=cmpage.orgy+c.scrollY
		if(bw.ie){ clearTimeout(c.tim); c.isover=0; c.hidesub()}
    if(c.hideselectboxes){ //If you are using the hideselect add-in as well the script will now check for selectboxes when scrolling as well
      var x = c.useBar?c.m[c.l[0].m[0]].b.x>c.bar.x?c.bar.x:c.m[c.l[0].m[0]].b.x:c.m[c.l[0].m[0]].b.x;
      var y = c.useBar?c.m[c.l[0].m[0]].b.y>c.bar.y?c.bar.y:c.m[c.l[0].m[0]].b.y:c.m[c.l[0].m[0]].b.y;
      var maxw = c.useBar?c.bar.w:c.rows?c.totw:c.maxw; var maxh = c.useBar?c.bar.h:!c.rows?c.toth:c.maxh
      c.hideselectboxes(0,x,y,maxw,maxh,0)
    }
	}
	if(!bw.ie) setTimeout(c.name+".checkscrolled()",200)
}
