/**
  * menu (drop-down menu)
  * menu uses the Cross-Browser DHTML API CBE 4. For more informations about CBE look at http://cross-browser.com
  * Things that are posibble with this script:
  *  - Small drop-down menus with max-depth of 1. (no sub-sub-menus)
  *  - Sub-menus in HTML-Code, not generated.
  * @version  1.0.1 (restart.tc adaption)
  * @author   Thomas Seifried atomas@detonation.org
  * @license  GPL
  * @usage    All Items are divs or spans and position:absolute.
  *           ids of menupoint divs are freely chooseable
  *           ids of the submenu divs must be named like <menupointid>_drop. eg.: menu1_drop
  *           All menupoint ids (not submenu) that should have a drop-down menu have to be in the menuarray (see windowOnload)
 */
var menuarray = new Array(); // array of all menu-ids
var current; // current open drop-down menu (cbe object)
var currentmenu;  //current menupoint (cbe object)

function initDropper(){
      document.cbe.addEventListener('mouseMove',mouseMoveListener);
      for(i=0;i<menuarray.length;i++){
            mid=menuarray[i];
            cbeGetElementById(mid).cbe.addEventListener('mouseOver',mouseOverListener);
      }
}

function mouseOverListener(e){
   if(!(e.currentTarget.cbe==currentmenu)){
      currentmenu=e.currentTarget.cbe;
      if(current)current.hide();
      current=cbeGetElementById(currentmenu.id+"_drop").cbe;
      current.show();
   }
}

function mouseMoveListener(e){
   var x=e.pageX;
   var y=e.pageY;
   if(currentmenu && current){
      if(!currentmenu.contains(x,y) &&  !current.contains(x,y,-10,0,-6,0)){
         if(!is.konq || !current.contains(x,y,0,0,konquerorbug,0)){
            current.hide();
            current=0;
            currentmenu=0;
         }
      }
   }
}
