//////////////////////////////////////////////////////////////////// Weblication® CMS Shop// erstellt durch Scholl Communications AG, 77694 Kehl, www.scholl.de// erstellt mit Weblication® Content Management Server, www.weblication.de// Stand: Mai 2004////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Anzupassende Variablen://// Vorlage fuer den Kopf der Bestellungvar orderHeaderTpl = '<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="tdBorderBottom" width="30" align="center" valign="top">Menge</td><td class="tdBorderBottom" width="255" align="left" valign="top">Bezeichnung</td><td class="tdBorderBottom" align="right" valign="top" width="70">Preis</td><td class="tdBorderBottom" width="70" bgcolor="#F0F0F0" align="right" valign="top">Gesamt</td><td class="tdBorderBottom" align="right" style="text-align:right;padding:8px;"><a href="javascript:clearBasket();location.reload();" title="Bestell-Liste löschen"><img src="/haus/prospektcenter/wGui/img/loeschen.gif" title="Bestell-Liste löschen" alt="Bestell-Liste löschen" border="0" style="border-style:solid;border-width:1px;border-color:#000000;"></a></td></tr>';//// Zeilenvorlage eines Produktes in der Bestellungvar orderProductTpl  = '<tr><td class="tdBorderBottom" width="30" align="center" valign="top"><input type="text" name="productAmount" value="$amount" onBlur="setProduct(\'$productId\', this.value,\'$productUrlName\',\'\');" style="width:32px;text-align:right;padding-right:2px"></td><td class="tdBorderBottom" width="255" align="left" valign="top">$productName</td><td class="tdBorderBottom" align="right" valign="top" width="70">$price €</td><td class="tdBorderBottom" width="70" bgcolor="#F0F0F0" align="right" valign="top">$sum €</td><td class="tdBorderBottom" align="right" valign="top" width="35"><input type="hidden" name="product_$productName_$productId" value="(Art.Nr. $productId) $productThumbnail $productPublisher $amount Stueck à $price = $sum"><table cellpadding="4" cellspacing="0" border="0"><tr><td><a class="textDecorationNone" href="javascript:addProduct(\'$productId\',\'1\',\'$productUrlName\',\'\');" title="Menge erhöhen"><img src="/haus/prospektcenter/wGui/img/plus.gif" title="Menge erhöhen" alt="Menge erhöhen" border="0" style="border-style:solid;border-width:1px;border-color:#000000;"></a></td><td><a class="textDecorationNone" href="javascript:removeProduct(\'$productId\',\'1\',\'$productUrlName\',\'\');" title="Menge verringern"><img src="/haus/prospektcenter/wGui/img/minus.gif" title="Menge verringern" alt="Menge verringern" border="0" style="border-style:solid;border-width:1px;border-color:#000000;"></a></td><td><a class="textDecorationNone" href="javascript:clearProduct(\'$productId\');" title="Produkt löschen"><img src="/haus/prospektcenter/wGui/img/loeschen.gif" title="Produkt löschen" alt="Produkt löschen" border="0" style="border-style:solid;border-width:1px;border-color:#000000;"></a></td></tr></table></td></tr>';//// Vorlage fuer die Summe der Bestellung/*var orderSumNettoTpl = '<tr><td class="tdBorderBottom" class="text">&nbsp;</td><td class="tdBorderBottom">Summe Netto</td><td class="tdBorderBottom">&nbsp;</td><td bgcolor="#F0F0F0" align="right" class="tdBorderBottom">$ordersum €<input type="hidden" name="orderSum" value="$ordersum"></td><td class="tdBorderBottom">&nbsp;</td></tr>';*/var orderSumNettoTpl = '';//// Vorlage fuer die Summe der Mehrwertsteuer/*var orderSumTaxTpl = '<tr><td>&nbsp;</td><td align="left" >enthaltene 19% MwSt.</td><td></td><td bgcolor="#F0F0F0" align="right" style="padding-right:4px;">$ordersumtax €<input type="hidden" name="orderSumTax" value="$ordersumtax"></td><td>&nbsp;</td></tr>';*/var orderSumTaxTpl = '';//// Vorlage fuer die Summe der Bestellung/*var orderSumBruttoTpl = '<tr><td class="tdBorderBottom">&nbsp;</td><td align="left" class="tdBorderBottom" style="padding-top:16px;">Gesamtbetrag (inkl. MwSt.)</td><td class="tdBorderBottom">&nbsp;</td><td class="tdBorderBottom" align="right" bgcolor="#CCCCCC" style="padding-top:16px;">$ordersum €<input type="hidden" name="orderSum" value="$ordersum"></td><td class="tdBorderBottom">&nbsp;</td></tr>';*/var orderSumBruttoTpl = '';//// Vorlage fuer den Fuss der Bestellungvar orderFooterTpl  = '<tr align="left" valign="top"><td colspan="5">&nbsp;</td></tr><tr align="left" valign="top"><td colspan="6"></td></tr></table>';//// Sind Preise Brutto [0|1] (0=Nettopreise, 1=Bruttopreise)var productPricesBrutto = 1;//// Mindestbestellwertvar minOrderValue = 0;//// Ausgabe Mindestbestellwertvar minOrderTpl   = '<span style="color:#FF0000;">Der Mindestbestellwert beträgt ' + minOrderValue + ',00 €!</span><br><br>';//// Ausgabe Mindestbestellwert in JavaScript Dialogfenster var minOrderAlert = 'Der Mindestbestellwert beträgt ' + minOrderValue + ',00 €!';//// Versandkostenmatrix           (Versandkosten, Wertuntergrenze, Wertobergrenze)var freightCharges    = new Array()    freightCharges[0] = new Array(5.95         ,  0              , 20);    freightCharges[1] = new Array(3.95         , 20              , 50);    freightCharges[2] = new Array(0            , 50              , 999999);//// Ausgabe Versandkosten/*var freightChargesTpl = '<tr><td class="tdBorderBottom">&nbsp;</td><td align="left" class="tdBorderBottom">Versandkosten</td><td class="tdBorderBottom">&nbsp;</td><td class="tdBorderBottom" align="right" bgcolor="#F0F0F0">$freightCharges €</td><td class="tdBorderBottom">&nbsp;</td></tr>';*/var freightChargesTpl = '';//// Mehrwehrtsteuersatz in Prozentvar taxValuePercent = 19;//// Anzeige von Preisen ohne Nachkommaangabevar stringNoCent = ".00";//// Kleinster Wert auf den bei der MwSt gerundet werden sollvar roundValue = 0.01;////erscheint wenn ein Pflichtfeld nicht ausgefüllt wurdevar messageObligation = " ist ein Pflichtfeld!\n"; ////Id des Shopsvar shopId = 'bc';//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Globale Variablen (nicht ändern)////////////////////////////////////////////////////////////////////var isMinOrderValue = "";////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Beschreibung: Zeigt den Inhalt der Bestell-Liste an//////////////////////////////////////////////////////////////////function showProducts(){  showBasketInfo();}//////////////////////////////////////////////////////////////////// Beschreibung: Zeigt den Inhalt der Bestell-Liste an//////////////////////////////////////////////////////////////////function getBasketInfo(info){  return showBasketInfo(info, 'return');}//////////////////////////////////////////////////////////////////// Beschreibung: Zeigt Informationen zur Bestell-Liste an//////////////////////////////////////////////////////////////////  function showBasketInfo(info, option){    var productStr = getCookie(shopId);    var productRowTmp;    var numberProducts = 0;    var numberProductsTimeout = 64;    if(! info){      info = "";    }          var entry = productStr;      var productId      = "";    var productName    = "";    var productUrlName = "";    var productThumbnail   = "";    var productPublisher   = "";    var productCategory   = "";    var productType   = "";    var productAmount  = 1;    var productPrice   = 0;        var productSum     = 0;    var orderSum       = 0;    var orderSumNetto  = 0;    var orderSumBrutto = 0;        var orderSumTax    = 0;    var productPricePrint = 0;    var productSumPrint = 0;    var i = 0;    var products = productStr.split('~~~');        if(info == "" && products.length > 1){                            document.write(orderHeaderTpl);        }        for(var i = products.length - 1; i >= 0; i--){      if(products[i] != ''){        entry      = products[i].replace(/p:/, '');            //alert(entry);                productId     = entry.replace(/^([^\~]+)\~___.*/, '$1');        if(productId == entry){          productId = "";        }        productAmount = entry.replace(/.*\~___([^\~]+)\~__-.*/, '$1');            if(productAmount == entry){          productAmount = "";        }                      productName   = entry.replace(/.*\~__-([^\~]+)\~#%#.*/, '$1');        if(productName == entry){          productName = "";        }        else        {         productName = productName.replace('%26','&');        }                   productUrlName   = entry.replace(/.*\~__-([^\~]+)\~#%#.*/, '$1');        if(productUrlName == entry){          productUrlName = "";        }         else        {         productUrlName = escape(productUrlName);         productUrlName = productUrlName.replace('%27','\\\'');        }                productPrice  = entry.replace(/.*\~#%#([^\~]+)\~_--.*/, '$1');            if(productPrice == entry){          productPrice = "";        }				        productThumbnail  = entry.replace(/.*\~_--([^\~]+)\~-_-.*/, '$1');            if(productThumbnail == entry){          productThumbnail = "";        }         else        {         productThumbnail = escape(productThumbnail);         productThumbnail = productThumbnail.replace('%27','\\\'');        }				        productPublisher  = entry.replace(/.*\~-_-([^\~]+)\~--_.*/, '$1');            if(productPublisher == entry){          productPublisher = "";        } 				productCategory  = entry.replace(/.*\~--_([^\~]+)\~##%.*/, '$1');            if(productCategory == entry){          productCategory = "";        } else {          productCategory  = productCategory.replace("Ã¼", "&uuml;");					productCategory= "Gewerk: "+productCategory+"<br />";				} 								productType  = entry.replace(/.*\~##%([^\~]+)\~---.*/, '$1');            if(productType == entry){          productType = "";        } else {					productType= "Typ: "+productType+"<br />";				}				        if(productPrice != ""){          productPrice  = productPrice.replace(/\,/, ".");          productPrice  = Math.round(parseFloat(productPrice)* 100)/100;          productSum    = Math.round(productPrice * parseFloat(productAmount) * 100)/100;;        }                if(entry != "" && productPrice.toString() != ""){          productPricePrint  = convertPrice(productPrice);              productSumPrint    = convertPrice(productSum);                  productRowTmp = orderProductTpl.replace(/\$productId/g, productId);          productRowTmp = productRowTmp.replace(/\$productName/g, productName);          productRowTmp = productRowTmp.replace(/\$productUrlName/g, productUrlName);          productRowTmp = productRowTmp.replace(/\$amount/g, productAmount);          productRowTmp = productRowTmp.replace(/\$price/g, productPricePrint);          productRowTmp = productRowTmp.replace(/\$sum/g, productSumPrint);              productRowTmp = productRowTmp.replace(/\$productThumbnail/g, productThumbnail);           productRowTmp = productRowTmp.replace(/\$productPublisher/g, productPublisher);               productRowTmp = productRowTmp.replace(/\$productCategory/g, productCategory);               productRowTmp = productRowTmp.replace(/\$productType/g, productType);               if(info == ""){                                document.write(productRowTmp);          }            orderSum += productSum;          if(entry != ""){            numberProducts += parseInt(productAmount);          }                      }            }    }         if(productPricesBrutto == 0){      checkMinOrderValue(orderSum * (100 + taxValuePercent) / 100);      if(info == "" && orderSum != 0){          if(freightCharges.length != -1){          orderSum = orderSum + getFreightCharge(orderSum);        }        }      orderSumNetto = orderSum;      orderSumNetto = convertPrice(orderSumNetto);          orderSumNettoTpl = orderSumNettoTpl.replace(/\$ordersum/g, orderSumNetto);       orderSumTax = orderSum * taxValuePercent / 100;      orderSumTax = convertPrice(orderSumTax);      orderSumTaxTpl = orderSumTaxTpl.replace(/\$ordersumtax/g, orderSumTax);                  orderSumBrutto = orderSum * (100 + taxValuePercent) / 100;      orderSumBrutto = convertPrice(orderSumBrutto);          orderSumBruttoTpl = orderSumBruttoTpl.replace(/\$ordersum/g, orderSumBrutto);          if(info == ""){              if(orderSum != 0){          document.write(getFreightChargesTpl(orderSum));          }        document.write(orderSumNettoTpl);            document.write(orderSumBruttoTpl);        document.write(orderSumTaxTpl);         }      }    else{      checkMinOrderValue(orderSum);      var freightChargesTemplate = getFreightChargesTpl(orderSum);      if(info == "" && orderSum != 0){         if(freightCharges.length != -1){          orderSum = orderSum + getFreightCharge(orderSum);        }      }      orderSumTax = orderSum / (100 + taxValuePercent) * taxValuePercent;      orderSumTax = convertPrice(orderSumTax);      orderSumTaxTpl = orderSumTaxTpl.replace(/\$ordersumtax/g, orderSumTax);                  orderSumBrutto = orderSum;      orderSumBrutto = convertPrice(orderSumBrutto);          orderSumBruttoTpl = orderSumBruttoTpl.replace(/\$ordersum/g, orderSumBrutto);          if(info == ""){         if(orderSum != 0){             document.write(freightChargesTemplate);         }           document.write(orderSumBruttoTpl);        document.write(orderSumTaxTpl);          }      }            if(info == ""){                            document.write(orderFooterTpl);      if(isMinOrderValue == false){        document.write(minOrderTpl);      }      }      else if(info == "numberProducts"){          if(option == "return"){                          return numberProducts;      }      else{        document.write(numberProducts);            }      }          else if(info == "sumBrutto"){                            if(option == "return"){                          return orderSumBrutto;      }      else{        document.write(orderSumBrutto);            }            }  }     function getProductsInCart(){    var productStr = getCookie(shopId);    var productRowTmp;    var numberProducts = 0;    var numberProductsTimeout = 64;       var entry = productStr;      var productId      = "";    var productName    = "";    var productUrlName = "";    var productThumbnail   = "";    var productPublisher   = "";    var productCategory   = "";    var productType   = "";    var productAmount  = 1;    var productPrice   = 0;        var productSum     = 0;    var orderSum       = 0;    var orderSumNetto  = 0;    var orderSumBrutto = 0;        var orderSumTax    = 0;    var productPricePrint = 0;    var productSumPrint = 0;    var i = 0;    var products = productStr.split('~~~');    productArray = new Array();          for(var i = products.length - 1; i >= 0; i--){      if(products[i] != ''){        entry      = products[i].replace(/p:/, '');            //alert(entry);                productId     = entry.replace(/^([^\~]+)\~___.*/, '$1');        if(productId == entry) {          productId = "";        }       if(productId != "") { productArray.push(productId); }    }  }  return productArray;}            //////////////////////////////////////////////////////////////////// Beschreibung: Gibt Anzahl der Produkte aus//////////////////////////////////////////////////////////////////  function showProductQuantity(){    var productStr = getCookie(shopId);    var products = productStr.split('~~~');        return products.length;  }          //////////////////////////////////////////////////////////////////// Beschreibung: Konvertiert die Preise//////////////////////////////////////////////////////////////////      function convertPrice(price){    price = Math.round(price * 100)/100;          if(parseInt(roundValue) != 0){      var convertedRoundValue = 1 / roundValue;      price = parseInt(price * convertedRoundValue + 0.5) / convertedRoundValue;    }    var priceInt = parseInt(price);        if(price == priceInt){      price += stringNoCent;          return price;    }       var testPrice = /\.(\d+)$/;    testPrice.test(price);    var result = RegExp.$1;    if(result == ""){      price += stringNoCent;    }    else if(result.length == 1){      price += "0";    }    return price;  }  //////////////////////////////////////////////////////////////////// Beschreibung: Fuegt ein neues Produkt zur Bestell-Liste hinzu//////////////////////////////////////////////////////////////////  function addProduct (productId, productAmount, productName, productPrice, productThumbnail, productPublisher, productCategory, productType){      var productStr = getCookie(shopId);    productName = productName.replace('%27','\'');		productName = productName.replace(/\+/gi,' ');        if(!productThumbnail){      productThumbnail = '';    }    if(!productPublisher){      productPublisher = '';    }    if(!productCategory){      productCategory = '';    }    if(!productType){      productType = '';    }        if(isNaN(productAmount) == true || productAmount < 1){      return;    }        var regExpStr;    var existsProduct = new RegExp(":" + productId + "~___");    if(existsProduct.test(productStr) == true){			//entfernen, wenn Menge eines Artikels groeßer als 1 sein soll			alert("Sie haben diesen Prospekt schon in der Bestell-Liste (s. rechts oben)!");			return void(0);			//aktivieren, wenn Menge eines Artikels groeßer als 1 sein soll      var numberProductsBasket    = productStr.replace(":" + productId + "~___", ":~~~~~~~~");      numberProductsBasket    = numberProductsBasket.replace(/.*\~\~\~\~\~\~\~\~/, "");          numberProductsBasket    = numberProductsBasket.replace(/^(\d+).*/, '$1');              var numberProductsBasketNew = parseInt(numberProductsBasket) + parseInt(productAmount);      productStr       = productStr.replace(":" + productId + "~___", ":~~~~~~~~");      var dollar1      = productStr.replace(/\~\~\~\~\~\~\~\~(\d+).*$/, '');      productStr       = productStr.replace(/(.*)\~\~\~\~\~\~\~\~(\d+)/, dollar1 + productId + "~___" +  numberProductsBasketNew);      setProducts(productStr);     }    else{      var productsFirst = new RegExp("p:");      if(productsFirst.test(productStr) == true){        productStr = "p:" + productId + "~___" + productAmount + "~__-" + productName + "~#%#" + productPrice + "~_--" + productThumbnail + "~-_-" + productPublisher + "~--_" + productCategory + "~##%" + productType + "~---" + "~~~" + productStr;      }      else{        productStr = "p:" + productId + "~___" + productAmount + "~__-" + productName + "~#%#" + productPrice + "~_--" + productThumbnail + "~-_-" + productPublisher + "~--_" + productCategory + "~##%" + productType + "~---" + "~~~";            }           setProducts(productStr);    }    alert('Prospekt zur Bestell-Liste hinzugefügt (s. rechts oben).');    document.location.reload();  }  // !ADD PRODUCT  function addProductModified (productId, productAmount, productName, productPrice, productThumbnail, productPublisher, productCategory, productType){      var productStr = getCookie(shopId);    productName = productName.replace('%27','\'');	productName = productName.replace(/\+/gi,' ');        if(!productThumbnail){      productThumbnail = '';    }    if(!productPublisher){      productPublisher = '';    }    if(!productCategory){      productCategory = '';    }    if(!productType){      productType = '';    }        if(isNaN(productAmount) == true || productAmount < 1){      return;    }        var regExpStr;    var existsProduct = new RegExp(":" + productId + "~___");    if(existsProduct.test(productStr) == true){			//entfernen, wenn Menge eines Artikels groeßer als 1 sein soll			// alert("Sie haben diesen Prospekt schon in der Bestell-Liste (s. rechts oben)!");			return void(0);			//aktivieren, wenn Menge eines Artikels groeßer als 1 sein soll      var numberProductsBasket    = productStr.replace(":" + productId + "~___", ":~~~~~~~~");      numberProductsBasket    = numberProductsBasket.replace(/.*\~\~\~\~\~\~\~\~/, "");          numberProductsBasket    = numberProductsBasket.replace(/^(\d+).*/, '$1');              var numberProductsBasketNew = parseInt(numberProductsBasket) + parseInt(productAmount);      productStr       = productStr.replace(":" + productId + "~___", ":~~~~~~~~");      var dollar1      = productStr.replace(/\~\~\~\~\~\~\~\~(\d+).*$/, '');      productStr       = productStr.replace(/(.*)\~\~\~\~\~\~\~\~(\d+)/, dollar1 + productId + "~___" +  numberProductsBasketNew);      setProducts(productStr);     }    else{      var productsFirst = new RegExp("p:");      if(productsFirst.test(productStr) == true){        productStr = "p:" + productId + "~___" + productAmount + "~__-" + productName + "~#%#" + productPrice + "~_--" + productThumbnail + "~-_-" + productPublisher + "~--_" + productCategory + "~##%" + productType + "~---" + "~~~" + productStr;      }      else{        productStr = "p:" + productId + "~___" + productAmount + "~__-" + productName + "~#%#" + productPrice + "~_--" + productThumbnail + "~-_-" + productPublisher + "~--_" + productCategory + "~##%" + productType + "~---" + "~~~";            }           setProducts(productStr);    }    // alert('Prospekt zur Bestell-Liste hinzugefügt (s. rechts oben).');    // document.location.reload();    $("#picture_"+productId).effect('transfer',{ to: "#cartInfo", className: 'ui-effects-transfer'},700,'');    p = showProductQuantity();    if(p == 1) {     	$("#inline").html('Prospektauswahl treffen bzw. verändern');     	$("#bestellliste_text_prospekte").text('Sie haben noch keine Prospekte gewählt.');	 } else if(p > 1) {	 	$("#inline, #inline2").html('Prospektauswahl (<span class="productQuantity">'+(p-1)+'</span>) einblenden bzw. verändern');	 	$("#bestellliste_text_prospekte").text('Ihre für die Bestellung gewählten Prospekte:');	 	// showProducts();	 }        // $(".productQuantity").text(p-1);    // $("#buttons_product_"+productId+" > .buttonAddToCart").fadeOut('slow');    // $("#buttons_product_"+productId+" > .buttonInCart").fadeIn('slow');    // $("#buttons_product_"+productId+" > .buttonDeleteFromCart").fadeIn('slow');    // alert(productId);    // $("#product_"+productId).fadeIn();        showProductsInBasket();  }//////////////////////////////////////////////////////////////////// Beschreibung: Setzt eine bestimmte Anzahl eines Produktes//////////////////////////////////////////////////////////////////  function setProduct (productId, productAmount, productName, productPrice, productThumbnail, productPublisher, productCategory, productType){      var productStr = getCookie(shopId);    productName = productName.replace('%27','\'');        var regExpStr;    var existsProduct = new RegExp(":" + productId + "~___");    if(existsProduct.test(productStr) == true){			//entfernen, wenn Menge eines Artikels groeßer als 1 sein soll			alert("Sie haben dieses Prospekt schon in der Bestell-Liste");			return void(0);			//aktivieren, wenn Menge eines Artikels groeßer als 1 sein soll      var numberProductsBasket    = productStr.replace(":" + productId + "~___", ":~~~~~~~~");      numberProductsBasket    = numberProductsBasket.replace(/.*\~\~\~\~\~\~\~\~/, "");      numberProductsBasket    = numberProductsBasket.replace(/^(\d+).*/, '$1');                var numberProductsBasketNew = parseInt(productAmount);      productStr       = productStr.replace(":" + productId + "~___", ":~~~~~~~~");      var dollar1      = productStr.replace(/\~\~\~\~\~\~\~\~(\d+).*$/, '');      productStr       = productStr.replace(/(.*)\~\~\~\~\~\~\~\~(\d+)/, dollar1 + productId + "~___" +  numberProductsBasketNew);      setProducts(productStr);    }    else{      var productsFirst = new RegExp("p:");      if(productsFirst.test(productStr) == true){        productStr = "p:" + productId + "~___" + productAmount + "~__-" + productName + "~#%#" + productPrice + "~_--" + productThumbnail + "~-_-" + productPublisher + "~--_" + productCategory + "~##%" + productType + "~---" + "~~~" + productStr;      }      else{        productStr = "p:" + productId + "~___" + productAmount + "~__-" + productName + "~#%#" + productPrice + "~_--" + productThumbnail + "~-_-" + productPublisher + "~--_" + productCategory + "~##%" + productType + "~---" + "~~~";            }      setProducts(productStr);    }    document.location.reload();  }    //////////////////////////////////////////////////////////////////// Beschreibung: Entfernt eine bestimmte Anzahl eines Produktes aus der Bestell-Liste//////////////////////////////////////////////////////////////////  function removeProduct (productId, productAmount){      var productStr = getCookie(shopId);    var regExpStr;    var existsProduct = new RegExp(":" + productId + "~___");        if(existsProduct.test(productStr) == true){      productAmount    = productStr.replace(":" + productId + "~___", ":~~~~~~~~");      productAmount    = productAmount.replace(/.*\~\~\~\~\~\~\~\~/, "");      productAmount    = productAmount.replace(/^(\d+).*/, '$1');                var productAmountNew = productAmount * 2;      productAmountNew = productAmountNew/2-1;      if(productAmountNew > 0){        productStr       = productStr.replace(":" + productId + "~___", ":~~~~~~~~");        var dollar1      = productStr.replace(/\~\~\~\~\~\~\~\~(\d+).*$/, '');        productStr       = productStr.replace(/(.*)\~\~\~\~\~\~\~\~(\d+)/, dollar1 + productId + "~___" +  productAmountNew);      }      else{                              productStr       = productStr.replace(":" + productId + "~___", "~~~~~~~~");              productStr       = productStr.replace(/p\~\~\~\~\~\~\~\~[^:]*\~\~\~/ , "");      }            setProducts(productStr);      document.location.reload();    }  }//////////////////////////////////////////////////////////////////// Beschreibung: Entfernt ein Produkt aus der Bestell-Liste//////////////////////////////////////////////////////////////////  function clearProduct (productId){      var productStr = getCookie(shopId);    var regExpStr;    var existsProduct = new RegExp(":" + productId + "~___");        if(existsProduct.test(productStr) == true){      productStr       = productStr.replace(":" + productId + "~___", "~~~~~~~~");            productStr       = productStr.replace(/p\~\~\~\~\~\~\~\~[^:]*\~\~\~/ , "");    }          setProducts(productStr);	document.location.reload();  }          function clearProductModified (productId) {  	    var productStr = getCookie(shopId);	    var regExpStr;	    var existsProduct = new RegExp(":" + productId + "~___");	    	    if(existsProduct.test(productStr) == true) {	      productStr       = productStr.replace(":" + productId + "~___", "~~~~~~~~");      	      productStr       = productStr.replace(/p\~\~\~\~\~\~\~\~[^:]*\~\~\~/ , "");	    }	    	    setProducts(productStr);		$("#cartInfo").effect('transfer',{ to: "#picture_"+productId, className: 'ui-effects-transfer'},700,'');	    p = showProductQuantity();	    $(".productQuantity").text(p-1);	    $("#buttons_product_"+productId+" > .buttonAddToCart").fadeIn('slow');	    $("#buttons_product_"+productId+" > .buttonInCart").fadeOut('slow');	    $("#buttons_product_"+productId+" > .buttonDeleteFromCart").fadeOut('slow');	    	    $("#product_"+productId).fadeOut();	    $("#input_product_"+productId).attr('name', 'not_in_basket_'+productId);	    	    p = showProductQuantity();		if(p > 1) {			$("#bestellliste_text_prospekte").text('Ihre für die Bestellung gewählten Prospekte:');		} else {			$("#bestellliste_text_prospekte").text('Sie haben noch keine Prospekte gewählt.');		}	    	    // alert(productId);		// document.location.reload();  }    //////////////////////////////////////////////////////////////////// Beschreibung: Schreibt die Bestell-Liste//////////////////////////////////////////////////////////////////  function setProducts (productStr){  document.cookie = shopId + "=" + productStr + "; path=/;";}//////////////////////////////////////////////////////////////////// Beschreibung: Loescht die Bestell-Liste//////////////////////////////////////////////////////////////////  function clearBasket (){    document.cookie = shopId + "=; path=/;";}function clearBasketModified (){    document.cookie = shopId + "=; path=/;";}  //////////////////////////////////////////////////////////////////// Beschreibung: Sendet die Bestellung// // Parameter: form = Formular, das gesendet werden soll.//////////////////////////////////////////////////////////////////function submitOrder(form, cacheMode){    if(isMinOrderValue == false){    alert(minOrderAlert);    return;  }  	if(!form.productAmount){	 alert ("Die Bestell-Liste ist leer!");	 return false;	}    var messageEmail      = " enthält keine gültige Email Adresse!\n"; //erscheint wenn ein Pflichtfeld nicht ausgefüllt wurde  var isObligation = /\|\w*o\w*$/i;  //Pflichtfeld, wenn Feldname am Schluss |o  enthaelt   (z.B.: "Strasse|o")  var isEmail      = /\|\w*e\w*$/i;  //Emailfeld wenn Feldname am Schluss |e enthaelt       (z.B.: "eMail|e")  var isCache      = /\|\w*c\w*$/i;  //Wird fuer weitere Formulare gespeichert am Schluss |c enthaelt       (z.B.: "eMail|c")                    //Pflicht- und Emailfeld, wenn am Schluss |oe oder |eo (z.B.: "eMail|eo")   var checkEmail   = /.*\@.*\.\w+/i;  var formElement;  var formElementNameOrig;  var alertStr = "";  var cookieStr = "";  for(var i = 0; i <= form.elements.length - 1; i++){    var formElement = form.elements[i];    if(formElement){      if(formElement.type == "text" || formElement.type == "textarea"){        formElementNameOrig = formElement.name.replace(/\|\w+/, '');         if(isObligation.test(formElement.name) == true){            if(formElement.value == ""){            alertStr += formElementNameOrig + messageObligation;                               }        }         if(isEmail.test(formElement.name) == true){            if (checkEmail.test(formElement.value) == false){            alertStr += formElementNameOrig + messageEmail;                               }        }        if(cacheMode == "1"){                  if(isCache.test(formElement.name) == true){             if(formElement.value != ""){              cookieStr += "wFc_" + formElementNameOrig + "=" + formElement.value + ":";            }          }                }                }      else if(formElement.type == "checkbox"){        formElementNameOrig = formElement.name.replace(/\|\w+/, '');           if(isObligation.test(formElement.name) == true){            if(formElement.checked == false){            alertStr += formElementNameOrig + messageObligation;                               }        }       }    }  }  if(alertStr != ""){    alert(alertStr);    }  else{    if(cacheMode == "1"){            cookieStr += "; path=/";          document.cookie = cookieStr;      }    clearBasket();    form.submit();  }}function submitOrderMod(form, cacheMode){    	// !BESTELLUNG ABSENDEN  	p = showProductQuantity();  	  	if(form.angebot_massivhaus.checked == false && form.finanzierungsangebot.checked == false && form.beratung.checked == false && form.Newsletter.checked == false && p < 2) {  		alert('Bitte wählen Sie zu bestellende Prospekte oder geben Sie ein Interesse an.');  		return false;  	}  	  	/*	if(p < 2){	 alert ("Die Bestell-Liste ist leer!");	 return false;	}	*/    var messageEmail      = " enthält keine gültige Email Adresse!\n"; //erscheint wenn ein Pflichtfeld nicht ausgefüllt wurde  var isObligation = /\|\w*o\w*$/i;  //Pflichtfeld, wenn Feldname am Schluss |o  enthaelt   (z.B.: "Strasse|o")  var isEmail      = /\|\w*e\w*$/i;  //Emailfeld wenn Feldname am Schluss |e enthaelt       (z.B.: "eMail|e")  var isCache      = /\|\w*c\w*$/i;  //Wird fuer weitere Formulare gespeichert am Schluss |c enthaelt       (z.B.: "eMail|c")                    //Pflicht- und Emailfeld, wenn am Schluss |oe oder |eo (z.B.: "eMail|eo")   var checkEmail   = /.*\@.*\.\w+/i;  var formElement;  var formElementNameOrig;  var alertStr = "";  var cookieStr = "";  for(var i = 0; i <= form.elements.length - 1; i++){    var formElement = form.elements[i];    if(formElement){      if(formElement.type == "text" || formElement.type == "textarea"){        formElementNameOrig = formElement.name.replace(/\|\w+/, '');         if(isObligation.test(formElement.name) == true){            if(formElement.value == ""){            alertStr += formElementNameOrig + messageObligation;                               }        }         if(isEmail.test(formElement.name) == true){            if (checkEmail.test(formElement.value) == false){            alertStr += formElementNameOrig + messageEmail;                               }        }        if(cacheMode == "1"){                  if(isCache.test(formElement.name) == true){             if(formElement.value != ""){              cookieStr += "wFc_" + formElementNameOrig + "=" + formElement.value + ":";            }          }                }                }      else if(formElement.type == "checkbox"){        formElementNameOrig = formElement.name.replace(/\|\w+/, '');           if(isObligation.test(formElement.name) == true){            if(formElement.checked == false){            alertStr += formElementNameOrig + messageObligation;                               }        }       }    }  }  if(alertStr != ""){    alert(alertStr);    }  else{    if(cacheMode == "1"){            cookieStr += "; path=/";          document.cookie = cookieStr;      }    clearBasket();    form.submit();  }}function submitOrderModThermo(form, cacheMode){    	// !BESTELLUNG ABSENDEN  	  	if(form.thermografie.checked == false) {  		alert('Bitte bestellen Sie eine Gebäudethermografie.');  		return false;  	}  	  	/*	if(p < 2){	 alert ("Die Bestell-Liste ist leer!");	 return false;	}	*/    var messageEmail      = " enthält keine gültige Email Adresse!\n"; //erscheint wenn ein Pflichtfeld nicht ausgefüllt wurde  var isObligation = /\|\w*o\w*$/i;  //Pflichtfeld, wenn Feldname am Schluss |o  enthaelt   (z.B.: "Strasse|o")  var isEmail      = /\|\w*e\w*$/i;  //Emailfeld wenn Feldname am Schluss |e enthaelt       (z.B.: "eMail|e")  var isCache      = /\|\w*c\w*$/i;  //Wird fuer weitere Formulare gespeichert am Schluss |c enthaelt       (z.B.: "eMail|c")                    //Pflicht- und Emailfeld, wenn am Schluss |oe oder |eo (z.B.: "eMail|eo")   var checkEmail   = /.*\@.*\.\w+/i;  var formElement;  var formElementNameOrig;  var alertStr = "";  var cookieStr = "";  for(var i = 0; i <= form.elements.length - 1; i++){    var formElement = form.elements[i];    if(formElement){      if(formElement.type == "text" || formElement.type == "textarea"){        formElementNameOrig = formElement.name.replace(/\|\w+/, '');         if(isObligation.test(formElement.name) == true){            if(formElement.value == ""){            alertStr += formElementNameOrig + messageObligation;                               }        }         if(isEmail.test(formElement.name) == true){            if (checkEmail.test(formElement.value) == false){            alertStr += formElementNameOrig + messageEmail;                               }        }        if(cacheMode == "1"){                  if(isCache.test(formElement.name) == true){             if(formElement.value != ""){              cookieStr += "wFc_" + formElementNameOrig + "=" + formElement.value + ":";            }          }                }                }      else if(formElement.type == "checkbox"){        formElementNameOrig = formElement.name.replace(/\|\w+/, '');           if(isObligation.test(formElement.name) == true){            if(formElement.checked == false){            alertStr += formElementNameOrig + messageObligation;                               }        }       }    }  }  if(alertStr != ""){    alert(alertStr);    }  else{    if(cacheMode == "1"){            cookieStr += "; path=/";          document.cookie = cookieStr;      }    clearBasket();    form.submit();  }}//////////////////////////////////////////////////////////////////// Beschreibung: Ermittelt ein Cookie//////////////////////////////////////////////////////////////////  function getCookie(name){  var cookieStr = document.cookie;  if(name && name != ''){    var nameReg = new RegExp('.*' + name + '=');    cookieStr = cookieStr.replace(nameReg, '');    cookieStr = cookieStr.replace(/;.*/, '');      }  return cookieStr;}function getCookie(name){  var cookieStr = document.cookie;  if(name && name != ''){            var nameReg = new RegExp(name + '=');        cookiePos = cookieStr.search(nameReg);        if (cookiePos != -1){     cookieStr = cookieStr.substring(cookiePos);        cookieStr = cookieStr.replace(nameReg, '');     cookieStr = cookieStr.replace(/;.*/, '');    }    else cookieStr="";  }  return cookieStr;}//////////////////////////////////////////////////////////////////// Beschreibung: Prüft den Mindestbestellwert//////////////////////////////////////////////////////////////////  function checkMinOrderValue(orderSum){  if(orderSum < minOrderValue){    isMinOrderValue = false;  }  else{    isMinOrderValue = true;  }}//////////////////////////////////////////////////////////////////// Beschreibung: Gibt das Template der Versandkosten zurück//////////////////////////////////////////////////////////////////  function getFreightChargesTpl(orderSum){  freightChargesTpl = freightChargesTpl.replace("$freightCharges", convertPrice(getFreightCharge(orderSum)));  return freightChargesTpl;}//////////////////////////////////////////////////////////////////// Beschreibung: Gibt die Versandkosten zurück//////////////////////////////////////////////////////////////////  function getFreightCharge(orderSum){  for(var i = 0; i < freightCharges.length; i++){    if(orderSum >= freightCharges[i][1] && orderSum < freightCharges[i][2]){      return freightCharges[i][0];    }  }}  //////////////////////////////////////////////////////////////////// Beschreibung: Überprüft das Vorhandensein eines Wertes//// @params form = das Formular; checkNewValue = der Wert, der getestet werden soll;//				checkOldValues = die Werte gegen welche geprüft werden soll;//				notAllowedString = der String, der nicht zugelassen ist (z.B. "")//				valueTitle = der Titel des zu erzeugenden Parameters//////////////////////////////////////////////////////////////////  function checkValue(form, checkNewValue, checkOldValues, notAllowedString, valueTitle){    if(checkNewValue == null) checkNewValue = "Category";  if(checkOldValues == null) checkOldValues = "cats";  if(notAllowedString == null) notAllowedString = "";  if(valueTitle == null) valueTitle = "Gewerk";    // Returnvariable  var ret = true;  var alertStr = "";    // Lese die neu anzulegende Gewerk aus  var newValue= form.elements[checkNewValue].value;  if(newValue == notAllowedString) alertStr = "Bitte geben Sie eine " + valueTitle + " an.";    // Lese die vorhandenen Gewerke aus dem Formular aus  else if(form.elements[checkOldValues].value != ""){    var oldValues = form.elements[checkOldValues].value;        // Strip first "|" if any    if(oldValues.indexOf("|") == 0) oldValues = oldValues.substr(1,oldValues.length-1);        var presentValues = oldValues.split("|");        // Prüfe ob vorhanden    for(var i=0; i <= presentValues.length-1; i++){      if(presentValues[i] == newValue) alertStr = valueTitle + " schon vorhanden";    }  }    if(alertStr != ""){    alert(alertStr);    ret = false;  }  return ret;}
