meinLink         = new Array();

meinPopup        = new Array();
meinMenu         = new Array(); // das sind die Ebenen
meinBildTouch    = new Array();


meinMenu1        = new Array();
meinMenu1[0]     = new Array();
men1              = -1;


meinMenu2        = new Array();
meinMenu2[0]     = new Array();
men2              = -1;


meinMenu3        = new Array();
meinMenu3[0]     = new Array();
men3              = -1;

meinMenu4        = new Array();


meinSub1         = new Array();  // das sind die Items
meinSub1[0]      = new Array();
subst1            = -1;

meinSub2         = new Array();
meinSub2[0]      = new Array();
subst2            = -1;


meinSub3         = new Array();
meinSub4         = new Array();

NeueNamenskette  = false;





function Menuobjekt()
{
this.aktiv        = false;
this.name         = "noname";

this.positiv      = "+";
this.negativ      = "-";

this.content      = "empty";
this.subcontent   = "empty";

this.wobistdu    = wobistdu;
}


function reference(eingabe)
{
alert ("doch eine Eingabe  " + eingabe);
}


function bildtouch_strukt()
{
x = meinBildTouch.length;
meinBildTouch[x] = new Menuobjekt();
y = String(x);
meinBildTouch[x].name = "BildTouch" + y;
alert (meinBildTouch[x].name);
aktBildT = meinBildTouch[x].name;
return aktBildT;
}


function link_strukt()
{
x = meinLink.length;
meinLink[x] = new Menuobjekt();
y = String(x);
meinLink[x].name = "Link" + y;
alert (meinLink[x].name);
aktLink = meinLink[x].name;
return aktLink;
alert ("Link beendet");
}




function pop_strukt()
{
x = meinPopup.length;
meinPopup[x] = new Menuobjekt();
y = String(x);
meinPopup[x].name = "Popup" + y;
alert (meinPopup[x].name);
aktPop = meinPopup[x].name;
return aktPop;
}

function dir_strukt()
{
x = meinMenu.length;
meinMenu[x] = new Menuobjekt();
y = String(x);
meinMenu[x].name = "Menu" + y;
Namenskette = meinMenu[x].name;
alert ("das ist das Directory, neue Namenskette");

NeuesVerzeichnis = true;                        // wichtig f+ür den y-Wert



// meinMenu[x].zustand = meinMenu[x].negativ;
}


function wobistdu(eingabe)
{
// alert (eingabe.id);

if (eingabe.status == undefined)
   {
   // alert ("Jetzt die Initialisierung");

   eingabe.status = true;

   Menucheck(eingabe);

   vorher = eingabe.innerHTML;
   jetzt = vorher.replace(/\+/, "-");
   eingabe.innerHTML = jetzt;
   sub_on(eingabe);
   item_on(eingabe);
   }
else
    {
    if(eingabe.status == true)
          {
          eingabe.status = false;

          vorher = eingabe.innerHTML;
          jetzt = vorher.replace(/\-/, "+");
          eingabe.innerHTML = jetzt;
          // alert (eingabe.id);
          sub_out(eingabe);
          item_out(eingabe);
          }
          else {
               // alert ("komme wieder  " + eingabe.status);
               eingabe.status = true;

               vorher = eingabe.innerHTML;
               jetzt = vorher.replace(/\+/, "-");
               // alert (jetzt);
               eingabe.innerHTML = jetzt;
               // alert (eingabe.id);
               sub_on(eingabe);
               item_on(eingabe);
               }
    }

}



function Menucheck(eingabe)
{
// alert ("Das wäre der Menücheck");
suche = /Sub/;
probe = suche.test(eingabe.id);
if (probe == true)
   {
   alert ("Es handelt sich um ein Subobjekt");
   }
}

function banal()
{
alert ("jetzt folgt banal");
window.document.Menu0_Sub0.style.display = "block";
}



function sub_on(eingabe)
{
objektabfrage = true;  // Vermutung, daß es das gibt
countme = 0;
conditio = true;

while (objektabfrage == true)
  {

    // code = "if(! window.document.all."+ eingabe.id + "_Menu" + countme  +"){alert('es gibt temp nicht'); conditio = false;} else{ alert('nein, doch');}"

    code = "if(! window.document.all."+ eingabe.id + "_Menu" + countme  +"){conditio = false;} else{do_nothing();}"


    eval(code);

    if (conditio == false)
       {
       break;
       }


    temporal = eval(eingabe.id + "_Menu" + countme);      // Fehler
    objektabfrage = true;
    temporal.style.display = "block";
    countme ++;
  }
}


function sub_out(eingabe)
{
objektabfrage = true;  // Vermutung, daß es das gibt
countme = 0;
conditio = true;

while (objektabfrage == true)
  {

    code = "if(! window.document.all."+ eingabe.id + "_Menu" + countme  +"){conditio = false;} else{do_nothing();}"


    eval(code);

    if (conditio == false)
       {
       break;
       }


    temporal = eval(eingabe.id + "_Menu" + countme);      // Fehler
    objektabfrage = true;
    temporal.style.display = "none";
    countme ++;
  }
// sub_out(temporal);       - diese Zeile funktioniert, verzögert aber enorm
}


/////////



///////////
function item_on(eingabe)
{
objektabfrage = true;  // Vermutung, daß es das gibt
countme = 0;
conditio = true;      // dito

while (objektabfrage == true)
  {

    code = "if(! window.document.all."+ eingabe.id + "_Sub" + countme  +"){conditio = false;} else{do_nothing();}"

    // alert (code);

    eval(code);

    if (conditio == false)
       {
       break;
       }

    tempo = eval(eingabe.id + "_Sub" + countme);      // Fehler
    objektabfrage = true;
    tempo.style.display = "block";
    countme ++;
  }

}



function item_out(eingabe)
{
objektabfrage = true;  // Vermutung, daß es das gibt
countme = 0;
conditio = true;      // dito


while (objektabfrage == true)
  {

    code = "if(! window.document.all."+ eingabe.id + "_Sub" + countme  +"){conditio = false;} else{do_nothing();}"


    eval(code);

    if (conditio == false)
       {
       break;
       }


    temp = eval(eingabe.id + "_Sub" + countme);      // Fehler
    objektabfrage = true;
    temp.style.display = "none";

    // Menu0_Sub0.style.display = "none";
    countme ++;
  }
// temp.item_out();
}

////////






///////////////


function wobistduAlt(eingabe)
{
alert (eingabe);

if (eingabe.aktiv == true)
   {
   tempA = eval (eingabe.name);
   tempA.innerHTML = "+ " + eingabe.content;

   // alert (eingabe);
   temp = eval (eingabe.subname);
   temp.style.display = "none";
   eingabe.aktiv = false;
   }

else {
     // alert ("Zustand ist false, wird aber gleich wahr");
     temp = eval (eingabe.subname);
     // alert (temp);
     // temp.style.visibility = "visible";
     tempA = eval (eingabe.name);
     tempA.innerHTML = "- " + eingabe.content;
     temp.style.display = "block";
     eingabe.aktiv = true;

     }

}


function colorswitcher(eingabe, ebene)
{
// temp = eval (eingabe.name);
temp = eval(eingabe);
temp.style.color = "red";

if (ebene == 0)
   {
   temp.style.color = aktuellZ[0][1];
   ///////////////////////// POPUP ////////////

   suchbereich = eingabe.id;
   suche1 = /Pop/;
   probe = suchbereich.search(suche1);
   if (probe == -1)
      {
      }
      else {
           temp.style.backgroundColor = aktuellZ[3][1];
           temp.style.borderColor     = aktuellZ[3][0];
           }

   ////////////////////////////////////////
   }


if (ebene == 1)
   {
   temp.style.color = aktuellZ[1][1];
   }

if (ebene == 2)
   {
   temp.style.color = aktuellZ[2][1];
   }

if (ebene == 3)
   {
   temp.style.color = aktuellZ[3][1];
   }
// temp.style.backgroundColor = "gold";
}


function colorswitcher2(eingabe, ebene)
{
//temp = eval (eingabe.name);
temp = eval(eingabe);
temp.style.color = "black";

if (ebene == 0)
   {
   temp.style.color = aktuellZ[0][0];

   suchbereich = eingabe.id;
   suche1 = /Pop/;
   probe = suchbereich.search(suche1);
   if (probe == -1)
      {
      }
      else {
           temp.style.backgroundColor = aktuellZ[3][0];
           temp.style.borderColor     = aktuellZ[3][1];

           }



   }


if (ebene == 1)
   {
   temp.style.color = aktuellZ[1][0];
   }

if (ebene == 2)
   {
   temp.style.color = aktuellZ[2][0];
   }

if (ebene == 3)
   {
   temp.style.color = aktuellZ[3][0];
   }
}


function clicktest()
{
alert ("Das ist der Klicktest");
}



function open_dir()
{
}



///////

function Namensermittlung (eingabe)
{
nova = eingabe;
var suche1 = /\_/;

probe = suche1.test(nova);

vonwo = 0;
endpunkt = nova.length + 1;
ebenenindex = 0;

pfad = new Array();

if (probe == false)
   {
   pfad[ebenenindex] = nova.slice(0, nova.length+1);
   }

while (probe==true)
  {
  probe = suche1.test(nova);
  treffer = nova.search(suche1);

  if (probe== true)
     {
     pfad[ebenenindex] = nova.slice(0, treffer);
     }
  else
     {
     pfad[ebenenindex] = nova.slice(0, nova.length+1);
     }

  ebenenindex ++;
  nova = nova.slice(treffer+1, nova.length);

  }
pfadsplit();
}


//////////////



function pfadsplit()
{
// alert ("Ich übergebe dem Pfadsplit");
index = 0;
pfadinfo = new Array();

while (pfad[index] != undefined)
   {
   pfadinfo[index] = new Array();

   // alert ("Diese Ebene existiert" + pfad[index]);
   var zahlsuche = /\d/;
   treffer = pfad[index].search(zahlsuche);

   t_name = pfad[index].slice(0, treffer);
   t_zahl = pfad[index].slice(treffer, pfad[index].length+1);

   pfadinfo[index][0] = t_name;
   pfadinfo[index][1] = t_zahl;

   // alert ("Name ist  " + t_name + " und Zahl lautet " + t_zahl);
   // alert (pfadinfo[index]);
   index ++;
   }

}


/////
function Menuerzeugung()
{
// alert ("Der Pfad hat die Länge  " + pfadinfo.length + " und lautet   " + pfadinfo);
index = 0;


alert ("Pfadinfo ist   " + pfadinfo);

switch (pfadinfo.length)
   {
   case 1:
   t_name = pfadinfo[0][0];
   t_zahl = pfadinfo[0][1];

   alert ("Das Array ist noch leer");


   if (NeuesVerzeichnis == true)
     {
      alert ("Aha, neues Verzeichnis - in der Schleife");
      men1 ++;
      alert ("Menu wird hochgezählt auf " + men1);
      meinMenu1[men1] = new Array();
      alert (meinMenu1[men1]);
      x = 0;
      y = String(x);
      NeuesVerzeichnis = false;
      }


   else {
        alert ("im Else-Teil");
        if (! meinMenu1[men1])
           {
           meinMenu1[men1] = new Array();
           }
        x = meinMenu1[men1].length;
        alert ("x beläuft sich auf  " + x);
        y = String(x);
        }


   meinMenu1[men1][x] = new Menuobjekt();
   meinMenu1[men1][x].name = pfad[0] + "_Menu" + y;
   aktName = meinMenu1[men1][x].name;


   antwort = confirm("Soll dies das aktuelle Verzeichnis werden?");
   if (antwort == true)
   {
   alert ("Neue Namenskette eingeben");
   Namenskette = aktName;
   NeuesVerzeichnis = true;
   }
   else {
        do_nothing();
        }

   ebeneNr = 1;

   return zeilenabstand = 10;
   return aktName;
   return ebeneNr;
   break;

   ///////////////////////////////////////////
   case 2:
   alert ("Ich befinde mich auf der Ebene 2");

   alert (pfadinfo);

   t_name = pfadinfo[0][0];
   t_zahl = pfadinfo[0][1];
   x = meinMenu2.length;
   alert ("Das Array ist noch leer");



   ///////

   if (NeuesVerzeichnis == true)
     {
      alert ("Aha, neues Verzeichnis - in der Schleife");
      men2 ++;
      alert ("Menu2 wird hochgezählt auf " + men2);
      meinMenu2[men2] = new Array();
      alert (meinMenu1[men2]);
      x = 0;
      y = String(x);
      NeuesVerzeichnis = false;
      }


   else {
        alert ("im Else-Teil");
        x = meinMenu2[men2].length;
        alert ("x beläuft sich auf  " + x);
        y = String(x);
        }


   /////////

   meinMenu2[men2][x] = new Menuobjekt();
   meinMenu2[men2][x].name = pfad[0] + "_" + pfad[1] + "_Menu" + y;
   aktName = meinMenu2[men2][x].name;


   ///////////////

   antwort2 = confirm("Soll dies das aktuelle Verzeichnis werden?");
   if (antwort2 == true)
   {
   alert ("Neue Namenskette eingeben");
   Namenskette = aktName;
   NeuesVerzeichnis = true;
   }
   else {
        do_nothing();
        }


   alert ("Der Name auf Ebene 2 lautet  " + aktName);
   ebeneNr = 2;

   return zeilenabstand = 25;
   return aktName;
   return ebeneNr;
   break;
   ///////////////////////////////////////////////

   case 3:
   alert ("Ich befinde mich auf der Ebene 3");

   alert (pfadinfo);

   t_name = pfadinfo[0][0];
   t_zahl = pfadinfo[0][1];
   x = meinMenu3.length;
   alert ("Das Array ist noch leer");




   if (NeuesVerzeichnis == true)
     {
      alert ("Aha, neues Verzeichnis - in der Schleife");
      men3 ++;
      alert ("Menu2 wird hochgezählt auf " + men3);
      meinMenu3[men3] = new Array();
      x = 0;
      y = String(x);
      NeuesVerzeichnis = false;
      }


   else {
        alert ("im Else-Teil");
        x = meinMenu3[men3].length;
        alert ("x beläuft sich auf  " + x);
        y = String(x);
        }


   meinMenu3[men3][x] = new Menuobjekt();
   meinMenu3[men3][x].name = pfad[0] + "_" + pfad[1] + "_" + pfad[2] + "_Menu" + y;
   aktName = meinMenu3[men3][x].name;

   // meinMenu3[x] = new Menuobjekt();
   // meinMenu3[x].name = pfad[0] + "_" + pfad[1] + "_" + pfad[2] + "_Menu" + y;
   // aktName = meinMenu3[x].name;

   alert ("Der Name auf Ebene 2 lautet  " + aktName);

   ebeneNr = 3;

   return zeilenabstand = 25;
   return aktName;
   return ebeneNr = 3;
   break;

   }

}



function Itemerzeugung()
{
// alert ("Der Pfad hat die Länge  " + pfadinfo.length + " und lautet   " + pfadinfo);
alert ("hier werden Items erzeugt");

index = 0;

switch (pfadinfo.length)
   {
   case 1:
   alert ("Ich befinde mich auf Ebene 1");
   t_name = pfadinfo[0][0];
   t_zahl = pfadinfo[0][1];


if (NeuesVerzeichnis == true)
     {
      alert ("Aha, neues Verzeichnis - in der Schleife");
      subst1 ++;
      alert ("subst wird hochgezählt auf " + subst1);
      meinSub1[subst1] = new Array();
      x = 0;
      y = String(x);
      NeuesVerzeichnis = false;
      }

   else {
        alert ("im Else-Teil");
        x = meinSub1[subst1].length;
        alert ("x beläuft sich auf  " + x);
        y = String(x);
        // y = x;
        }


   meinSub1[subst1][x] = new Menuobjekt();
   meinSub1[subst1][x].name = pfad[0] + "_Sub" + y;

   // window.status = "Das ist das Ende  " + meinSub1[x].name;
   aktName = meinSub1[subst1][x].name;

   ebeneNr = 1;


   return zeilenabstand = 10;
   return aktName;
   return ebeneNr;
   break;


   case 2:
   alert ("Bin auf Ebene 2 der Itemerzeugung");
   t_name = pfadinfo[0][0];
   t_zahl = pfadinfo[0][1];
   x = meinSub2.length;

   // meinSub2[x] = new Menuobjekt();


   if (NeuesVerzeichnis == true)
     {
      alert ("Aha, neues Verzeichnis - in der Schleife");
      subst2 ++;
      alert ("subst wird hochgezählt auf " + subst1);
      meinSub2[subst2] = new Array();
      x = 0;
      y = String(x);
      NeuesVerzeichnis = false;
      }


   else {
        alert ("im Else-Teil");
        x = meinSub2[subst2].length;
        alert ("x beläuft sich auf  " + x);
        y = String(x);
        // y = x;
        }

   meinSub2[subst2][x] = new Menuobjekt();
   meinSub2[subst2][x].name = pfad[0] + "_" + pfad[1] + "_Sub" + y;

   aktName = meinSub2[subst2][x].name;

   ebeneNr = 2;

   return zeilenabstand = 10;
   return aktName;
   return ebeneNr;
   break;

   case 3:
   alert ("Bin auf Ebene 3 der Itemerzeugung");
   t_name = pfadinfo[0][0];
   t_zahl = pfadinfo[0][1];
   x = meinSub3.length;

   meinSub3[x] = new Menuobjekt();

   if (NeuesVerzeichnis == true)
      {
      alert ("Aha, neues Verzeichnis");
      y = 0;
      NeuesVerzeichnis = false;
      }

   else {
        y = String(x);
        }


   meinSub3[x].name = pfad[0] + "_" + pfad[1] + "_" + pfad[2] + "_Sub" + y;

   aktName = meinSub3[x].name;

   ebeneNr = 3;

   return zeilenabstand = 10;
   return ebeneNr;
   return aktName;

   break;
   }

}


//////////////////////////////////
aktuellZ  = new Array()

//                      backCl  forCl   fontsize  font    pad-left padtop

aktuellZ[0] = new Array("brown", "red", "14", "monospace", "0", "0");
aktuellZ[1] = new Array("brown", "beige", "12", "monospace", "50", "0");
aktuellZ[2] = new Array("brown", "beige", "11", "monospace", "100", "0");
aktuellZ[3] = new Array("darkgray", "gray", "10", "monospace", "150", "0");

var Gliederstatus;


function template(objekt, eingabe, ebene)
{
Gliederstatus = ebene;


switch(document.StyleOptionen.Styles.selectedIndex)
     {
     case 0:
     editstate = 99;
     window.status = "Colors";
     Colors.style.left = 400;

     if (ColorFeld.color == undefined)
     {
     // alert ("Farbwert bestimmen");
      }
     else {

        switch (eingabe)
               {
               case 1:

               if (document.Farbgebung.typus[0].checked == 0)
               {
               alert ("Hintergrundfarbe");
               aktuellZ[ebene][0] = ColorFeld.color;
               objekt.style.color = aktuellZ[ebene][0];
               }
               if (document.Farbgebung.typus[0].checked == 1)
               {
               alert ("Vordergrundfarbe");
               aktuellZ[ebene][1] = ColorFeld.color;
               }
               break;


               //////// Glieder 2 Ebene

               default:
               }

        }

     break;            // Farbdefinition zuende


     case 1:
     window.status = "Jetzt wird die Fontgröße bestimmt";
     break;


     case 3:
     window.status = "SchriftTypus festlegen";
     editstate = 102;
     FontEditor.style.left = 400;

     ind1 = document.forms[1].elements[1].selectedIndex;
     objekt.style.fontFamily = document.forms[1].elements[1].options[ind1].text;
     aktuellZ[ebene][3] = document.forms[1].elements[1].options[ind1].text;
     // objekt.style.font =

     }

     switch (eingabe)
     {
     case 1:
     window.status = objekt;
     temporalObjekt = objekt;

           switch(document.StyleOptionen.Styles.selectedIndex)
                 {
                 case 1:
                 StyleSC.min = 1;
                 StyleSC.max = 128;
                 StyleSC.value = this.style.fontSize;
                 break;
                 }

     case 2:
     // alert (aktuell[ebene]);
     objekt.style.color = aktuellZ[ebene][1];
     objekt.style.fontSize = aktuellZ[ebene][2];
     objekt.style.fontFamily = aktuellZ[ebene][3];

     break;

     case 3:
     objekt.style.color = aktuellZ[ebene][0];
     break;

     case 4:
     window.status = objekt.id;
     temporalObjekt = objekt;
     break;
     }


}



function StyleSliderSC()
{
window.status = "Hallo, Style Slider";
switch(document.StyleOptionen.Styles.selectedIndex)
 {
 case 0:
 alert ("Jetzt werden Farben bestimmt");
 break;

 case 1:
   window.status = "Jetzt wird Fontgroesse bestimmt";
   StyleSC.min = 1;
   StyleSC.max = 128;
   temporalObjekt.style.fontSize = StyleSC.value;

   switch(temporalObjekt)
    {
    case Glieder0:
    aktuellZ[0][2] = StyleSC.value;
    break;

    case Glieder1:
    aktuellZ[1][2] = StyleSC.value;
    break;

    case Glieder2:
    aktuellZ[2][2] = StyleSC.value;
    break;

    case Glieder3:
    aktuellZ[3][2] = StyleSC.value;
    break;
    }

   window.status = "aktueller Groesse ist " + StyleSC.value;

 break;

 case 2:
   window.status = "Jetzt wird die Einrückung bestimmt";
   StyleSC.min = 0;
   StyleSC.max = 700;
   temporalObjekt.style.paddingLeft = StyleSC.value;

   switch(temporalObjekt)
    {
    case Glieder0:
    aktuellZ[0][4] = StyleSC.value;
    break;

    case Glieder1:
    aktuellZ[1][4] = StyleSC.value;
    break;

    case Glieder2:
    aktuellZ[2][4] = StyleSC.value;
    break;

    case Glieder3:
    aktuellZ[3][4] = StyleSC.value;
    break;
    }



   window.status = "aktueller Groesse ist " + StyleSC.value;
 break;

 case 3:
 // alert ("Hallo Schrift");

 break;

  case 4:
   window.status = "Jetzt wird die Top-Einrückung bestimmt";
   StyleSC.min = 0;
   StyleSC.max = 200;
   temporalObjekt.style.paddingTop = StyleSC.value;

   switch(temporalObjekt)
    {
    case Glieder0:
    aktuellZ[0][5] = StyleSC.value;
    break;

    case Glieder1:
    aktuellZ[1][5] = StyleSC.value;
    break;

    case Glieder2:
    aktuellZ[2][5] = StyleSC.value;
    break;

    case Glieder3:
    aktuellZ[3][5] = StyleSC.value;
    break;
    }

   window.status = "aktueller Groesse ist " + StyleSC.value;
 break;


 }
}


///////////////////////



function mailorder(eingabe)
{
mailform.action = "mailto: webmaster@superfluxus.de";
if (eingabe == 1)
   {
   alert ("Ein Schreiben an Martin Burckhardt")
   mailform.action = "mailto: mb@superfluxus.de";
   }

if (eingabe == 2)
   {
   alert ("Ein Schreiben an Simone Michelet");
   mailform.action = "mailto: michelet@superfluxus.de";
   }
// alert ("Hallo, mailorder");
alert (mailform.action);
// alert ("klappt das noch?");
mailform.submit();
}



////////////////////////

function TwoWindow(eingabe)
{
var zweitfenster = window.open(eingabe, "Comment", "width = 600,height = 480, resizable = yes, menubar = yes");
// var zweitfenster = window.open(eingabe);
zweitfenster.focus();
}
