var pageGB = "";
var ziel   = "";
var pfad   = "";
var seite  = "";

initDat();

function initDat() {
   pageGB = this.document.URL;
   var FileURL = giveTagID(155); if(FileURL != "") { pageGB=FileURL; }

   ziel = this.name;

   pfad_array = pageGB.replace(/http:\/\//,"").split("/");
   pfad  = "http://"+pfad_array[0]+"/";
   seite = pfad_array[pfad_array.length-1];
}


function giveTagID(id) {
   var Seit_name_new = "";
   if(top.edit) {
      var Seitall   = document.getElementsByTagName('html')[0].innerHTML;
      var Seitall_1 = "";
      if(Seitall) { Seitall_1 = Seitall.split('<!--&'+id+'--><!--'); }
      var Seitall_2 = "";
      if(Seitall_1[1]) { Seitall_2 = Seitall_1[1].split('--><!--%'+id+'-->'); } 
      if(Seitall_2[0]) { Seit_name_new = Seitall_2[0]; }
   }
   return(Seit_name_new);
}


if (top.name.substr(0,6) != "linkvs" && top.name.substr(0,13) != "Neues_Fenster" && seite.substr(0,1) != "0") {
   if (top.frames.length == 0) { window.name = "startseite" + pageGB; window.location.href=pfad+"index.html"; }
}



if(window.name == "Haupt_Fenster") { 
   if (top.name && top.name.substr(0,10) == "startseite") {

      var seithelp = top.name.replace(/http:\/\//,"").replace(/\//,"_XoIoX_").split("_XoIoX_");
      var seite    = pfad+seithelp[1];

      var seitealt = pageGB; 

         var ok = 0;
         if(parent.Oberes_Fenster  && parent.Oberes_Fenster.location.href  == seite) { ok = 1; }
         if(parent.Oberes_Menue    && parent.Oberes_Menue.location.href    == seite) { ok = 1; }
         if(parent.Unteres_Fenster && parent.Unteres_Fenster.location      == seite) { ok = 1; }
         if(parent.Linkes_Fenster  && parent.Linkes_Fenster.location.href  == seite) { ok = 1; }
         if(parent.Rechtes_Fenster && parent.Rechtes_Fenster.location.href == seite) { ok = 1; }
         if(parent.Platz_Links     && parent.Platz_Links.location.href     == seite) { ok = 1; }
         if(parent.Platz_Rechts    && parent.Platz_Rechts.location.href    == seite) { ok = 1; }

         if(seite && seitealt && (seite != seitealt) && (ok == 0)) { parent.Haupt_Fenster.location.href = seite; }
         top.name = ""; 
   }
}


function java_win(datei,width,height,scroll,resize) {
   var java_win = window.open(datei,"linkvs","width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",resizable=" + resize);
   java_win.focus();
}


function startseite() {  
   initDat();
   var urlp = pfad+"cgi-bin/started.pl?"+pageGB+"udhwCbFkZdOpEkfUdsze"+ziel;
   var editwin = window.open(urlp, "Edit","width=800,height=470,scrollbars=no,resizable=yes");
   editwin.focus();
}



function sethtmlstring() {   
   initDat();
   var submitok = 0;
   document.form.domainstring.value = pageGB; 

   for(var i = 0; i <= document.form.length-1; i++) {
      if(document.form[i] && document.form[i].name == "mussedit" && document.form[i].value == "") { submitok = 5; }    
   }

   if(submitok == 0) {

      if(document.form.action.indexOf("cgi-bin/formmail.pl") >= 0) {

           //------------------- nur für Warenkorb ------------------------------
           if(pageGB.indexOf("2002000") >= 0) {
              for(var i = 0; i <= document.form.length-1; i++) {
                 if(document.form[i] && document.form[i].name == "muss" && document.form[i].value == "") { submitok = 2; }    
              }
              if(document.form.XX_AGB_XX && document.form.XX_AGB_XX.checked == false) { 
                 submitok = 1;
              }
              if(submitok == 0) { 
                 var NoMenge = top.location.name.split("--NMa_begin");  // Menge entfernen (Doppelbestellungen)
                 if(NoMenge[0] != "") { top.location.name = NoMenge[0]; }

                 if(self.Nummer_Menge_array) { document.form.htmlstring.value = top.location.name + "--NMa_begin" + Nummer_Menge_array + "NMa_end--"; }  //---Art Menge---
              }
              if(submitok == 1) { var ausgabe = document.form.XX_Alert_4_XX.value; alert(ausgabe); }
              if(submitok == 2) { var ausgabe = document.form.XX_Alert_5_XX.value; alert(ausgabe); }
           } 
           //------------------- nur für Warenkorb ------------------------------    

         if(submitok == 0) { 
            for(var i = 0; i <= document.form.length-1; i++) {
               document.form[i].name = "formelement"+i; //-----> Felder namen geben ----
            }
            document.form.submit(); 
         }
      }

      //------kein cgi-bin/formmail.pl ---- Gaestebuch --------------------------
      else {
         var htmlvalue = "";
         if(top.location.name && top.location.name != "") { htmlvalue = htmlvalue + top.location.name; }
         else { htmlvalue = htmlvalue + "<!--INSERTER-->"; }

         for(var i = 0; i <= document.form.length-1; i++) {  
            if((document.form[i].type == "text" && document.form[i].name.substr(0,10) != "texteditor") || document.form[i].type == "textarea" ) { var icell = "&nbsp;"; if(document.form[i].value != "") { icell = document.form[i].value } htmlvalue = htmlvalue + "_Ixo8UoIoU8oxI_" + icell; }
         }
         document.form.htmlstring.value = htmlvalue;

         if(document.form.htmlstring.value.length < 5000) { document.form.submit(); }
         else { alert("Der Eintrag ist zu lang!"); }
      }  

   }
   else {
      alert("Bitte füllen Sie alle Felder mit * aus!");
   }
}


function giveid() {
  var zahl = Math.random();
  zahl = zahl * 10000000000;
  zahl = Math.round(zahl); 
  return zahl;
}


function link(page, frame)
{ 
   if((page != "cgi-bin/search.pl") && (page != "cgi-bin/newadd.pl")) { 

      if(page.substr(0,7) != "http://") { page = pfad+page; }

      if((frame=="Haupt_Fenster")    && (parent.Haupt_Fenster))    { parent.Haupt_Fenster.location.href   = page; }
      if((frame=="Oberes_Fenster")   && (parent.Oberes_Fenster))   { parent.Oberes_Fenster.location.href  = page; }
      if((frame=="Oberes_Menue")     && (parent.Oberes_Menue))     { parent.Oberes_Menue.location.href    = page; }
      if((frame=="Unteres_Fenster")  && (parent.Unteres_Fenster))  { parent.Unteres_Fenster.location.href = page; }
      if((frame=="Linkes_Fenster")   && (parent.Linkes_Fenster))   { parent.Linkes_Fenster.location.href  = page; }
      if((frame=="Rechtes_Fenster")  && (parent.Rechtes_Fenster))  { parent.Rechtes_Fenster.location.href = page; }
      if((frame=="Platz_Links")      && (parent.Platz_Links))      { parent.Platz_Links.location.href     = page; }
      if((frame=="Platz_Rechts")     && (parent.Platz_Rechts))     { parent.Platz_Rechts.location.href    = page; }
      if(frame=="Gleiches_Fenster") { self.location.href = page; }

      if(frame=="Neues_Fenster") { 
      var linkvs = window.open(page, "linkvs", "toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
      linkvs.focus();
      }
   }
}


function search_f(VZ) {
   if(document.form.textsuche && document.form.textsuche.value != "") {
      page = pfad+'cgi-bin/search.pl?' + document.form.textsuche.value + 'xuIoIux0xuIoIux1xuIoIux';  
      if(VZ) { page += VZ; }
      if(parent.Haupt_Fenster)    { parent.Haupt_Fenster.location.href = page; } 
   }
   else {
      alert("Bitte tragen Sie einen Suchbegriff ein!");
   }
}



function newsltd_f() {
   initDat();
   if(document.form.textnewslt && document.form.textnewslt.value != "" && document.form.textnewslt.value.indexOf("@") != -1 && document.form.textnewslt.value.indexOf(".") != -1) {
      page = pfad+'cgi-bin/newadd.pl?' + document.form.textnewslt.value + 'xuIoIux' + giveid() + 'xuIoIux' + pageGB + 'xuIoIuxxendx' ; 
      this.location.href = page;  
   }
   else {
      alert("Bitte tragen Sie eine gültige Email-Adresse ein!");
   }  
} 


function editinsert(wert) {
   if(wert == "[img]") {
      document.form.texteditor.value += "[img: " + document.form.texteditorimg.value + "]";
   }
   if(wert == "[link]") {
      document.form.texteditor.value += "[link: " + document.form.texteditorlink.value + " text: " + document.form.texteditorlinktext.value + "]";
   }
   if(wert.substr(0,2) == "[S") {
      document.form.texteditor.value += wert;
   }
}



// Shop functionen ---------------------------------------------------------------

// Shop Menu

function showmenu(id)
{  
 var Aktiv = "";
 if(document.getElementById) {

   for(i = 1; i <= 99; i++) { 

   if(document.getElementById("img" + i)) { document.getElementById("img" + i).className = "slc00001"; }

      if(document.getElementById(i + "U1")) { 
         if(document.getElementById("img" + i)) { document.getElementById("img" + i).className = "slc00006"; }
            if(document.getElementById(i + "U1").style.display == "inline") {
               Aktiv = i;
               document.getElementById(i + "U1").style.display  = "none";            
            }
      }
   }

   if(document.getElementById("img" + id)) { if(Aktiv != id) { document.getElementById("img" + id).className = "slc00004";} else { document.getElementById("img" + id).className = "slc00006"; } }

   if(document.getElementById(id + "U1") && (Aktiv != id)) { 
      if(document.getElementById(id + "U1").style.display == "none") {

         document.getElementById(id + "U1").style.display  = "inline";
         for(i = 1; i <= 99; i++) { 
         if(document.getElementById("Uimg" + i)) { 
            document.getElementById("Uimg" + i).className = "slc00003"; }
         }
         if(document.getElementById("img" + id)) { document.getElementById("img" + id).className = "slc00002"; }
      }
   }
 }
}

function showbutton(id) {
 if(document.getElementById) {
   for(i = 1; i <= 99; i++) { 
   if(document.getElementById("Uimg" + i)) { 
      document.getElementById("Uimg" + i).className = "slc00003"; }
   }
   if(document.getElementById("Uimg" + id)) { document.getElementById("Uimg" + id).className = "slc00005"; }
 }
}



//---- artikel in Warenkorb -----------------------
function abuy() { 
   if(!top.location.name){top.location.name=''; }
   var test = top.location.name + "";
   if(test.substr(0,9) != "_xOrIrOx_") {  top.location.name=''; }

   var Fehler = 0; 
   if(document.form.SMenge) { 
      if(document.form.SMenge.value < 1*document.form.XX_Art_Anz_XX.value || document.form.SMenge.value == 0) { 
         var ausgabe = document.form.XX_Alert_4_XX.value;
         alert(ausgabe); 
         Fehler = 1;
      }
   }
   if(Fehler == 0) {
      if (check_ganzzahl(document.form.XX_Art_Anz_XX.value) != true) {  // test ob die Menge eine ganzzahl ist
         document.form.XX_Art_Anz_XX.value = 1;
         var ausgabe = document.form.XX_Alert_3_XX.value;
         alert(ausgabe);
      }
      else { 
         if(top.location.name.substr(0,9) != "_xOrIrOx_") { top.location.name = "_xOrIrOx_leer_xOrIrOx_0_xOrErOx_" + document.form.XX_Art_Go_XX.value + document.form.XX_Art_Anz_XX.value +"_xOrErOx_"; }
         else { top.location.name = top.location.name + document.form.XX_Art_Go_XX.value + document.form.XX_Art_Anz_XX.value + "_xOrErOx_"; }
         var ausgabe = document.form.XX_Alert_1_XX.value;
         alert(ausgabe);
      }
   }
}

//---- anzeigen Warenkorb -------------------------
function wbuy() {   
   if(!top.location.name){ top.location.name=''; } 
   var test = top.location.name + "";
   if(test.substr(0,9) != "_xOrIrOx_") {  top.location.name=''; }

   if(top.location.name.substr(0,9) == "_xOrIrOx_") { link('2002000.html','Haupt_Fenster'); }
   else { 
      var ausgabe = document.form.XX_Alert_2_XX.value;
      alert(ausgabe);
   }
}


function printS(wert) {
   if(wert == 1) {
      document.getElementById("XX_print_button").style.display='none';
      var printC = document.body.style.backgroundColor;
      var printI = document.body.style.backgroundImage;
      document.body.style.backgroundColor='#FFFFFF'; 
      document.body.style.backgroundImage=''; 

      for (var i = 0; i < document.getElementsByTagName("p").length; i++) {
         document.getElementsByTagName("p")[i].style.color = "#000000";
      }
   }

   window.print();

   if(wert == 1) {
      for (var i = 0; i < document.getElementsByTagName("p").length; i++) {
         document.getElementsByTagName("p")[i].style.color = "";
      }

      document.getElementById("XX_print_button").style.display='inline';
      document.body.style.backgroundColor=printC; 
      document.body.style.backgroundImage=printI; 
   }
}


//------ Umfragen ----------------------------------------------------------
function VoteST(wert) {
   var datei = pfad+"cgi-bin/Umstatpb.pl?"+wert;
   java_win(datei,400,300,1,1);
}

var VoteVar = "";

function Vote(wert) {
   initDat();
   if(VoteVar.indexOf(wert) == -1) { alert("Bitte wählen Sie einen Punkt!"); }
   else { this.location.href = pfad+"cgi-bin/Umstatmk.pl?"+pageGB+"_xi8o8ix_"+VoteVar; }
}


//---- no right ----------------------------
if(window.Event)document.captureEvents(Event.mouseup);function menue(){event.cancelBubble=true,event.returnValue=false;return false;}function noright(id){if (window.Event){if (id.which == 2 || id.which == 3) return false;} else if (event.button == 2 || event.button == 3) { event.cancelBubble = true, event.returnValue = false; return false;}}if (document.layers) { document.captureEvents(Event.mousedown);}document.oncontextmenu = menue;document.onmousedown = noright;document.onmouseup = noright;