    /*  TREE.JS :  JAVASCRIPT INCLUDE DES BAUM-MENUS  */
    /*  AUTOR   : CAI ZIEGLER / SENSE NET MEDIA GBR   */
    /*  ANPASASUNG    : RAINER FISCHER 06/00          */
    /* ---------------------------------------------- */

    /* STATISCHE VARIABLEN DER KLASSE CTREE */

    cntTrees = 0;

    /* INTERNE KONSTANTEN */

    cShut = 0;
    cOpen = 1;
    maxNodes = 100;

    IE  = (document.all) ? 1 : 0; // Internet Explorer 4
    NS  = (document.layers) ? 1 : 0; // Netscape 4
    DOM = (document.getElementById) ? 1 : 0; // Internet Explorer ab 5 oder Netscape ab 6

    /* ----------------------------------------------- */
    /* KLASSE ZUR DEFINITION DER STRUKTUR DES BAUMS    */
    /* ----------------------------------------------- */

    function CNode() {
      this.sText = "";
      /* this.sIcon = ""; */
      this.sLink = "";
      this.sFrame = "";
      this.sClass = "";
      this.sState = cShut;
      this.nLevel = 0;
    }

    /* ---------------------------- */
    /* DEFINITION DER KLASSE CTREE  */
    /* ---------------------------- */

    function CTree() {

      /* BEZEICHNER  */

      this.ID = "";

      /* METHODEN  */

      this.open = open;
      this.shut = shut;
      this.addNode = addNode;
      this.stepIn  = stepIn;
      this.stepOut = stepOut;
      this.showTree = showTree;

      /* EIGENSCHAFTEN  */

      this.sImgNone = "";
      this.sImgPlus = "";
      this.sImgMinus = "";
      this.sImgNoNest = "";
      this.sImgHeight = 19;
      this.sImgWidth  = 26;

      /* EVENT HANDLER  */

      this.onTreeClicked = onTreeClicked;

      /* INTERNE VARIABLEN  */

      this.cntLine = 0;
      this.curNestLvl = 0;

      /* ABBILDUNG DER MENU STRUKTUR  */

      this.aNodes = new Array(maxNodes);
      cntTrees ++;
    }

    /* ----------------- */
    /*  ÖFFNET DEN BAUM  */
    /* ----------------- */

    function open() {

      /* IE >= 5 & NS >= 6  */
      if(IE || DOM)
        document.write('<div style="position:absolute;" id="L' + this.ID +
        '" name="L' + this.ID + '">');

      /* NS <= 4  */
      else if(NS)
        document.write('<layer id="L' + this.ID +
        '" name="L' + this.ID + '" visibility="show" style="position:absolute;">');
    }

    /* ------------------- */
    /* SCHLIESST DEN BAUM  */
    /* ------------------- */

    function shut() {
      if(IE || DOM) document.write('</div>');
      else if(NS) document.write('</layer>');
    }

    /* ---------------------------------- */
    /* FÜGT EINEN EINTRAG ZUM BAUM HINZU  */
    /* ---------------------------------- */

    function addNode(sText,sClass,sHyperLink,sTargetFrame) {

      /* MENU STRUKTUR MAPPEN  */

      this.aNodes [this.cntLine] = new CNode();
      this.aNodes [this.cntLine].sText = sText;
      /* this.aNodes [this.cntLine].sIcon = sIcon;  */
      this.aNodes [this.cntLine].sLink = sHyperLink;
      this.aNodes [this.cntLine].sFrame = sTargetFrame;
      this.aNodes [this.cntLine].sClass = sClass;
      this.aNodes [this.cntLine].sState = cShut;
      this.aNodes [this.cntLine].nLevel = this.curNestLvl;
      this.cntLine ++;
    }

    /* --------------------------------------- */
    /* METHODEN ZUR SCHACHTELUNG DER STRUKTUR  */
    /* --------------------------------------- */

    function stepIn() { this.curNestLvl ++; }

    function stepOut() { this.curNestLvl --; }

    /* --------------------------------- */
    /*  ZEICHNET DEN BAUM VON GRUND AUF  */
    /* --------------------------------- */

    function showTree() {

      /* VARIABLE ZU SPEICHERUNG DES BAUMS  */

      var sTree = '<table border="0" cellpadding="0" cellspacing="2" width="190">';

      /* JEDEN EINZELNEN EINTRAG ZEICHNEN  */

      var i;
      for(i = 0; i < this.cntLine; i ++) {

        /* AKTUELLE ZEILE AUS STRUKTUR HOLEN  */

        var line = this.aNodes [i];
        var bIsNestedNode = false;
        var bIsLastNode = (i == this.cntLine - 1) ? true : false;

        /* LIEGT EIN ÜBERPUNKT VOR ?  */

        if(!bIsLastNode && this.aNodes [i + 1].nLevel > line.nLevel)
          bIsNestedNode = true;
        sTree +=
          '<tr><td bgcolor="#ffffff">' +
          '<table border="0" cellpadding="0" cellspacing="0" width="100%">' +
          '<tr>';

        /* DER TIEFE ENTSPRECHEND EINRÜCKEN  */

        var j;
        for(j = 0; j < line.nLevel; j ++) {
          sTree +=
            '<td bgcolor="#ffffff">' +
            '<img border="0" hspace="0" vspace="0"' +
            'height="' + this.sImgHeight + '"' +
            'width="10"' +
            'src="' + this.sImgNone + '">' +
            '</td>';
        }
        sTree += '<td align="center">';

        /* LIEGT EINE VERZWEIGUNG VOR ?  */

        if(bIsNestedNode) {

          /* ANKER SETZEN  */

          sTree +=
            '<a border="0"' +
            'href="javascript:' + this.ID + '.onTreeClicked (' + i + ')">';
          if(line.sState == cShut) {
            sImgTemp = this.sImgPlus;

            /* SUCHE NACH NÄCHSTEM ANZUZEIGENDEN EINTRAG  */

            var k;
            for(k = i + 1; k < this.cntLine; k ++)
              if(this.aNodes [k].nLevel <= line.nLevel)
                break;
            i = k - 1;
          }
          else
            sImgTemp = this.sImgMinus;
        }
        else
          sImgTemp = this.sImgNoNest;

        /* +/- SYMBOL SCHREIBEN  */

        sTree +=
          '<img border="0" hspace="0" vspace="0"' +
          'height="' + this.sImgHeight + '"' +
          'width="' + this.sImgWidth  + '"' +
          'src="' + sImgTemp + '">';

        /* GEGEBENENFALLS DEN ANKER UM DAS +/- SYMBOL SCHLIESSEN  */

        if(bIsNestedNode)
          sTree += '</a>';

        /* ICON SCHREIBEN  */

        /* sTree += '</td><td>'; */
        /* sTree += */
        /*   '<img border = "0" hspace = "0" vspace = "0"' + */
        /*   '  height = "' + this.sImgHeight + '"' + */
        /*   '  width  = "' + this.sImgWidth  + '"' + */
        /*   '  src = "' + line.sIcon + '">'; */

        /* TEXT SCHREIBEN  */

        if(line.sLink != "")
          sTree +=
            '</td><td width="180" class="' + line.sClass + '">' +
            '<a class="' + line.sClass + '" href="' + line.sLink +
            '" target="' + line.sFrame + '">' + line.sText + '</a>';
        else
          sTree +=
            '</td><td class="' + line.sClass + '">' + line.sText;
        sTree += '</td></tr></table></td></tr>';
      }
      sTree += '</table>';

      /* DOM */
      if(DOM) document.getElementById('L' + this.ID).innerHTML = sTree;


      /* FÜR DEN INTERNET EXPLORER ...  */
      else if(IE)
        document.all ['L' + this.ID].innerHTML = sTree;

      /* ... UND FÜR DEN NETSCAPE  */
      else if(NS) {
        document.layers ['L' + this.ID].document.open();
        document.layers ['L' + this.ID].document.write(sTree);
        document.layers ['L' + this.ID].document.close();
        }
    }


    /* ----------------------------------------- */
    /*  EVENT HANDLER ZUR ANPASSUNG DER STRUKTUR  */
    /* ----------------------------------------- */

    function onTreeClicked(id) {

      /* TOGGLE +/-  */

      if(this.aNodes [id].sState == cShut)
        this.aNodes [id].sState = this.aNodes [id].cOpen;
      else
        this.aNodes [id].sState = cShut;
      this.showTree();
    }
