function updateform(){city=$("#SearchCity").val().toLowerCase().trim();country=$("#SearchCountry").val();addressYears=$("#AddressYears").val();_logz('updateform: city = "'+city+'", country = "'+country+'", addressYears = "'+addressYears+'"');$.each(config.Services,function(n,t){bindserviceprop(t);$.each(t.Subs,function(n,t){bindserviceprop(t)})});$.each(config.Services,function(n,t){$.each(t.Customs,function(n,t){if(!iscontains(t.ExcludedCities,city,!1)&&iscontains(t.Cities,city,!0)&&iscontains(t.Countries,country,!1)&&iscontains(t.AddressYears,addressYears,!0))return bindserviceprop(t),!1});$.each(t.Subs,function(n,t){$.each(t.Customs,function(n,t){if(!iscontains(t.ExcludedCities,city,!1)&&iscontains(t.Cities,city,!0)&&iscontains(t.Countries,country,!1)&&iscontains(t.AddressYears,addressYears,!0))return bindserviceprop(t),!1})})});rerenderservices();formupdated()}function bindserviceprop(n){$("#"+n.Id).attr("data-price",n.Price).attr("data-enable",n.Enable).attr("data-checked",n.Checked);var t=n.Price===0?n.Label:n.Label+" "+n.Price.toFixed(2).replace(".",",")+" €";$('label[for="'+n.Id+'"]').html(t);$("#desc_"+n.Id).html(n.Description);$("#top_"+n.Id).html(n.Top)}function calcprice(){price=0;var t=$("#PercentDiscount").val()==="true",n=parseFloat($("#Discount").val().replace(",","."));$("input:checked:not([data-price-exclude])").each(function(){var i=$(this).attr("data-price"),r;if(typeof i!=typeof undefined&&i!==!1){var u=parseFloat($(this).attr("data-price").replace(",",".")),f=parseInt($(this).attr("data-extraorder").replace(",",".")),e=parseFloat($(this).attr("data-extraprice").replace(",","."));price+=u+f*e;r=$(this).attr("data-discountable")==="true";!t&&r&&price>n&&(price-=n)}});t&&(price-=price*n/100);$("#price").html(price.toFixed(2).replace(".",","));$("#amount").val(price.toFixed(2));$("#hash").val(window.btoa?btoa(price.toFixed(2)):$.base64.encode(price.toFixed(2)));_logz("price updated")}function rerenderservices(){$.each(config.Services,function(n,t){var i=$("#"+t.Id).attr("data-enable")==="true",u=$("#"+t.Id).is(":checked"),r;$("#"+t.Id).prop("disabled",!i);i?($("#"+t.Id+"-block").attr("data-visible",!0).show(),$("#"+t.Id).prop("checked",u)):($("#"+t.Id).prop("checked",!1),$('input[data-parentid="'+t.Id+'"]').prop("checked",!1),$("#"+t.Id+"-block").attr("data-visible",!1).hide());r=!1;$.each(t.Subs,function(n,t){var f=$("#"+t.Id).attr("data-enable")==="true";$("#"+t.Id).prop("disabled",!f||!u);f?($("#"+t.Id+"-block").show(),$("#"+t.Id).prop("checked",i&&$("#"+t.Id).attr("data-checked")==="true")):($("#"+t.Id).prop("checked",!1),$("#"+t.Id+"-block").hide());$("#"+t.Id).is(":checked")&&(r=!0)});$("#"+t.Id).is(":checked")&&!r&&$.each(t.Subs,function(n,t){if($("#"+t.Id).attr("data-enable")==="true")return $("#"+t.Id).prop("checked",!0),!1})});_logz("services re-rendered")}function updatePayment(){var n=parseInt($("input[name=PaymentType]:checked").val());$(".payment-block").hide();switch(n){case 1:$("#payment-blz").show();break;case 2:$("#payment-iban").show();break;case 3:case 4:case 6:case 7:case 8:$(".payment-block").hide();break;case 5:$("#payment-saved").show()}}function ispagevalidated(){var n=$("#SearchStreet").val().trim(),t=$("#SearchBirthday").val().trim();return!0}function formrendered(){}function formupdated(){_logz("form updated");$(".service-error").empty();calcprice()}(function(n){var i,u={className:"autosizejs",id:"autosizejs",append:"\n",callback:!1,resizeDelay:10,placeholder:!0},r=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent","whiteSpace"],t=n('<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>').data("autosize",!0)[0];t.style.lineHeight="99px";"99px"===n(t).css("lineHeight")&&r.push("lineHeight");t.style.lineHeight="";n.fn.autosize=function(f){return this.length?(f=n.extend({},u,f||{}),t.parentNode!==document.body&&n(document.body).append(t),this.each(function(){function a(){var i,r=window.getComputedStyle?window.getComputedStyle(e,null):!1;r?(i=e.getBoundingClientRect().width,(0===i||"number"!=typeof i)&&(i=parseInt(r.width,10)),n.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(n,t){i-=parseInt(r[t],10)})):i=u.width();t.style.width=Math.max(i,0)+"px"}function w(){var o={},h;(i=e,t.className=f.className,t.id=f.id,s=parseInt(u.css("maxHeight"),10),n.each(r,function(n,t){o[t]=u.css(t)}),n(t).css(o).attr("wrap",u.attr("wrap")),a(),window.chrome)&&(h=e.style.width,e.style.width="0px",e.offsetWidth,e.style.width=h)}function o(){var n,r;i!==e?w():a();t.value=!e.value&&f.placeholder?u.attr("placeholder")||"":e.value;t.value+=f.append||"";t.style.overflowY=e.style.overflowY;r=parseInt(e.style.height,10);t.scrollTop=0;t.scrollTop=9e4;n=t.scrollTop;s&&n>s?(e.style.overflowY="scroll",n=s):(e.style.overflowY="hidden",h>n&&(n=h));n+=l;r!==n&&(e.style.height=n+"px",b&&f.callback.call(e,e),u.trigger("autosize.resized"))}function v(){clearTimeout(c);c=setTimeout(function(){var n=u.width();n!==y&&(y=n,o())},parseInt(f.resizeDelay,10))}var s,h,c,e=this,u=n(e),l=0,b=n.isFunction(f.callback),k={height:e.style.height,overflow:e.style.overflow,overflowY:e.style.overflowY,wordWrap:e.style.wordWrap,resize:e.style.resize},y=u.width(),p=u.css("resize");u.data("autosize")||(u.data("autosize",!0),("border-box"===u.css("box-sizing")||"border-box"===u.css("-moz-box-sizing")||"border-box"===u.css("-webkit-box-sizing"))&&(l=u.outerHeight()-u.height()),h=Math.max(parseInt(u.css("minHeight"),10)-l||0,u.height()),u.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word"}),"vertical"===p?u.css("resize","none"):"both"===p&&u.css("resize","horizontal"),"onpropertychange"in e?"oninput"in e?u.on("input.autosize keyup.autosize",o):u.on("propertychange.autosize",function(){"value"===event.propertyName&&o()}):u.on("input.autosize",o),f.resizeDelay!==!1&&n(window).on("resize.autosize",v),u.on("autosize.resize",o),u.on("autosize.resizeIncludeStyle",function(){i=null;o()}),u.on("autosize.destroy",function(){i=null;clearTimeout(c);n(window).off("resize",v);u.off("autosize").off(".autosize").css(k).removeData("autosize")}),o())})):this}})(jQuery||$);var city="",country="",addressYears="",price=0,seached=!1;$(document).ready(function(){$("#tmpl-service").tmpl(config.Services).appendTo("#services-section");$(".input-service").click(function(){var t=$(this).attr("id"),n;$(this).attr("data-required")==="true"&&$(this).prop("checked",!0);n='input[data-parentid="'+t+'"]';$(n).prop("checked",!1).prop("disabled",!$(this).is(":checked"));$(n+":first").prop("checked",$(this).is(":checked"))});$('input[data-type="service-sub"]').click(function(){var n=$(this).attr("data-parentid");$("#"+n).prop("checked",$(this).is(":checked"))});city=$("#SearchCity").val().toLowerCase().trim();country=$("#SearchCountry").val();addressYears=$("#AddressYears").val();$("#SearchCity, #SearchCountry, #SearchStreet, #SearchBirthday").on("keyup",function(){updateform()});$("#AddressYears").on("change",function(){updateform()});formrendered();updateform();$('input[type="checkbox"],input[type="radio"]').click(function(){formupdated()})});$(document).ready(function(){$("form").first().off().submitForm({blockSender:_lv,submitButton:$("#btn-submit"),beforeSubmit:function(){var t=$("form:first"),n;return ispagevalidated()?t.valid()?price<=0?(showerror(price.toFixed(2).replace(".",",")+" € Bestellung wird nicht akzeptiert"),!1):!0:(n=$(".input-validation-error:first").get(0),n!==null&&n.focus(),!1):($(".input-validation-error").first().focus(),!1)}});$('input[type="text"].keyup').on("keyup",function(){formupdated()});var r={fonts:{swfPath:"/flash/compiled/FontList.swf"}},t=function(){Fingerprint2.get(r,function(n){var t=Fingerprint2.x64hash128(n.map(function(n){return n.value}).join(),31);$("#FingerprintId").val(t)})},n,i;window.requestIdleCallback?(n=requestIdleCallback(t),i=cancelIdleCallback):(n=setTimeout(t,500),i=clearTimeout);n&&(i(n),n=undefined);t()});$(document).ready(function(){updatePayment();$("input[name=PaymentType]").click(function(){updatePayment()});$("#Iban").keyup(function(){var n=$("#Iban").val();n.trim()===""||n.trim().toUpperCase().startsWith("DE")?($("#Bic").val(""),$("#payment-bic-block").hide()):$("#payment-bic-block").slideDown()});$('div[data-type="PaymentType"][data-tags*="ospay"]').hide();(navigator.userAgent.indexOf("iPhone")!==-1||navigator.userAgent.indexOf("Mac OS")!==-1)&&$('div[data-type="PaymentType"][data-tags*="apple"]').show();(navigator.userAgent.indexOf("Android")!==-1||navigator.userAgent.indexOf("Chrome")!==-1)&&$('div[data-type="PaymentType"][data-tags*="google"]').show()});$(document).ready(function(){$(".autosize").autosize()})