
//==================================================================================
//==================================================================================
//
// TEMPLATES-MODUL
// AUTOR: DF
// ERSTELLT: 04.05.2005
//
//==================================================================================
//==================================================================================

// ============================================================
// Globale Deklarationen
// ============================================================

// den undefinierten Wert deklarieren
var undefined;


// ============================================================
// Klasse ShopTemplates
// ============================================================

// ------------------------------------------------------------
// Konstruktor
// ------------------------------------------------------------

// ---------------------------------------
// ShopTemplates()
// ---------------------------------------
//
// Beispiel:
// ---------
// new ShopTemplates()
//
function ShopTemplates() {
}

// ------------------------------------------------------------
// Zugriffsfunktionen
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// ShopTemplates.getHTMLCompactShoppingCart()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getHTMLCompactShoppingCart();
//

ShopTemplates.getHTMLCompactShoppingCart = function(obj) {
  var html = '';
  if (arguments.length) {
    if (! obj instanceof Order) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassOrder!");
    }
    html += '<table cellspacing="0" cellpadding="0">\n';
    html += '<tr>\n';
    html += '<th>Artikel<br /></th>\n';
    html += '<td>'+ obj.getTotalQuantity() +'</td>\n';
    html += '</tr>\n';
    html += '<tr>\n';
    html += '<th>Summe:<br /></th>\n';
    //html += '<td>'+ obj.getTotalPrice() +' EUR</td>\n';
    html += '<td>'+ ShopTemplates.getReductionPriceWithoutShipping(obj) +' EUR</td>\n';
    html += '</tr>\n';
    html += '</table>\n';
  }
  return html;
}

// -------------------------------------------
// ShopTemplates.blinkRabattHinweis()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.blinkRabattHinweis();
//

ShopTemplates.blinkTimeout = undefined;

ShopTemplates.blinkRabattHinweis = function(n) {
  var timedelay = 1500;
  if (ShopTemplates.blinkTimeout) {
    window.clearTimeout(ShopTemplates.blinkTimeout); 
  }
  var rb = document.getElementById('_RABATT_HINWEIS_');
  if (! rb) {
    return;
  }
  if (rb.style.visibility == 'visible') {
    rb.style.visibility = 'hidden';
    timedelay = 500;
  } else {
    rb.style.visibility = 'visible';
  }
  if (! n) {
    n = 1;
  }
  if (n > 6) {
    rb.style.visibility = 'visible';
    return;
  }
  n = n+1;
  var func = function () {
    ShopTemplates.blinkRabattHinweis(n);
  }
  ShopTemplates.blinkTimeout = window.setTimeout(func, timedelay);
}

// -------------------------------------------
// ShopTemplates.getHTMLShoppingCart()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getHTMLShoppingCart();
//

ShopTemplates.getHTMLShoppingCart = function(obj) {
  var articleLink = false;
  if (ShopTemplates.CMSURL!=undefined){
    articleLink = ShopTemplates.CMSURL + '&_sprache=de&_bereich=artikel&_aktion=detail&idartikel=';
  }
  var html = '';
  if (arguments.length) {
    if (! obj instanceof Order) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassOrder!");
    }
      html += '<form id="warenkorb" onsubmit="return false;">\n';
      
      var next_reduction = 0;
      var next_reduction_items = 0;
      var total_items = obj.getTotalQuantity();
      if (total_items >= 12 && total_items < 18) {
        next_reduction_items = 18;
        next_reduction = ShopTemplates._getReductionPercent(next_reduction_items);
      }  
      if (total_items >= 24 && total_items < 30) {
        next_reduction_items = 30;
        next_reduction = ShopTemplates._getReductionPercent(next_reduction_items);
      }   
      if (total_items >= 48 && total_items < 60) {
        next_reduction_items = 60;
        next_reduction = ShopTemplates._getReductionPercent(next_reduction_items);
      }  
      
      if (next_reduction > 0 && next_reduction_items > 0) {
        html += '<div style="background-color: #ff0000; padding: 5px; text-align: center; color: #ffffff; margin-bottom: 20px; font-weight: bold;" id="_RABATT_HINWEIS_">\n';
        html += 'Bei einer Abnahme von '+ next_reduction_items +' Flaschen gewähren wir einen Gesamtrabatt von '+ next_reduction +',00 %.';
        html += '</div >\n';
      }
      
      html += '<div class="warenkorbdetail-inhalt">\n';
      html += '<table cellspacing="0" cellpadding="0" class="table-warenkorbdetail-inhalt">\n';
      html += '<tr>\n';
      html += '<th class="table-warenkorbdetail-inhalt-titel-artikel">\n';
      html += '<img src="/kiosk/grafik/warenkorbdetail_titel_artikel.gif" style="width: px; height: px;" alt="Artikel." title="Artikel." /><br />\n';
      html += '</th>\n';
      html += '<th class="table-warenkorbdetail-inhalt-titel-preis">\n';
      html += '<img src="/kiosk/grafik/warenkorbdetail_titel_preis.gif" style="width: px; height: px;" alt="Preis." title="Preis." /><br />\n';
      html += '</th>\n';
      html += '<th class="table-warenkorbdetail-inhalt-titel-anzahl">\n';
      html += '<img src="/kiosk/grafik/warenkorbdetail_titel_anzahl.gif" style="width: px; height: px;" alt="Anzahl." title="Anzahl." /><br />\n';
      html += '</th>\n';
      html += '<th class="table-warenkorbdetail-inhalt-titel-gesamt">\n';
      html += '<img src="/kiosk/grafik/warenkorbdetail_titel_gesamt.gif" style="width: px; height: px;" alt="Gesamt." title="Gesamt." /><br />\n';
      html += '</th>\n';
      html += '</tr>\n';

    for (var i=0; i<obj.orderedItemList().length; i++){
      html += '<tr>\n';
      html += '<td class="table-warenkorbdetail-inhalt-artikel">\n';
      html += '<div class="warenkorbdetail-inhalt-artikel">\n';
      if (obj.orderedItemList()[i].item().propertyMap()['bezeichnung']){
      html += '<div class="warenkorbdetail-inhalt-artikel-name">\n';
      html += '<p>\n';
      html += obj.orderedItemList()[i].item().propertyMap()['bezeichnung']._value;
      html += '</p>\n';
      html += '</div>\n';
      }
      html += '<div class="warenkorbdetail-inhalt-artikel-titel">\n';
      if (articleLink){
        var _id = obj.orderedItemList()[i].item().id().toString().split(/\[/)[0];
        html += '<h4><a href="'+ articleLink +'' + _id + '">' + obj.orderedItemList()[i].item().title() + '</a></h4>\n';
      } else {
        html += '<h4>' + obj.orderedItemList()[i].item().title() + '</h4>\n';
      }
      html += '</div>\n';
      if (obj.orderedItemList()[i].item().propertyMap()['verbund']){
      html += '<div class="warenkorbdetail-inhalt-artikel-text">\n';
      html += '<p>\n';
      html += obj.orderedItemList()[i].item().propertyMap()['verbund']._value;
      html += '</p>\n';
      html += '</div>\n';
      html += '</div>\n';
      }
      html += '</td>\n';
      html += '<td class="table-warenkorbdetail-inhalt-preis">\n';
      html += '<div class="warenkorbdetail-inhalt-preis">\n';
      html += '<p>\n';
      html += obj.orderedItemList()[i].item().getFormatedPrice() +' EUR\n';
      html += '</p>\n';
      html += '</div>\n';
      html += '</td>\n';
      html += '<td class="table-warenkorbdetail-inhalt-anzahl">\n';
      html += '<div class="warenkorbdetail-inhalt-menge">\n';
      html += '<a href="javascript:void(0);" onclick="updateShoppingCart(\''+ obj.orderedItemList()[i].item().id() +'\', \'0\');" style="display: inline;"><img src="/kiosk/grafik/button_shop_delete.gif" alt="Artikel aus dem Warenkorb entfernen" title="Artikel aus dem Warenkorb entfernen" style="float: right; padding: 1px 5px 0 0;"/></a><input type="text" id="feld-'+ i +'" name="Anzahl-Flaschen-'+ i +'" class="warenkorbdetail-anzahl" value="'+ obj.orderedItemList()[i].quantity() +'" onchange="updateShoppingCart(\''+ obj.orderedItemList()[i].item().id() +'\', this.value);"/>\n';
      html += '</div>\n';
      html += '</td>\n';
      html += '<td class="table-warenkorbdetail-inhalt-gesamt">\n';
      html += '<div class="warenkorbdetail-inhalt-preis">\n';
      html += '<p>\n';
      html += obj.orderedItemList()[i].getTotalPrice() + ' EUR\n';
      html += '</p>\n';
      html += '</div>\n';
      html += '</td>\n';
      html += '</tr>\n';
    }

    /*
    html += '<tr>\n';
    html += '<td colspan="3" class="table-warenkorbdetail-fuss-titel" style="background-color: #90A6CE;">\n';
    html += 'enthaltene MwSt. '+ Order.TaxRate +'%<br />\n';
    html += '</td>\n';
    html += '<td class="table-warenkorbdetail-fuss-gesamtpreis" style="background-color: #90A6CE;">\n';
    html += '<div class="warenkorbdetail-inhalt-preis">\n';
    html += '<p>\n';
    html += obj.getTaxFromTotalPriceTaxInclusive() +' EUR\n';
    html += '</p>\n';
    html += '</div>\n';
    html += '</td>\n';
    html += '</tr>\n';
    */
    
    var redPerc = ShopTemplates.getReductionPercent(obj);
    if (redPerc > 0) {
      html += '<tr>\n';
      html += '<td colspan="3" class="table-warenkorbdetail-fuss-titel" style="background-color: #90A6CE;">\n';
      html += 'abzgl. '+ redPerc +',00 % Gesamtrabatt<br />\n';
      html += '</td>\n';
      html += '<td class="table-warenkorbdetail-fuss-gesamtpreis" style="background-color: #90A6CE;">\n';
      html += '<div class="warenkorbdetail-inhalt-preis">\n';
      html += '<p>\n';
      html += '- ' + ShopTemplates.getReductionPriceDiff(obj) +' EUR\n';
      html += '</p>\n';
      html += '</div>\n';
      html += '</td>\n';
      html += '</tr>\n';
      
      html += '<tr>\n';
      html += '<td colspan="3" class="table-warenkorbdetail-fuss-titel">\n';
      html += 'Zwischensumme<br />\n';
      html += '</td>\n';
      html += '<td class="table-warenkorbdetail-fuss-gesamtpreis">\n';
      html += '<div class="warenkorbdetail-inhalt-preis">\n';
      html += '<p>\n';
      html += ShopTemplates.getReductionPriceWithoutShipping(obj) +' EUR\n';
      html += '</p>\n';
      html += '</div>\n';
      html += '</td>\n';
      html += '</tr>\n';
    }

    html += '<tr>\n';
    html += '<td colspan="3" class="table-warenkorbdetail-fuss-titel" style="background-color: #90A6CE;">\n';
    html += 'zzgl. Lieferung<br />\n';
    html += '</td>\n';
    html += '<td class="table-warenkorbdetail-fuss-gesamtpreis" style="background-color: #90A6CE;">\n';
    html += '<div class="warenkorbdetail-inhalt-preis">\n';
    html += '<p>\n';
    html += ShopTemplates.getSendingPrice(obj) +' EUR\n';
    html += '</p>\n';
    html += '</div>\n';
    html += '</td>\n';
    html += '</tr>\n';

    html += '<tr>\n';
    html += '<td colspan="3" class="table-warenkorbdetail-fuss-titel" style="background-color: #90A6CE;">\n';
    html += 'enthaltene MwSt. '+ Order.TaxRate +'%<br />\n';
    html += '</td>\n';
    html += '<td class="table-warenkorbdetail-fuss-gesamtpreis" style="background-color: #90A6CE;">\n';
    html += '<div class="warenkorbdetail-inhalt-preis">\n';
    html += '<p>\n';
    //html += obj.getTaxFromTotalPriceTaxInclusiveSendingInclusive(ShopTemplates.getSendingPriceUnFormatted(obj)) +' EUR\n';
    html += ShopTemplates.getTaxFromTotalPrice(obj) +' EUR\n';
    html += '</p>\n';
    html += '</div>\n';
    html += '</td>\n';
    html += '</tr>\n';

    html += '<tr>\n';
    html += '<td colspan="3" class="table-warenkorbdetail-fuss-titel">\n';
    html += 'Summe<br />\n';
    html += '</td>\n';
    html += '<td class="table-warenkorbdetail-fuss-gesamtpreis">\n';
    html += '<div class="warenkorbdetail-inhalt-preis">\n';
    html += '<p>\n';
    html += ShopTemplates.getTotalPrice(obj) +' EUR\n';
    html += '</p>\n';
    html += '</div>\n';
    html += '</td>\n';
    html += '</tr>\n';

    html += '<tr>';
    html += '<td colspan="3" class="table-warenkorbdetail-anhang-text">';
     html += '<span style="color:#657DAB;">Lieferung nur in 3-er, 6-er oder 12-er Karton. Mindestbestellmenge 3 Flaschen. Ab einem Warenwert von 250,00 &euro; liefern wir ohne Porto- und Verpackungskosten. Alle Preise inkl. Sekt- und Mehrwertsteuer. ';
     html += 'Die Lieferung erfolgt innerhalb Deutschlands nach Vorkasse. Eine Lieferung ins Ausland ist ausgeschlossen.</span><br />';
    //html += '<span style="color:#657DAB;">Mindestbestellung 6 Flaschen, bzw. 40 EUR. Alle Preise inkl. Sekt- und Mehrwertsteuer<br />';
    //html += 'Versand und Verpackung innerhalb Deutschlands.</span><br />';
    html += '</td>';
    html += '<td class="table-warenkorbdetail-anhang-link" style="vertical-align: top;">';
    html += '<a href="javascript:void(0);" onclick="showCustomerDataForm(); this.style.display=\'none\'" id="kasse_button">Zur Kasse</a>';
    html += '</td>';
    html += '</tr>';
    html += '</table>\n';
    html += '</div>\n';
    html += '</form>\n';
  }
  return html;
}

// -------------------------------------------
// ShopTemplates.getTaxFromTotalPrice()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getTaxFromTotalPrice(obj);
//


ShopTemplates.getTaxFromTotalPrice = function(obj){
  var total = ShopTemplates.getTotalPrice(obj);
  total = parseFloat(total.toString().replace(/\,/,'.'));
  var taxRate = Order.TaxRate;
  var diff = parseFloat(100 + taxRate);
  return ShopUtils.formatCashFloat(parseFloat((total/diff)*taxRate));
}

// -------------------------------------------
// ShopTemplates.getTotalPrice()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getTotalPrice(obj);
//


ShopTemplates.getTotalPrice = function(obj){
  //var _totalItems = obj.getTotalPrice().toString().replace(/\,/,'.');
  var _totalItems = ShopTemplates.getReductionPriceWithoutShipping(obj);
  _totalItems = _totalItems.toString().replace(/\,/,'.');
  var _sendingPrice = ShopTemplates.getSendingPrice(obj).toString().replace(/\,/,'.');
  var _totalPrice = parseFloat(parseFloat(_totalItems) + parseFloat(_sendingPrice));
  return ShopUtils.formatCashFloat(_totalPrice);
  /*
  var _totalPriceFull = _totalPrice.toString().split(/\./)[0];
  var _totalPriceCent = parseFloat(_totalPrice.toString().split(/\./)[1]);
  if (!_totalPriceCent){
    _totalPriceCent = '00';
  }
  _totalPriceCent = _totalPriceCent.toString();
  if (_totalPriceCent && _totalPriceCent.length < 2){
    _totalPriceCent = _totalPriceCent +'' + '0';
  }
  return _totalPriceFull + ',' + _totalPriceCent;
  */
}

// -------------------------------------------
// ShopTemplates.getReductionPercent()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getReductionPercent(obj);
//


ShopTemplates.getReductionPercent = function(obj){
  var items = obj.getTotalQuantity();
  return ShopTemplates._getReductionPercent(items);
}

// -------------------------------------------
// ShopTemplates._getReductionPercent()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates._getReductionPercent(obj);
//


ShopTemplates._getReductionPercent = function(n){
  if (n >= 60) {
    return 20;
  }
  if (n >= 30) {
    return 10;
  }
  if (n >= 18) {
    return 5;
  }
  return 0;
}

// -------------------------------------------
// ShopTemplates.getReductionPriceDiff()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getReductionPriceDiff(obj);
//


ShopTemplates.getReductionPriceDiff = function(obj){
  var total = obj.getTotalPrice().toString().replace(/\,/,'.');
  var rPerc = ShopTemplates.getReductionPercent(obj);
  var res = (total / 100) * rPerc;
  return ShopUtils.createCashFormated(res);
}    

// -------------------------------------------
// ShopTemplates.getReductionPriceWithoutShipping()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getReductionPriceWithoutShipping(obj);
//


ShopTemplates.getReductionPriceWithoutShipping = function(obj){
  var total = obj.getTotalPrice().toString().replace(/\,/,'.');
  var rPerc = ShopTemplates.getReductionPercent(obj);
  var res = total - ((total / 100) * rPerc);
  return ShopUtils.createCashFormated(res);
}                                       

// -------------------------------------------
// ShopTemplates.getSendingPrice()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getSendingPriceUnFormatted(obj);
//


ShopTemplates.getSendingPriceUnFormatted = function(obj){
  var _flaschen = 0;
  var _kartons  = 0;
  var _price = 0;
  for (var i=0; i<obj.orderedItemList().length; i++){
    if (obj.orderedItemList()[i].item().propertyMap()['kategorie1'] && obj.orderedItemList()[i].item().propertyMap()['kategorie1']._value != '10041'){
      if (obj.orderedItemList()[i].item().propertyMap()['verbund-type']._value == 'v2') {
          _kartons += parseFloat(obj.orderedItemList()[i].quantity());
      } else {
         _flaschen += parseFloat(obj.orderedItemList()[i].quantity());
      }
    }
  }
  if (Math.floor(_flaschen / 12)){
    _price += Math.floor(_flaschen / 12) * 9.5;  
    _flaschen = _flaschen % 12;
  }
  if (Math.floor(_flaschen / 6)){
    _price += Math.floor(_flaschen / 6) * 8;  
    _flaschen = _flaschen % 6;
  }
  if (Math.floor(_flaschen / 3)){
    _price += Math.floor(_flaschen / 3) * 7.5;  
    _flaschen = _flaschen % 3;
  }
  if (_kartons) {
    _price += _kartons * 8;
  }
  return _price;
}

// -------------------------------------------
// ShopTemplates.getSendingPrice()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getSendingPrice(obj);
//


ShopTemplates.getSendingPrice = function(obj){
  var _price =  ShopTemplates.getSendingPriceUnFormatted(obj);
  var total = obj.getTotalPrice().toString().replace(/\,/,'.');
  total = parseFloat(total);
  if (total && total >= 250) {
    _price = 0;
  }
  _price = ShopUtils.createCashFormated(_price);
  return _price;
}

// -------------------------------------------
// ShopTemplates.getHTMLCustomerDataForm()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getHTMLCustomerDataForm();
//

ShopTemplates.getHTMLCustomerDataForm = function(obj) {
  var html = '';
  if (arguments.length) {
    if (! obj instanceof Order) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassOrder!");
    }
    var _path = undefined;
    if (parent.top){
      _path = 'parent.top';
    } else if (opener && opener.top){
      _path = 'opener.top';
    }
    if (!_path){
      return '';
    }
    html += '<div class="formular-titel">\n';
    html += '<h3><img src="/kiosk/grafik/formular_titel_adressdaten.gif" style="width: 149px; height: 13px;" alt="Ihre Adressdaten." title="Ihre Adressdaten." /></h3>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt">\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-14">&#160;</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    html += '<input type="checkbox" id="feld-14" name="Ich bin bereits Kunde" value="ja" /> Ich bin bereits Kunde<br />\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-13">Kunden-Nr.:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    var customerNumber = '';
    if (obj.customer().customerNumber() != undefined){
      customerNumber = obj.customer().customerNumber();
    }
    html += '<input type="text" id="feld-13" onchange="' + _path + '.Order.GetInstance().customer().setCustomerNumber(this.value);" name="Kundennummer" class="einzeilig-lang" value="'+ customerNumber +'" /><br />\n';
    html += '(falls vorhanden)\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-2">Vorname:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    var vorname = '';
    if (obj.customer().firstName() != undefined){
      vorname = obj.customer().firstName();
    }
    html += '<input type="text" id="feld-2" onchange="' + _path + '.Order.GetInstance().customer().setFirstName(this.value);" name="Vorname" class="einzeilig-lang" value="'+ vorname +'" /><br />\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-3">Name:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    var name = '';
    if (obj.customer().name() != undefined){
      name = obj.customer().name();
    }
    html += '<input type="text" id="feld-3" onchange="' + _path + '.Order.GetInstance().customer().setName(this.value);" name="Name" class="einzeilig-lang" value="'+ name +'" /><br />\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-4">Straße/Nr.:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    var strasse = '';
    if (obj.customer().street() != undefined){
      strasse = obj.customer().street();
    }
    html += '<input type="text" id="feld-4" onchange="' + _path + '.Order.GetInstance().customer().setStreet(this.value);" name="Straße/Nr." class="einzeilig-lang" value="'+ strasse +'" /><br />\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-6">PLZ</label> / <label for="feld-7">Ort:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    var plz = '';
    if (obj.customer().postCode() != undefined){
      plz = obj.customer().postCode();
    }
    var ort = '';
    if (obj.customer().city() != undefined){
      ort = obj.customer().city();
    }
    html += '<input type="text" id="feld-6" onchange="' + _path + '.Order.GetInstance().customer().setPostCode(this.value);" name="PLZ" class="einzeilig-kurz erstes-feld" value="'+ plz +'" /><input type="text" id="feld-7" onchange="' + _path + '.Order.GetInstance().customer().setCity(this.value);" name="Ort" class="einzeilig-mittel" value="'+ ort +'" /><br />\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-8">Telefon:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    var tel = '';
    if (obj.customer().telephone() != undefined){
      tel = obj.customer().telephone();
    }
    html += '<input type="text" id="feld-8" onchange="' + _path + '.Order.GetInstance().customer().setTelephone(this.value);" name="Telefon" class="einzeilig-lang" value="'+ tel +'" /><br />\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-9">E-Mail:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    var mail = '';
    if (obj.customer().email() != undefined){
      mail = obj.customer().email();
    }
    html += '<input type="text" id="feld-9" onchange="' + _path + '.Order.GetInstance().customer().setEmail(this.value);" name="E-Mail" class="einzeilig-lang" value="'+ mail +'" /><br />\n';
    html += '(Bitte geben Sie uns eine E-Mail-Adresse, an die wir Ihre<br />Rechnung senden können.)<br />\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';


    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<label for="feld-11">Bemerkung:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    html += '<textarea id="feld-11" name="Bemerkung" class="mehrzeilig-lang-mittel"></textarea>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    
    // GUTSCHEINAKTION
    
    /*
    html += '<div style="background-color: #EDE5CD; padding: 10px 10px 0 10px; border: 4px solid #8A1500; margin-bottom: 20px; margin-top: 20px;">\n';
    
    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div style="color: #8A1500; font-size: 1.2em; font-weight: bold;">Die Radio RPR-Aktion: Der aus 5 mach 6-Coupon!<br />Beim Kauf eines Kartons "Schloss Wachenheim Edition" ist die sechste Flasche gratis!</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';   
    html += '</div>\n';
    
    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel" style="width: auto; padding-right: 20px;">\n';
    html += '<label for="feld-9">Gutscheincode:</label><br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld" style="width: 150px;">\n';
    html += '<input type="text" id="Gutscheincode" name="Gutscheincode" class="einzeilig-lang" value=""  style="width: 150px;"/><br />\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '<span style="font-size: 0.9em;"><b>Aufgepasst:</b> Diese Aktion endet am 31.12.2011. <div style="font-weight: bold;">Die sechste Flasche wird Ihnen in der Rechnung abgezogen.</div> Pro Person darf nur ein Coupon eingelöst werden. Die Aktion gilt nur einmal für einen Karton. Der Coupon ist nicht mit anderen Rabattaktionen kombinierbar und gilt nur für die limitierten Editions-Sekte.<br /></span>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    
    html += '</div>\n';
    */
    
    // GUTSCHEINAKTION

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    html += '<input type="checkbox" id="feld-10" name="AGB" class="checkbox" value="akzeptiert"/><label for="feld-10">Ich akzeptiere die <a href="'+ ShopTemplates.CMSURL +'&_sprache=sekt-shop&_bereich=artikel&_aktion=detail&idartikel=100051">Allgemeinen Geschäftsbedingungen</a><br />und die <a href="'+ ShopTemplates.CMSURL +'&_sprache=sekt-shop&_bereich=artikel&_aktion=detail&idartikel=100473">Widerrufsbelehrung</a></label>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    html += '<input type="checkbox" id="feld-15" name="Verbraucherinformationen zum Abschluss von Fernabsatzverträgen" class="checkbox" value="gelesen"/><label for="feld-15">Ich habe die <a href="'+ ShopTemplates.CMSURL +'&_sprache=sekt-shop&_bereich=artikel&_aktion=detail&idartikel=100382">Verbraucherinformationen</a> zum Abschluss<br />von Fernabsatzverträgen und weitergehende Informationen<br />zum elektronischen Geschäftsverkehr zur Kenntnis genommen.</label>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    html += '<input type="checkbox" id="feld-16" name="Ich bin damit einverstanden, auch zukünftig aktuelle Produktinformationen aus ihrem Haus zu erhalten" class="checkbox" value="Ja"/><label for="feld-16">Ich bin damit einverstanden, auch zukünftig aktuelle<br />Produktinformationen aus ihrem Haus zu erhalten</label>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '<div class="formular-inhalt-eintrag">\n';
    html += '<div class="formular-inhalt-eintrag-titel">\n';
    html += '<br />\n';
    html += '</div>\n';
    html += '<div class="formular-inhalt-eintrag-feld">\n';
    html += '<input type="checkbox" id="feld-12" name="Einverständniserklärung über Speicherung der persönl. Daten" class="checkbox" value="akzeptiert"/><label for="feld-12">Ich  bin  damit  einverstanden, dass meine Daten zur<br />Auftragsabwicklung und weiteren  Information  gespeichert  werden.<br />Die Daten werden an das mit der Auslieferung  beauftragte<br />Versandunternehmen  weitergegeben. Eine darüber hinausgehende<br />Weitergabe der Daten an Dritte erfolgt nicht.<br />(<a href="'+ ShopTemplates.CMSURL +'&_sprache=sekt-shop&_bereich=artikel&_aktion=detail&idartikel=100384">Weitere Informationen zum Datenschutz</a>)</label>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';

    html += '</div>\n';

    html += '<div class="formular-abschluss">\n';
    html += '<div class="formular-abschluss-absenden">\n';
    html += '<input type="submit" id="absenden" name="Bestellen" class="button-absenden" value="BESTELLUNG ABSENDEN" style="width: auto; padding-right: 10px; padding-left: 10px;"/><br />\n';
    html += '</div>\n';
    html += '<div class="formular-abschluss-loeschen">\n';
    html += '<input type="reset" id="loeschen" name="Löschen" class="button-loeschen" value="LÖSCHEN" /><br />\n';
    html += '</div>\n';
    html += '<div class="float-aufheben"><br /></div>\n';
    html += '</div>\n';
  }
  return html;
}

// -------------------------------------------
// ShopTemplates.getTextOrderItems()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getTextOrderItems();
//

ShopTemplates.getTextOrderItems = function(obj) {
  var str = '';
  if (arguments.length) {
    if (! obj instanceof Order) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassOrder!");
    }
    for (var i=0; i<obj.orderedItemList().length; i++){
      if (i==0){
        str += '\n';
        str += '\n';
      }
      str += 'Artikel ' + parseFloat(i+1) + ':\n';
      str += 'Titel: ' + obj.orderedItemList()[i].item().title() + '\n';
      if (obj.orderedItemList()[i].item().propertyMap()['artikel-id']){
        str += 'EAN: ' + obj.orderedItemList()[i].item().propertyMap()['artikel-id']._value + '\n';
      }
      if (obj.orderedItemList()[i].item().propertyMap()['bezeichnung']){
        str += 'Bezeichnung: ' + obj.orderedItemList()[i].item().propertyMap()['bezeichnung']._value + '\n';
      }
      if (obj.orderedItemList()[i].item().propertyMap()['typ']){
        str += 'Typ: ' + obj.orderedItemList()[i].item().propertyMap()['typ']._value + '\n';
      }
      if (obj.orderedItemList()[i].item().propertyMap()['verbund']){
        str += 'Verbund: ' + obj.orderedItemList()[i].item().propertyMap()['verbund']._value + '\n';
      }
      str += 'Preis: ' + obj.orderedItemList()[i].item().getFormatedPrice() + ' EUR\n';
      str += 'Anzahl: ' + obj.orderedItemList()[i].quantity() + '\n';
      str += 'Summe: ' + obj.orderedItemList()[i].getTotalPrice() + ' EUR\n';
      str += '-----------\n';
    }
    str += '\n';
    //str += 'enthaltene MwSt 19%: ' + obj.getTaxFromTotalPriceTaxInclusive() + ' EUR\n';
    
    var redPerc = ShopTemplates.getReductionPercent(obj);
    if (redPerc > 0) {
      str += 'abzgl. '+ redPerc +',00 % Gesamtrabatt: - ' + ShopTemplates.getReductionPriceDiff(obj) +' EUR\n';
      str += 'Zwischensumme: ' + ShopTemplates.getReductionPriceWithoutShipping(obj) +' EUR\n';
    }
    str += 'zzgl. Lieferung: ' + ShopTemplates.getSendingPrice(obj) + ' EUR\n';
    //str += 'enthaltene MwSt 19%: ' + obj.getTaxFromTotalPriceTaxInclusiveSendingInclusive(ShopTemplates.getSendingPriceUnFormatted(obj)) + ' EUR\n';
    str += 'enthaltene MwSt 19%: ' + ShopTemplates.getTaxFromTotalPrice(obj) + ' EUR\n';
    str += 'Gesamtsumme: ' + ShopTemplates.getTotalPrice(obj) + ' EUR\n';
  }
  return str;
}

// -------------------------------------------
// ShopTemplates.getTextCustomerData()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// ShopTemplates.getTextCustomerData();
//

ShopTemplates.getTextCustomerData = function(obj) {
  var str = '';
  if (arguments.length) {
    if (! obj instanceof Order) {
      focus();
      throw new Error("ArgumentError:noObjectFromClassOrder!");
    }
    if (obj.customer().name() != undefined){
      str += 'Name: ' + obj.customer().name() + '\n';
    }
    if (obj.customer().firstName() != undefined){
      str += 'Vorname: ' + obj.customer().firstName() + '\n';
    }
    if (obj.customer().street() != undefined){
      str += 'Straße/Nr.: ' + obj.customer().street() + '\n';
    }
    if (obj.customer().postCode() != undefined){
      str += 'PLZ: ' + obj.customer().postCode() + '\n';
    }
    if (obj.customer().city() != undefined){
      str += 'Ort: ' + obj.customer().city() + '\n';
    }
    if (obj.customer().telephone() != undefined){
      str += 'Tel.: ' + obj.customer().telephone() + '\n';
    }
    if (obj.customer().email() != undefined){
      str += 'E-Mail: ' + obj.customer().email() + '\n';
    }
  }
  return str;
}

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// toString()
// ------------------------------------------------------------

ShopTemplates.prototype.toString = function() {
  // zunaechst an Methode der Basisklasse weiterleiten
  return Object.prototype.toString.apply(this);
}

