﻿    var GuidArray = [];
    var GuidArrayParent = [];
    var ArrayIndex = 0;
    var NowShowing = '';
    
    function toggleMenuPanel(panelid)
    {
      /* We start by hiding all menu items */
        
      for (i = 0; i < ArrayIndex; i++)
        if (document.getElementById(GuidArray[i]) != null)
          document.getElementById(GuidArray[i]).style.visibility = 'hidden'; 
      
      /* If we have nothing to show or if we are clicking the panel that
         already IS showing (for toggle on-off), just exit  */
      if (panelid == '' || panelid == NowShowing) 
      {
        NowShowing = '';
        return;  
      }
        
      NowShowing = panelid;
      
      /* alert(panelid);*/
      
      document.getElementById(panelid).style.visibility = 'visible';
      
      for (i = 0; i < ArrayIndex; i++)
        if (GuidArray[i] == panelid && GuidArrayParent[i] != '')
          document.getElementById(GuidArrayParent[i]).style.visibility = 'visible';
    }
    
    function addToGuidArray(guid, parentguid)
    {
      GuidArray[ArrayIndex] = guid;  
      GuidArrayParent[ArrayIndex++] = parentguid;
    }
     
    /* When we are mouseout from the whole menu, close it in 1 second */
    var OverMenu = 0;
    var MouseOutTimer;
    
    function MenuMouseOut()
    {
       MouseOutTimer = setTimeout("toggleMenuPanel('')", 1000);
    }
    
    function MenuMouseOver()
    {
      clearTimeout(MouseOutTimer);
    }
