	
		function replaceDot(input) {
			var input=new String(input);
          //Der Punkt statt dem Komma ist beim Preis deshalb nötig, da beim späteren Import
          //der Datensätze in Filemaker, die Feldunterscheidung durch Kommas vorgenommen wird und
          //Filemaker nicht wie sonst üblich die Felder anhand Hochkommata ('') unterscheidet.
          //var output=input.replace(/\./, ",");
            var output=input.replace(/\./, ".");
			return output;
		}
		
		function replaceComma(input) {
			var input=new String(input);
			var output=input.replace(/,/, "\.");
			return output;
		}
		
		function displayPrice(value) {
			var value=new String(value);
			string = replaceDot(value);
			string += " EUR";
			return string;
		}
		
		function calcPrice(string) {
			var string=new String(string);
			value = replaceComma(string);
			value = parseFloat(value);
			return value;
		}		
		
		function openPreview(name) {
			switch (name) {

				case "vase1": 	preview = window.open("", "preview", "resizable=no,width=400,height=600,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Vase blau</title></head><body background=bilder/kruege/vase_blau_gr.jpg></body></html>");
								break;			
											
				case "krug1": 	preview = window.open("", "preview", "resizable=no,width=400,height=550,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Krug blau</title></head><body background=bilder/kruege/krug_blau_gr.jpg></body></html>");
								break;

				case "vase2": 	preview = window.open("", "preview", "resizable=no,width=400,height=600,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Vase gelb</title></head><body background=bilder/kruege/vase_gelb_gr.jpg></body></html>");
								break;									

				case "krug2": 	preview = window.open("", "preview", "resizable=no,width=400,height=550,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Krug gelb</title></head><body background=bilder/kruege/krug_gelb_gr.jpg></body></html>");
								break;

				case "vase3": 	preview = window.open("", "preview", "resizable=no,width=400,height=600,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Vase beige</title></head><body background=bilder/kruege/vase_erdig_gr.jpg></body></html>");
								break;	
							

				case "krug3": 	preview = window.open("", "preview", "resizable=no,width=400,height=550,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Krug beige</title></head><body background=bilder/kruege/krug_erdig_gr.jpg></body></html>");
								break;
								
				case "backform3": 	preview = window.open("", "preview", "resizable=no,width=400,height=532,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Backform beige</title></head><body background=bilder/kruege/backform_erdig_gr.jpg></body></html>");
								break;	

				case "vorratsdose1": 	preview = window.open("", "preview", "resizable=no,width=421,height=476,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Vorratsdose beige</title></head><body background=bilder/kruege/vorratsdose_erdig_gr.jpg></body></html>");
								break;			

				case "vorratstopfgelb": 	preview = window.open("", "preview", "resizable=no,width=423,height=400,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Vorratstopf gelb</title></head><body background=bilder/kruege/vorratstopf_gelb_gr.jpg></body></html>");
								break;	
				case "vorratstopfblau": 	preview = window.open("", "preview", "resizable=no,width=426,height=381,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Vorratstopf blau</title></head><body background=bilder/kruege/vorratstopf_blau_gr.jpg></body></html>");
								break;	
				case "vorratstopfbeige": 	preview = window.open("", "preview", "resizable=no,width=423,height=438,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Vorratstopf beige</title></head><body background=bilder/kruege/vorratstopf_beige_gr.jpg></body></html>");
								break;			
				case "schalebeige": 	preview = window.open("", "preview", "resizable=no,width=450,height=268,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Schale beige</title></head><body background=bilder/kruege/schale_beige_gr.jpg></body></html>");
								break;		
				case "schalegelb": 	preview = window.open("", "preview", "resizable=no,width=450,height=300,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Schale gelb</title></head><body background=bilder/kruege/schale_gelb_gr.jpg></body></html>");
								break;	
				case "schaleblau": 	preview = window.open("", "preview", "resizable=no,width=450,height=249,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Schale blau</title></head><body background=bilder/kruege/schale_blau_gr.jpg></body></html>");
								break;			
			case "bechererdig": 	preview = window.open("", "preview", "resizable=no,width=400,height=335,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Becher beige</title></head><body background=bilder/kruege/becher_erdig_gr.jpg></body></html>");
								break;		
				case "bechergelb": 	preview = window.open("", "preview", "resizable=no,width=400,height=315,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Becher gelb</title></head><body background=bilder/kruege/becher_gelb_gr.jpg></body></html>");
								break;	
				case "becherblau": 	preview = window.open("", "preview", "resizable=no,width=400,height=323,toolbar=no,status=no,dependent=yes");
								preview.document.write("<html><head><title>EM-Becher blau</title></head><body background=bilder/kruege/becher_blau_gr.jpg></body></html>");
								break;											
			} 
		}
        
		function update() {
			form = document.bestellung;
				
			// Einzelpreise ausrechnen
			form.preisv1a.value=displayPrice(form.anzahlv1a.value * form.EPv1a.value);
			form.preisv1b.value=displayPrice(form.anzahlv1b.value * form.EPv1b.value);			
			form.preisv1c.value=displayPrice(form.anzahlv1c.value * form.EPv1c.value);
			form.preisv2a.value=displayPrice(form.anzahlv2a.value * form.EPv2a.value);
			form.preisv2b.value=displayPrice(form.anzahlv2b.value * form.EPv2b.value);			
			form.preisv2c.value=displayPrice(form.anzahlv2c.value * form.EPv2c.value);		
			form.preisv3a.value=displayPrice(form.anzahlv3a.value * form.EPv3a.value);
			form.preisv3b.value=displayPrice(form.anzahlv3b.value * form.EPv3b.value);			
			form.preisv3c.value=displayPrice(form.anzahlv3c.value * form.EPv3c.value);			
			form.preis1.value=displayPrice(form.anzahl1.value * form.EP1.value);
			form.preis2.value=displayPrice(form.anzahl2.value * form.EP2.value);
			form.preis3.value=displayPrice(form.anzahl3.value * form.EP3.value);
			form.preis4.value=displayPrice(form.anzahl4.value * form.EP4.value);
			form.preis5.value=displayPrice(form.anzahl5.value * form.EP5.value);
			form.preis6.value=displayPrice(form.anzahl6.value * form.EP6.value);
			form.preis7.value=displayPrice(form.anzahl7.value * form.EP7.value);
			form.preis8.value=displayPrice(form.anzahl8.value * form.EP8.value);
			form.preis9.value=displayPrice(form.anzahl9.value * form.EP9.value);
			form.preis10.value=displayPrice(form.anzahl10.value * form.EP10.value);
			form.preis11.value=displayPrice(form.anzahl11.value * form.EP11.value);
			form.preis12.value=displayPrice(form.anzahl12.value * form.EP12.value);
			form.preis13.value=displayPrice(form.anzahl13.value * form.EP13.value);
			form.preis14.value=displayPrice(form.anzahl14.value * form.EP14.value);
			form.preis15.value=displayPrice(form.anzahl15.value * form.EP15.value);
			form.preis16.value=displayPrice(form.anzahl16.value * form.EP16.value);
			form.preis17.value=displayPrice(form.anzahl17.value * form.EP17.value);
			form.preis18.value=displayPrice(form.anzahl18.value * form.EP18.value);
			form.preis19.value=displayPrice(form.anzahl19.value * form.EP19.value);
			form.preis20.value=displayPrice(form.anzahl20.value * form.EP20.value);															
			form.preis21.value=displayPrice(form.anzahl21.value * form.EP21.value);
			form.preis22.value=displayPrice(form.anzahl22.value * form.EP22.value);
			form.preis23.value=displayPrice(form.anzahl23.value * form.EP23.value);
			form.preis24.value=displayPrice(form.anzahl24.value * form.EP24.value);
			form.preis25.value=displayPrice(form.anzahl25.value * form.EP25.value);
			form.preis26.value=displayPrice(form.anzahl26.value * form.EP26.value);
			form.preis27.value=displayPrice(form.anzahl27.value * form.EP27.value);
			form.preis28.value=displayPrice(form.anzahl28.value * form.EP28.value);
			form.preis29.value=displayPrice(form.anzahl29.value * form.EP29.value);
			form.preis30.value=displayPrice(form.anzahl30.value * form.EP30.value);
			form.preis31.value=displayPrice(form.anzahl31.value * form.EP31.value);
			form.preis32.value=displayPrice(form.anzahl32.value * form.EP32.value);
			form.preis33.value=displayPrice(form.anzahl33.value * form.EP33.value);
			form.preisbf3.value=displayPrice(form.anzahlbf3.value * form.EPbf3.value);
			form.preisvd1.value=displayPrice(form.anzahlvd1.value * form.EPvd1.value);
			form.preisvt1.value=displayPrice(form.anzahlvt1.value * form.EPvt1.value);		
			form.preisvt2.value=displayPrice(form.anzahlvt2.value * form.EPvt2.value);	
			form.preisvt3.value=displayPrice(form.anzahlvt3.value * form.EPvt3.value);	
			form.preissl1.value=displayPrice(form.anzahlsl1.value * form.EPsl1.value);		
			form.preissl2.value=displayPrice(form.anzahlsl2.value * form.EPsl2.value);	
			form.preissl3.value=displayPrice(form.anzahlsl3.value * form.EPsl3.value);		
			form.preisbe1.value=displayPrice(form.anzahlbe1.value * form.EPbe1.value);		
			form.preisbe2.value=displayPrice(form.anzahlbe2.value * form.EPbe2.value);	
			form.preisbe3.value=displayPrice(form.anzahlbe3.value * form.EPbe3.value);					
						    	
			// Bereiche prŸfen für Versandkosten Kruege
			summeKrug = parseInt(form.anzahlv1a.value + form.anzahlv1b.value + form.anzahlv1c.value + form.anzahlv2a.value + form.anzahlv2b.value + form.anzahlv2c.value + form.anzahlv3a.value + form.anzahlv3b.value + form.anzahlv3c.value + form.anzahl1.value + form.anzahl2.value + form.anzahl3.value + form.anzahl4.value + form.anzahl5.value + form.anzahl6.value + form.anzahl7.value + form.anzahl8.value + form.anzahl9.value + form.anzahl10.value + form.anzahl11.value + form.anzahl12.value + form.anzahl13.value + form.anzahl14.value + form.anzahl15.value + form.anzahl16.value + form.anzahl17.value + form.anzahl18.value + form.anzahl19.value + form.anzahl20.value + form.anzahl21.value + form.anzahl22.value + form.anzahl23.value + form.anzahl24.value + form.anzahl25.value + form.anzahl26.value + form.anzahl27.value + form.anzahl28.value + form.anzahl29.value + form.anzahl30.value + form.anzahl31.value + form.anzahl32.value + form.anzahl33.value + form.anzahlbf3.value + form.anzahlvd1.value + form.anzahlvt1.value + form.anzahlvt2.value + form.anzahlvt3.value + form.anzahlsl1.value + form.anzahlsl2.value + form.anzahlsl3.value + form.anzahlbe1.value + form.anzahlbe2.value + form.anzahlbe3.value);
			// Versandkosten schalten (alte Version)
			//if (summeKrug > 0) {form.versandkosten1.value = displayPrice(form.versand1.value)}	
			//else {form.versandkosten1.value = displayPrice(0)}		
			
			//Versandkosten abhängig von der Anzahl der Krüge
			var kruganzahl = parseFloat(0);
			kruganzahl += calcPrice(form.anzahlv1a.value);
			kruganzahl += calcPrice(form.anzahlv1b.value);
			kruganzahl += calcPrice(form.anzahlv1c.value);
			kruganzahl += calcPrice(form.anzahlv2a.value);
			kruganzahl += calcPrice(form.anzahlv2b.value);
			kruganzahl += calcPrice(form.anzahlv2c.value);
			kruganzahl += calcPrice(form.anzahlv3a.value);
			kruganzahl += calcPrice(form.anzahlv3b.value);
			kruganzahl += calcPrice(form.anzahlv3c.value);			
			kruganzahl += calcPrice(form.anzahl1.value);
			kruganzahl += calcPrice(form.anzahl2.value);
			kruganzahl += calcPrice(form.anzahl3.value);
			kruganzahl += calcPrice(form.anzahl4.value);
			kruganzahl += calcPrice(form.anzahl5.value);
			kruganzahl += calcPrice(form.anzahl6.value);
			kruganzahl += calcPrice(form.anzahl7.value);
			kruganzahl += calcPrice(form.anzahl8.value);
			kruganzahl += calcPrice(form.anzahl9.value);
			kruganzahl += calcPrice(form.anzahl10.value);
			kruganzahl += calcPrice(form.anzahl11.value);
			kruganzahl += calcPrice(form.anzahl12.value);
			kruganzahl += calcPrice(form.anzahl13.value);
			kruganzahl += calcPrice(form.anzahl14.value);
			kruganzahl += calcPrice(form.anzahl15.value);
			kruganzahl += calcPrice(form.anzahl16.value);
			kruganzahl += calcPrice(form.anzahl17.value);
			kruganzahl += calcPrice(form.anzahl18.value);
			kruganzahl += calcPrice(form.anzahl19.value);
			kruganzahl += calcPrice(form.anzahl20.value);
			kruganzahl += calcPrice(form.anzahl21.value);
			kruganzahl += calcPrice(form.anzahl22.value);
			kruganzahl += calcPrice(form.anzahl23.value);
			kruganzahl += calcPrice(form.anzahl24.value);
			kruganzahl += calcPrice(form.anzahl25.value);
			kruganzahl += calcPrice(form.anzahl26.value);
			kruganzahl += calcPrice(form.anzahl27.value);
			kruganzahl += calcPrice(form.anzahl28.value);
			kruganzahl += calcPrice(form.anzahl29.value);
			kruganzahl += calcPrice(form.anzahl30.value);
			kruganzahl += calcPrice(form.anzahl31.value);
			kruganzahl += calcPrice(form.anzahl32.value);
			kruganzahl += calcPrice(form.anzahl33.value);
			kruganzahl += calcPrice(form.anzahlbf3.value);
			kruganzahl += calcPrice(form.anzahlvd1.value);
			kruganzahl += calcPrice(form.anzahlvt1.value);
			kruganzahl += calcPrice(form.anzahlvt2.value);
			kruganzahl += calcPrice(form.anzahlvt3.value);
			kruganzahl += calcPrice(form.anzahlsl1.value);
			kruganzahl += calcPrice(form.anzahlsl2.value);
			kruganzahl += calcPrice(form.anzahlsl3.value);
			kruganzahl += calcPrice(form.anzahlbe1.value);
			kruganzahl += calcPrice(form.anzahlbe2.value);
			kruganzahl += calcPrice(form.anzahlbe3.value);

			if (kruganzahl < 4) {form.versandkosten1.value = displayPrice(form.versand1.value)}
			else {form.versandkosten1.value = displayPrice(0)}
			if (kruganzahl > 3) {form.versandkosten1.value = displayPrice(form.versand2.value)}

			// Gesamtsumme
			var gesamtpreis = parseFloat(0);

			gesamtpreis += calcPrice(form.preisv1a.value);
			gesamtpreis += calcPrice(form.preisv1b.value);			
			gesamtpreis += calcPrice(form.preisv1c.value);
			gesamtpreis += calcPrice(form.preisv2a.value);
			gesamtpreis += calcPrice(form.preisv2b.value);			
			gesamtpreis += calcPrice(form.preisv2c.value);		
			gesamtpreis += calcPrice(form.preisv3a.value);
			gesamtpreis += calcPrice(form.preisv3b.value);			
			gesamtpreis += calcPrice(form.preisv3c.value);											
			gesamtpreis += calcPrice(form.preis1.value);
			gesamtpreis += calcPrice(form.preis2.value);
			gesamtpreis += calcPrice(form.preis3.value);
			gesamtpreis += calcPrice(form.preis4.value);
			gesamtpreis += calcPrice(form.preis5.value);
			gesamtpreis += calcPrice(form.preis6.value);
			gesamtpreis += calcPrice(form.preis7.value);
			gesamtpreis += calcPrice(form.preis8.value);
		    gesamtpreis += calcPrice(form.preis9.value);
		    gesamtpreis += calcPrice(form.preis10.value);
		    gesamtpreis += calcPrice(form.preis11.value);
		    gesamtpreis += calcPrice(form.preis12.value);
		    gesamtpreis += calcPrice(form.preis13.value);
		    gesamtpreis += calcPrice(form.preis14.value);
		    gesamtpreis += calcPrice(form.preis15.value);
			gesamtpreis += calcPrice(form.preis16.value);
			gesamtpreis += calcPrice(form.preis17.value);
			gesamtpreis += calcPrice(form.preis18.value);
			gesamtpreis += calcPrice(form.preis19.value);
			gesamtpreis += calcPrice(form.preis20.value);
			gesamtpreis += calcPrice(form.preis21.value);
			gesamtpreis += calcPrice(form.preis22.value);
			gesamtpreis += calcPrice(form.preis23.value);
			gesamtpreis += calcPrice(form.preis24.value);
			gesamtpreis += calcPrice(form.preis25.value);
			gesamtpreis += calcPrice(form.preis26.value);
			gesamtpreis += calcPrice(form.preis27.value);
			gesamtpreis += calcPrice(form.preis28.value);
			gesamtpreis += calcPrice(form.preis29.value);
			gesamtpreis += calcPrice(form.preis30.value);
			gesamtpreis += calcPrice(form.preis31.value);
			gesamtpreis += calcPrice(form.preis32.value);
			gesamtpreis += calcPrice(form.preis33.value);
			gesamtpreis += calcPrice(form.preisbf3.value);
			gesamtpreis += calcPrice(form.preisvd1.value);
			gesamtpreis += calcPrice(form.preisvt1.value);
			gesamtpreis += calcPrice(form.preisvt2.value);
			gesamtpreis += calcPrice(form.preisvt3.value);
			gesamtpreis += calcPrice(form.preissl1.value);
			gesamtpreis += calcPrice(form.preissl2.value);
			gesamtpreis += calcPrice(form.preissl3.value);
			gesamtpreis += calcPrice(form.preisbe1.value);
			gesamtpreis += calcPrice(form.preisbe2.value);
			gesamtpreis += calcPrice(form.preisbe3.value);
			
						
		//Versand Deutschland 
	   if (form.chooselocation[0].checked == true)
	   {            
		if (gesamtpreis < 120) form.versandkosten1.value = "11.00"; else form.versandkosten1.value = "0.00";
        } 
		//Versand Österreich 		 
	   if (form.chooselocation[1].checked == true)
	   {            
		if (kruganzahl < 4) form.versandkosten1.value = "17.00"; else form.versandkosten1.value = "17.00";					
        }
		//Versand Schweiz 		
	   if (form.chooselocation[2].checked == true)
	   {            
		if (kruganzahl < 4) form.versandkosten1.value = "30.00"; else form.versandkosten1.value = "30.00";					
        }   
	  			
			gesamtpreis += calcPrice(form.versandkosten1.value);

			form.bestellsumme.value=displayPrice(gesamtpreis);
			
			euro = gesamtpreis * 0.51129;
			euro = new String(euro);
			dezimal = euro.indexOf(".", 0);
			euro = euro.substr(0,(dezimal +2));
			euro = replaceDot(euro);
			euro += " Euro";
			form.bestellsummeeuro.value = euro;
		
		}
		
		f1=false
		function drucken()
		{
		if (f1 &&f1.closed==false)
		f1.close()
		f1=window.open("vorkasse.php", "", "width=600,height=400,scrollbars")
		}
