

  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 hideDrop(buttonID){
		if(buttonID.toLowerCase()=='all'){
			// Hide ALL drops immediately
			// (getElementsByClassName is a custom function)
		  var allDropsArray = getElementsByClassName(MM_findObj("headerMenu_2"), "div", "dropMenu");
			for(i=0, arrayLength = allDropsArray.length; i<arrayLength; i++){
			  allDropsArray[i].style.visibility = "hidden";
			}

		  var allMenuItemsArray = getElementsByClassName(MM_findObj("headerMenu_2"), "a", "topMenuItem");
			for(i=0, arrayLength = allMenuItemsArray.length; i<arrayLength; i++){
			  allMenuItemsArray[i].style.color = menuItemColor;
			}

		}
		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(!(document.getElementById("dropMenu_"+dropNum))){
				MM_findObj(buttonID).style.color=menuItemColor;
				return;																 
		  }
		  timerID=setTimeout("MM_findObj('dropMenu_"+dropNum+"').style.visibility='hidden'; MM_findObj('"+buttonID+"').style.color='"+menuItemColor+"';",menuHideDelay);
		}
	}



	function showDrop(buttonID) {

		dropNum = getButtonNum(buttonID);

		// Start by hiding all drop menus
		hideDrop('all');

		// Set rollover color of menu option
		MM_findObj(buttonID).style.color=menuItemHoverColor;

		// If menu item has no drop associated with it, simply return from here
		if(!(document.getElementById("dropMenu_"+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;

		// Not finding this value in DOM.
		// If deemed important, can probably be calculated from subtracting left offset from right
		// var buttonWidth=MM_findObj(buttonID).style.width;

		
		var activeDrop = MM_findObj('dropMenu_'+dropNum);
		activeDrop.style.left = eval(buttonOffsetLeft-dropMenuNegativeOffset)+'px';
		activeDrop.style.top = eval(buttonOffsetTop+dropMenuVerticalOffset)+'px';
		// activeDrop.style.width = buttonWidth+'px';
		activeDrop.style.visibility='visible';

		// This can probably go:
		// MM_findObj(buttonID).style.height="auto";

		// Reset timer
		resetTimer();
	}


	function lockDrop(dropMenu){
		// parameter "dropMenu" not used at this time
		resetTimer();
	}

  function releaseDrop(dropMenu){
		// MM_findObj(dropMenu).style.backgroundColor='blue';
		buttonNum = getButtonNum(dropMenu);
		timerID=setTimeout("MM_findObj('"+dropMenu+"').style.visibility='hidden'; MM_findObj('topMenuItem_"+buttonNum+"').style.color='"+menuItemColor+"';",menuHideDelay);
	}

		function testGetViaClass(){
		  var tagArray = getElementsByClassName(MM_findObj("headerMenu_2"), "div", "dropMenu");
			alert(tagArray.length);
			alert(tagArray[0].id);
		}
