    var lastSub1Id;                                                   // last activated main group div
    var lastSub2Id;                                                   // last activated sub2 group div
    var lastSub3Id;                                                   // last colored sub3 group div

    // function showDiv(), hideDiv(), ...:
    // divId: active div, where the next div will be derived from
    // level: the level (starting from 1) in the menu of the div w/ the divId
    function showDiv(divId, level, moz) {
      var newBgColor;                                                 // defines the bgcolor change of the (base) div 'divId'
      var dadiv;
      var dasub;
      var subnavi;
      if (level == 1) {
        if (moz && lastSub1Id && divId != lastSub1Id) hideDiv(lastSub1Id, 1); // FF workaround - sometimes doesn't fire Mouseout event
        newBgColor = "#f4faff";
      }
      else if (level == 2) {
        if (moz && lastSub2Id && divId != lastSub2Id) hideDiv(lastSub2Id, 2); // same thing
        newBgColor = "#cfdfef";
      }
      if (divId && newBgColor) {                                      // there is a divId given; if newBgColor, we also have a level
        dadiv = document.getElementById(divId);                       // try to get the element
        if (dadiv && dadiv.style.zIndex != level) {                   // if we already did set the z-index -> don't!
          dadiv.style.zIndex = level;                                 // set z-index to the level
          dadiv.style.backgroundColor = newBgColor;                   // set newBgColor
          if (level == 1) lastSub1Id = divId;                         // remember the last Id
          if (level == 2) lastSub2Id = divId;
        }
        subnavi = "sub" + divId;                                      // id convention for derived subs
        dasub = document.getElementById(subnavi);                     // try to get the element
        if (dasub) {
          dasub.style.visibility = "visible";                         // show the sub
        }
      }
    }

    function hideDiv(divId, level, moz) {
      var newBgColor;
      var dadiv;
      var dasub;
      var subnavi;
      if (level == 1) newBgColor = "#cfdfef";
      if (level == 2) newBgColor = "#f4faff";
      if (divId && newBgColor) {
        dadiv = document.getElementById(divId);
        if (dadiv && dadiv.style.zIndex != (level - 1)) {           // if we already did set back the z-index, don't proceed!
          dadiv.style.zIndex = (level - 1);
          dadiv.style.backgroundColor = newBgColor;
          subnavi = "sub" + divId;
          dasub = document.getElementById(subnavi);
          if (dasub) {
            dasub.style.visibility = "hidden";
          }
        }
      }
    }

    function colorDiv(divId, level, moz) {
      var newBgColor;                                               // defines the bgcolor change of the (base) div 'divId'
      var dadiv;
      if (level == 1) {
        if (moz && lastSub1Id && divId != lastSub1Id) hideDiv(lastSub1Id, 1); // FF workaround - sometimes doesn't fire Mouseout event
        newBgColor = "#f4faff";
      }
      else if (level == 2) {
        if (moz && lastSub2Id && divId != lastSub2Id) hideDiv(lastSub2Id, 2); // same thing
        newBgColor = "#cfdfef";
      }
      else if (level == 3) {
        if (moz && lastSub3Id && divId != lastSub3Id) uncolorDiv(lastSub3Id, 3);   // no sub3s allowed -> only uncolor here
        newBgColor = "#f4faff";
      }
      if (divId && newBgColor) {
        if (dadiv = document.getElementById(divId)) {
          dadiv.style.backgroundColor = newBgColor;
          dadiv.style.zIndex = level;
          if (level == 1) lastSub1Id = divId;                        // remember the last Id
          if (level == 2) lastSub2Id = divId;
          if (level == 3) lastSub3Id = divId;
        }
      }
    }

    function uncolorDiv(divId, level, moz) {
      var newBgColor;
      var dadiv;
      if (level == 1) newBgColor = "#cfdfef";
      if (level == 2) newBgColor = "#f4faff";
      if (level == 3) newBgColor = "#cfdfef";
      if (divId && newBgColor) {
        if (dadiv = document.getElementById(divId)) {
          dadiv.style.backgroundColor = newBgColor;
          dadiv.style.zIndex = (level - 1);
        }
      }
    }

