///////////////////////////////////////////////////////////////////////////////

  function resetTimer(){
    clearTimeout(timerID);
  }

///////////////////////////////////////////////////////////////////////////////

  function getButtonNum(buttonID){
    // Get the number following the underscore in the button ID passed to function
    buttonIDarray = buttonID.split("_");
    dropNum = buttonIDarray[1];
    return(dropNum);
  }

///////////////////////////////////////////////////////////////////////////////

  function showDrop(buttonID) {

    dropNum = getButtonNum(buttonID);

    // Start by hiding all drop menus
    hideDrop('all');

    // Set rollover class of menu option
    MM_findObj(buttonID).className = overClass;

    // If menu item has no drop associated with it, simply return from here
    if(!(MM_findObj(dropIDprefix+dropNum))){
      return;
    }
  
    // May be problems if using IE on Mac (need to test)
    // if (IsMac && IE){return;}

    // Get position and width of hovered button
    
        var buttonOffsetLeft=MM_findObj(buttonID).offsetLeft;
    
    
    var buttonOffsetTop=MM_findObj(buttonID).offsetTop;
    // offsetWidth is read-only.  Must be set using setAttribute("width")
    // var buttonWidth=MM_findObj(buttonID).style.offsetWidth;


    var activeDrop = MM_findObj(dropIDprefix+dropNum);

    // Set x,y pos of drop menu ensuring that it doesn't overlap right edge of site
    activeDropLeftPos = (offset == "-") ? eval(buttonOffsetLeft-dropMenuHorizontalOffset) : eval(buttonOffsetLeft+dropMenuHorizontalOffset);    
    activeDrop.style.left = (activeDropLeftPos > maxDropPos) ? maxDropPos+'px' : activeDropLeftPos+'px';
    activeDrop.style.top = eval(buttonOffsetTop+dropMenuVerticalOffset)+'px';
    activeDrop.style.display='block';
    
    // Reset timer
    resetTimer();
  }


///////////////////////////////////////////////////////////////////////////////

  function hideDrop(buttonID){
    if(buttonID.toLowerCase()=='all'){
      // Hide ALL drops immediately
      // line moved to dropMenuConfig.js ---> // var drops = getElementsByClassName(MM_findObj(dropContainer), "div", dropMenuClass);
      for (i=0; i<drops.length; i++) {
        drops[i].style.display = 'none';
      }
      var headerMenuOptions = document.getElementById(tmoContainer);
      var tmos = headerMenuOptions.getElementsByTagName("a");
      for (var i=0; i<tmos.length; i++) {
        tmos[i].className = baseClass;
      }
    }
    else{
      dropNum = getButtonNum(buttonID);
      // Hide specified drop after duration: menuHideDelay
      clearTimeout(timerID);
      // If menu item has no drop associated with it,
      //    simply reset menu option color and return from here
      if(!(MM_findObj(dropIDprefix+dropNum))){
        MM_findObj(buttonID).className=baseClass;
        return;
      }
      timerID=setTimeout("MM_findObj('"+dropIDprefix+dropNum+"').style.display='none'; MM_findObj('"+buttonID+"').className='"+baseClass+"';",menuHideDelay);
    }
  }

///////////////////////////////////////////////////////////////////////////////

  function lockDrop(dropMenu){
    // parameter "dropMenu" not used at this time
    resetTimer();
  }

///////////////////////////////////////////////////////////////////////////////

function releaseDrop(dropMenu){
    buttonNum = getButtonNum(dropMenu);
    timerID=setTimeout("MM_findObj('"+dropMenu+"').style.display='none'; MM_findObj('"+tmoIDprefix+buttonNum+"').className='"+baseClass+"';",menuHideDelay);
  }

///////////////////////////////////////////////////////////////////////////////

/*
    Written by Jonathan Snook, http://www.snook.ca/jonathan
    Add-ons by Robert Nyman, http://www.robertnyman.com
*/
function getElementsByClassName(oElm, strTagName, oClassNames){
  var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
  var arrReturnElements = new Array();
  var arrRegExpClassNames = new Array();
  if(typeof oClassNames == "object"){
    for(var i=0; i<oClassNames.length; i++){
      arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
    }
  }
  else{
    arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
  }
  var oElement;
  var bMatchesAll;
  for(var j=0; j<arrElements.length; j++){
    oElement = arrElements[j];
    bMatchesAll = true;
    for(var k=0; k<arrRegExpClassNames.length; k++){
      if(!arrRegExpClassNames[k].test(oElement.className)){
        bMatchesAll = false;
        break;
      }

    }
    if(bMatchesAll){
      arrReturnElements.push(oElement);
    }
  }
  return (arrReturnElements)
}

///////////////////////////////////////////////////////////////////////////////

// Array support for the push method in IE 5
Array.prototype.push = ArrayPush;
function ArrayPush(value){
  this[this.length] = value;
}
