        /*  JS Code file: itnix_menus.js */
        /*  Description: accesses the elements in the html page and displays the hidden menus when the
         *        mouse is over an element tagged as a drop down menu */
        /*  Version: 1.5 */
        /*  All source code & concepts (c) copyright 1998, 2009 by ItNix, LLC. */
        /*  All rights reserved worldwide. */
        /*  Last change: 30jul09 */
        /*  Changed by: Ivan Carrazco */

var timer = null;
var delay = 100;
var currMenu = null;
var closingBool = true;
var counter = 100;
var isOpaque = false;


/**
  * openMenu: opens the specified
  , menuId.
  * param: e - the event that calls this function
  * param: menuId - the name of the menu to be opened
  */
 function openMenu(e, menuId) { //curr menu is already opened
    var evt = "";
    if( currMenu != null && menuId == currMenu.id ) {
      var menu = document.getElementById( menuId );
      menu.style.display = "block";
      currMenu = menu;
      cancelClosing(evt, menuId );
    }
    else if( currMenu != null && menuId != currMenu.id ) {
      closeMenu( evt, currMenu.id );
      var menu = document.getElementById( menuId );
      currMenu = menu;
      menu.style.display = "block";
    }
    else { //no menus are opened yet
      var menu = document.getElementById( menuId );
      currMenu = menu;
      menu.style.display = "block";
    }
  }





/**
  * closeMenu: closes the specified menu, menuId.
  * param: e - the event that calls this function
  * param: menuId - the name of the menu to be opened
  */
  function closeMenu(e, menuId) {
    if( menuId != null ) {
     var menu = document.getElementById(menuId);
     menu.style.display = "none";
    }

    //resetOpacity();
    clearTimeout( timer );
    timer = null;
    closingBool = true;
    counter = 100;
    currMenu = null;
  }


/**
  * startClosing: begins the closing sequence by calling the closing() method
  */
  function startClosing(e, menuId) {
    //cancelEventOrder( e );
    var currElem = document.getElementById(menuId);
    if( currMenu != null && currMenu.id == currElem.id ) {
      counter = 100;
      closing();
    }
    else {
      var evt = null;
      closeMenu(evt, currMenu.id);
      currMenu = currElem;
      closing();
    }
  }


/**
  * closing: begins closing sequence and updates the opened menu accordingly
  */
  function closing() {
    if( counter > 0 && closingBool == true ) {
      changeOpacity();
      timer = setTimeout( "closing();", delay );
    }
    else {
      var evt = "";
      closeMenu( evt, currMenu.id );
    }
  }




/**
  * changeOpacity: changes the opacity of the currently opened menu
  */
  function changeOpacity() {
    counter = counter - 10;
    var per = counter/100;
    if( currMenu.filters ) { //IE uses filters
        currMenu.style.filter = "alpha(opacity="+counter+")";

    }
    else if( currMenu.style ) { // Standard uses opacity
        currMenu.style.opacity = per;
        //currMenu.style.height = per +'%';
    }
  }




/**
  * resetOpacity: resets the opacity of the currently opened menu to 100 or 1
  */
  function resetOpacity() {
    if( currMenu.filters ) {
        currMenu.filters.opacity =  'opacity('+100+')';
    }
    else if( currMenu.style ) {
        currMenu.style.opacity = 1;
    }
  }





/**
  * cancelClosing: cancels the timer to close a menu.  The timer is restarted when the mouse is out of the element
  */
  function cancelClosing(e, menuId) {
    clearTimeout( timer );
    timer = null;
    counter = 100;
  }

