
<!--
//########### Warenkorb-Objekt ######################Fdatei


Warenkorb= new Warenkorbconstructor();
function Warenkorbconstructor() {

        this.WarenkorbFenster=null;

        this.Art_Nr = new Array();
        this.Art_Bez = new Array();
        this.Art_Preis = new Array();
        this.Art_Anzahl = new Array();
                this.laenge=0;

                //Zur Datenhaltung zwischen Artikelliste und Bestellformular
        this.Versandkosten = "";
                this.MwSt_subtract = false;
                this.Land = "";
                this.Zahlungsmodalitaet;

        this.offen=false;
        this.noonunload=false;
        this.Referenz = "";

        this.Holelaenge=Holelaenge;

        this.Oeffnen=Wk_Oeffnen;
        this.Schliessen=Wk_Schliessen;

        this.Art_exist=Art_exist;
        this.Art_loesch=Art_loesch;
        this.Art_hinzu=Art_hinzu;

        this.HoleArtikel=HoleArtikel;
        this.SpeicherArtikel=SpeicherArtikel;
        this.LoescheWarenkorb=LoescheWarenkorb;

        this.centerwindow=global_centerwindow;
}

function Holelaenge(){
        return this.laenge;
}

function Wk_Oeffnen(baseDir) {
  /*if (this.offen) {
     WarenkorbFenster.focus();
     this.noonunload=true;
     WarenkorbFenster.newload(this.Referenz+"wk_anz.htm")
     return true;
  }
  else this.noonunload=false;
  this.offen = true;*/

        if (Warenkorb.WarenkorbFenster != null) {if (!Warenkorb.WarenkorbFenster.closed) Warenkorb.WarenkorbFenster.focus();}
  if (this.laenge==0)
    this.WarenkorbFenster = open("http://www.papierossi.de/HTMS/WAR_KORB/lwk_anz.htm","Warenkorb","width=740,height=200,resizable=yes,location=no,menubar=yes,scrollbars=yes,status=yes,toolbar=no"+this.centerwindow(740, 200));
  else
    this.WarenkorbFenster = open("http://www.papierossi.de/HTMS/WAR_KORB/wk_anz.htm","Warenkorb","width=740,height=700,resizable=yes,location=no,menubar=yes,scrollbars=yes,status=yes,toolbar=no"+ this.centerwindow(740,600));
  return true;
}

function Wk_Schliessen (){
  this.offen=false;
  this.WarenkorbFenster.close();
}

function Art_exist(nr) {
        var rueck=""
        for (var i=0; i<this.laenge; i++) {
          if (this.Art_Nr[i] == nr) rueck=this.Art_Anzahl[i];
        }
        return rueck;
}


function Art_loesch(nr) {
  for (i=0; i<this.laenge; i++) {
          if (this.Art_Nr[i] == nr){
                  for (ii=i; ii<this.laenge; ii++){
                          this.Art_Nr[ii]=this.Art_Nr[ii+1];
                          this.Art_Bez[ii]=this.Art_Bez[ii+1];
                                this.Art_Preis[ii]=this.Art_Preis[ii+1];
                          this.Art_Anzahl[ii]=this.Art_Anzahl[ii+1];
                        }
                        this.laenge--;
                        if (this.laenge == 0) this.LoescheWarenkorb();
                        else this.SpeicherArtikel();

                  return;
                }
        }
}

function Art_hinzu(Nr,Bez,Preis,Anzahl) {
  for (var i = 0; i < this.laenge; i++) {
          if (this.Art_Nr[i] == Nr) {
                  this.Art_Anzahl[i] = Anzahl;
                        this.SpeicherArtikel();
                        return null;
                }
        }
        this.Art_Nr[this.laenge] = Nr;
        this.Art_Bez[this.laenge] = Bez;
        this.Art_Preis[this.laenge] = Preis;
        this.Art_Anzahl[this.laenge] = Anzahl;

        this.laenge++;
        this.SpeicherArtikel();
        return null;
}

function HoleArtikel() {
  var Artikel_zwischen;
  var WarenStr = holeCookie("Warenkorb");
        if (WarenStr == null) {this.laenge=0; return;}
  Artikel_zwischen = WarenStr.split("###");
        for (i in Artikel_zwischen) Artikel_zwischen[i] = Artikel_zwischen[i].split("***");
  this.laenge= parseInt(i)+1;

  for (var i=0; i<this.laenge; i++) {
          this.Art_Nr[i] = Artikel_zwischen[i][0];
          this.Art_Bez[i] = Artikel_zwischen[i][1];
                this.Art_Preis[i] = Artikel_zwischen[i][2];
                this.Art_Anzahl[i] = Artikel_zwischen[i][3];
        }
}

function SpeicherArtikel() {
        var WarenStr = new String("");
        for (var i=0; i<this.laenge; i++) {
                WarenStr += this.Art_Nr[i] + "***" + this.Art_Bez[i] + "***" +
                this.Art_Preis[i] +"***" + this.Art_Anzahl[i] +"###";
        }
        WarenStr = WarenStr.substring(0, WarenStr.length-3);
        setzeCookie("Warenkorb", WarenStr);
}

function LoescheWarenkorb() {
        loescheCookie("Warenkorb");
}

//############# Art_Dazufuegen ############
Art_dazufuegen = new Art_Dazufuegenconstructor
function Art_Dazufuegenconstructor() {

        this.hinzufuegenFenster=null;
        this.Art_Nr=null;
        this.Art_Bez=null;
        this.Art_Preis=null;
        this.Art_Anzahl=null;

        this.neu=true;

        this.Oeffnen=Df_Oeffnen;
        this.Oeffnen_sus=Df_Oeffnen_sus;
        this.Schliessen=Df_Schliessen;

        this.centerwindow=global_centerwindow;
}


function Df_Oeffnen(Art_db_Feldelement) {
  //if (Warenkorb.WarenkorbFenster != null) {alert(Warenkorb.WarenkorbFenster.closed); if (!Warenkorb.WarenkorbFenster.closed) Warenkorb.Schliessen();}
  this.Art_Nr=Inhalt.Datenbank.Artikel[Art_db_Feldelement][3];
  this.Art_Bez=Inhalt.Datenbank.Artikel[Art_db_Feldelement][4];
  this.Art_Preis=Inhalt.Datenbank.Artikel[Art_db_Feldelement][0];

  if (Warenkorb.Art_exist(this.Art_Nr) == "") this.neu=true; else this.neu=false;
  this.Art_Anzahl=Warenkorb.Art_exist(this.Art_Nr);
  if (this.neu) this.Art_Anzahl=1;
// Variante 1 funktioniert nicht bei allen Browsern, z.B. Opera
/*  if (is_nav) datei="../WAR_KORB/arthinzu.htm"
  else datei="HTMS/WAR_KORB/arthinzu.htm";
*/
// Variante 2 funktioniert nur auf dem Webserver
  datei="http://www.papierossi.de/HTMS/WAR_KORB/arthinzu.htm";
//  alert(datei);
/**/
  this.hinzufuegenFenster = open(datei,"Dazufuegen","height=270,width=575,resizable=yes,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no"+ this.centerwindow(575, 270));
  return true;
}

function Df_Oeffnen_sus(nummer, bez, preis) {
  //if (Warenkorb.WarenkorbFenster != null) {alert(Warenkorb.WarenkorbFenster.closed); if (!Warenkorb.WarenkorbFenster.closed) Warenkorb.Schliessen();}
  this.Art_Nr=nummer;
  this.Art_Bez=bez;
  this.Art_Preis=preis;

  if (Warenkorb.Art_exist(this.Art_Nr) == "") this.neu=true; else this.neu=false;

  this.Art_Anzahl=Warenkorb.Art_exist(this.Art_Nr);

  if (this.neu) this.Art_Anzahl=1;
// Variante 1 funktioniert nicht bei allen Browsern, z.B. Opera
/*  if (is_nav) datei="../WAR_KORB/arthinzu.htm"
  else datei="HTMS/WAR_KORB/arthinzu.htm";*/

// Variante 2 funktioniert nur auf dem Webserver
  datei="http://www.papierossi.de/HTMS/WAR_KORB/arthinzu.htm";
/**/
  this.hinzufuegenFenster = open(datei,"Dazufuegen",
          "height=270,width=575,resizable=yes,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no" + this.centerwindow(575, 270));
  return true;
}

function Df_Schliessen(Aktion){
  if (Aktion == 0) Warenkorb.Art_loesch(this.Art_Nr);
        if (Aktion == 1) Warenkorb.Art_hinzu(this.Art_Nr, this.Art_Bez, this.Art_Preis, this.Art_Anzahl);
        if (Aktion == 2) {}

        this.hinzufuegenFenster.close();

}

//########### Bestellung abschicken Objekt ##############

Bestellabs= new Bestellabsconstructor;
function Bestellabsconstructor () {

  this.Oeffnen=Ba_Oeffnen;
        this.Schliessen=Ba_Schliessen;

}
function Ba_Oeffnen() {
// Variante 1 funktioniert nicht bei allen Browsern, z.B. Opera
/*  if (is_nav) datei="../WAR_KORB/bestell.htm"
        else datei="bestell.htm";*/

// Variante 2 funktioniert nur auf dem Webserver
  datei="http://www.papierossi.de/HTMS/WAR_KORB/bestell.php5";

  Warenkorb.WarenkorbFenster.location.href=datei;

}
function Ba_Schliessen(){
  Warenkorb.WarenkorbFenster.close();
}
//########## Sonstige Funktionen ############

function add0DM(wert) {
  wert=Math.round(wert*100)/100;
        wertS=new String(wert);
        if (wertS.charAt(wertS.length-2) == ".") wertS += "0";
        if (wertS.charAt(0) == ".") wertS="0"+wertS;
        if (wertS.indexOf(".")==-1) wertS +=".00";

        if (is_ie) {
          if (wertS.length==7) wertS="      "+wertS;
          if (wertS.length==6) wertS="        "+wertS;
          if (wertS.length==5) wertS="          "+wertS;
          if (wertS.length==4) wertS="             "+wertS;
                if (wert < 0) wertS=" "+wertS;
        }
        else {
          if (wertS.length==7) wertS=" "+wertS;
          if (wertS.length==6) wertS="  "+wertS;
          if (wertS.length==5) wertS="   "+wertS;
          if (wertS.length==4) wertS="    "+wertS;
        }
        return wertS;
}

function renderAnzahl(Anzahl){
  var rueck;
  if (Anzahl == "") rueck=0
         else {
           if (isNaN(Anzahl)) rueck=0
                 else rueck=Anzahl;
         }
        return rueck;
}

function global_centerwindow(length,height) {
  var rueck;
  if (is_nav) rueck=",ScreenX="+Math.abs((screen.width-length)/2)+",ScreenY="+Math.abs((screen.height-height)/2);
  if (is_ie) rueck=",left="+Math.abs((screen.width-length)/2)+",top="+Math.abs((screen.height-height)/2);
  return rueck;
}

//rootPfad +datei leer wenn HTML_Inhalt als Zeichenkette uebergegeben ist
function oeffneFenster (rootPfad, datei, Breite, Hoehe, HTML_Inhalt) {
/*function oeffneFenster (datei, Breite, Hoehe, HTML_Inhalt) {*/
  var posX=(screen.width-Breite)/2;
  var posY=(screen.height-Hoehe)/2;
  var arglist="width="+Breite+",height="+Hoehe+",resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no";
  if (is_nav) arglist=arglist + ",screenX="+posX+",screenY="+posY
  else if (is_ie) arglist=arglist + ",left="+posX+",top="+posY;
  Fenster = open(rootPfad+datei,"Fenstername",arglist);
/*  Fenster = open(datei,"Fenstername",arglist);*/
  //Fenster.moveTo(posX,posY);
  Fenster.focus();
  if (oeffneFenster.arguments.length==5)
  with (Fenster.document) {open(); write(HTML_Inhalt); close();}
  return true;
}
//-->
