/*!
 * Mehrfachregistrierung von Produkten
 * Dazu werden die HTML Elemente erstellt und vor dem Element mit der
 * ID 'additional' eingefuegt.
 *
 */

var product_index = 1;
jQuery(document).ready(function() {
    $("#add_additional").click(function() {
        $("#additional").before('<tr>\
  <td colspan="2"><hr /></td>\
  </tr><tr class="hoch">\
  <td><label for="label2"><strong>Product Name</strong></label></td>\
 <td><span id="spry_product_product_id_1">\
   <select name="produkte[product_id][geraet]" id="spry_product_gereate_product_id_1">\
   <option value="Magnum Dolly">Magnum Dolly</option>\
   <option value="Arco Dolly">Arco Dolly</option>\
   <option value="Sprinter Dolly">Sprinter Dolly</option>\
   <option value="Rocker Dolly">Rocker Dolly</option>\
   <option value="WilliGo Dolly">WilliGo Dolly</option>\
   <option value="MiniCrane">MiniCrane</option>\
   <option value="Traveller">Traveller</option>\
   <option value="Speedy Crane">Speedy Crane</option>\
   <option value="Crane 100">Crane 100</option>\
   <option value="Crane 120">Crane 120</option>\
   <option value="MT 100/200/400">MT 100/200/400</option>\
   <option value="V5 Remote Head">V5 Remote Head</option>\
   <option value="Alex Remote Head">Alex Remote Head</option>\
   <option value="Pelé Remote Head">Pelé Remote Head</option>\
   <option value="P15/27 Remote Head">P15/27 Remote Head</option>\
   <option value="HandyMan Schwebesystem">HandyMan balance system</option>\
   <option value="G-Force Light Schwebesystem">G-Force Light balance system</option>\
   <option value="G-Force Dynamic Schwebesystem">G-Force Dynamic balance system</option>\
   <option value="G-Force Pro Schwebesystem">G-Force Pro balance system</option>\
   <option value="G-Force Advanced Schwebesystem">G-Force Advanced balance system</option>\
   <option value="Reporter Stützsystem">Reporter support system</option>\
   <option value="WilliGo-Schienen">WilliGo-tracks</option>\
   <option value="MasterTrack">MasterTrack</option>\
   <option value="MovieTrack">MovieTrack</option>\
   </select>\
   <span class="selectRequiredMsg">Please choose one item</span></span></td>  \
 <tr>\
    <td>&nbsp;</td>\
    <td>&nbsp;</td>\
  </tr>\
  <tr>\
  <td><label for="label2"><strong>Serial number</strong></label></td>\
  <td><span id="spry_product_product_id_2">\
  <input type="text" name="produkte[product_id][seriennummer]" id="seriennummer" />\
  <span class="textfieldRequiredMsg">A value needs to be entered.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>\
  </tr>\
  <tr>\
  <td>&nbsp;</td>\
  <td>&nbsp;</td>\
  </tr>\
  <tr>\
  <td><label for="label2"><strong>Date of purchase</strong></label></td>\
  <td><span id="spry_product_product_id_3">\
  <input type="text" name="produkte[product_id][kaufdatum]" id="kaufdatum" />\
  <span class="textfieldInvalidFormatMsg">Invalid format.</span><span class="textfieldMinValueMsg">Purchase date is before 01.01.1990.</span><span class="textfieldMaxValueMsg">The entered value is greater than the specification.</span></span></td>\
  </tr>\
  '.replace(/product_id/g, product_index));
        new Spry.Widget.ValidationTextField("spry_product_"+product_index+"_2", "integer");
        new Spry.Widget.ValidationTextField("spry_product_"+product_index+"_3", "date", {format:"dd/mm/yyyy", minValue:"01/01/1990", maxValue:"31/12/2099", hint:"TT/MM/JJJJ", useCharacterMasking:true, isRequired:false});
        new Spry.Widget.ValidationSelect("spry_product_"+product_index+"_1");
        product_index += 1;
    });
});

