Insgesamt Tarifkombinationen geprüft.'}),new b("div.products-tax",{html:'Alle Beiträge in Euro inkl. '+this.calculator.formatValue("tax",null,{unit:"%"})+" VSt."}),a)}})}(window); !function(a){var b=!0,c=function(a,d,e,f,g){var h;return d&&!a.hasClass("hidden")||!d&&a.hasClass("hidden")?(h=f&&f(),c):(a.get("slide").setOptions({resetHeight:!0}).addEvent("complete:once",function(){b||(h=e?e():a.getForm().validate(Object.merge({showErrors:!1},g||{})),h=f&&f())})["slide"+(d?"In":"Out")](),c)},d=function(a){return a?"checkbox"===a.get("type")?a.checked:1==a.value&&a.checked?!0:!1:null},e=function(a,b){return $(a).getElement(b)},f=function(a,b,c){return e(a,'input[name="'+b+'"]'+(c||""))},g=function(a,b,c,d){return f(a,b,(d||"")+":checked")},h=window.Calculator;h.implement({toggleFertighaus:function(a){var b=a.getParent(".form-grid"),f=b.getForm().element,h=e(f,".dacheindeckung"),i=e(f,".fertighaus-details"),j=e(f,".dacheindeckung-details"),k=g(h,"dach"),l=d(a),m=g(i,"wand-fertighaus"),n=e(f,".bak");b.addClass("form-collapse-bottom"),h.addClass("form-collapse-top"),c(h,!l)(i,l),!l&&k?this.toggleDacheindeckung(k):l?l&&(c(j,!1),m?this.setBauartklasse(m):c(n,!1)):c(n,!1)},toggleDacheindeckung:function(a){var b=a.getParent(".form-grid"),d=b.getForm().element,f=e(d,".dacheindeckung-details"),h=g(f,"wand-dacheindeckung"),i=e(d,".bak");b.removeClass("form-collapse-top").addClass("form-collapsed"),c(f,!0),h?this.setBauartklasse(h):c(i,!1)},setBauartklasse:function(a){var b,h=a.getParent(".form-grid"),i=h.getForm().element,j=d(g(e(i,".fertighaus"),"fertighaus")),k=g(e(i,".dacheindeckung"),"dach"),l=e(i,(j?".fertighaus":".dacheindeckung")+"-details"),m=g(l,"wand-"+(j?"fertighaus":"dacheindeckung")),n=e(i,".bak"),o=f(n,"bak-text");if(j)switch(b="fhg",m.value){case"massiv":b+=1;break;case"stahl":b+=2;break;case"holz":b+=3}else switch(b="bak",k.value){case"hart":switch(m.value){case"massiv":b+=1;break;case"stahl":b+=2;break;case"holz":b+=3}break;case"weich":switch(m.value){case"massiv":case"stahl":b+=4;break;case"holz":b+=5}}f(i,"Vertrag_bauartklasse_form").set("value",b||""),c(n,!!b),b?l.removeClass("form-collapse-top").addClass("form-collapsed"):l.addClass("form-collapse-top").removeClass("form-collapsed"),o.set("value",this.formatValue("Vertrag_bauartklasse_form",b))},toggleVs:function(a){var b=e(a.getParent(".form-grid"),".indiv-vs"),g=d(a),h=a.getStep();c(b,g),g?this.setHiddenVs(h):this.setDefaultVs(f(h,"Vertrag_wohnflaeche_form"))},toggleFahrrad:function(a){var b=d(a),g=e(a.getParent(".form-grid"),".fahrrad-vs");c(g,b),b||(f(g,"Vertrag_fahrrad_min_form").value="0")},setDefaultVs:function(a){var b=a.getStep(),c=650*a.value,h=d(g(b,"Vertrag_abweichende_vs_form"));e(b,".default-vs").set("html",c.format({decimals:0})),h||(f(b,"Vertrag_versicherungssumme_form").value=c),this.setHiddenVs(b)},setHiddenVs:function(a){f(a,"Vertrag_vs_summe").value=f(a,"Vertrag_versicherungssumme_form").value},toggleElementar:function(a){var b=a?d(a):this.elementar;a&&(this.elementar=b)},toggleGefahrenerhoehungen:function(a){c(e(a.getParent(".form-grid"),".gefahren"),d(a))},clearField:function(a){a.getElement("li")?(a.getElement("li").set("html","auswählen"),a.getElement("li").set("data-value","")):a.getElement("input").value=""},hideField:function(a){a.addClass("hidden")},showField:function(a){a.addClass("hidden")},hideAndClearfield:function(a){this.hideField(a),this.clearField(a)},getQuotevorschaedenfields:function(){return $$("div[class^=form-grid-row schaden]")},hideEigabeField:function(){this.clearField(this.element.getElementsByClassName("anzahl-input")[0])},hideVorschaedenFields:function(){this.getQuotevorschaedenfields().each(function(a){this.hideAndClearfield(a)}.bind(this))},hideAllVorschaedenFields:function(){this.hideEigabeField(),this.hideVorschaedenFields()},AnzahlVorschaedenFeldBauen:function(a){"1"===a.value?this.element.getElementsByClassName("AnzahlVorschaden")[0].removeClass("hidden"):(this.element.getElementsByClassName("AnzahlVorschaden")[0].addClass("hidden"),this.hideAllVorschaedenFields())},getAnzahlVorschaedenAktiveFeld:function(){var a=18;return this.getQuotevorschaedenfields().each(function(b){b.hasClass("hidden")&&a--}.bind(this)),0>=a?0:a/2},checkAnzahlAngabe:function(a){var b=a.value;9>=b&&b>=1?this.alleVorschaedenFelderAnzeigen(b):this.hideVorschaedenFields()},alleVorschaedenFelderAnzeigen:function(a){var b,c=this.getAnzahlVorschaedenAktiveFeld();if(c>a)for(b=c;b>a;b--)this.element.getElements(".form-grid-row.schaden"+b).each(function(a){this.hideAndClearfield(a)}.bind(this));if(a>c)for(b=c;a>=b;b++)this.element.getElements(".form-grid-row.schaden"+b).each(function(a){a.removeClass("hidden")})}}),Form.Validator.addAllThese([["validate-anzahlschaeden",{errorMsg:"Bitte Anzahl zwischen 1 und 9 eingeben.",test:function(a,b){return a.value<=b.max&&a.value>=b.min}}],["validate-vorschaeden",{errorMsg:"Bitte eine Gefahr auswählen",test:function(a){return"0"!==a.value}}]]),a.Initializer.addEvent("complete:once",function(){var c=null,d=a.getCalculator(),h=d.zoneFeedback=e(a,".zone-feedback");d.addEvent("optionsLoaded",function(){null!==(c=g(a,"fertighaus"))&&d.toggleFertighaus(c),null!==(c=g(a,"Vertrag_abweichende_vs_form"))&&d.toggleVs(c),null!==(c=g(a,"fahrrad"))&&d.toggleFahrrad(c),null!==(c=g(a,"Vertrag_elementarschaeden_form"))&&d.toggleElementar(c),c=f(a,"Vertrag_wohnflaeche_form"),c.value&&d.setDefaultVs(c),b=!1}),e(a,".risikozonen").retrieve("Risikozonen").addEvents({risikozone:function(a){h.set("html",a.zone?"Gefährdung: "+a.message+" (ZÜRS-Zone: "+a.zone+")":a.message)},cancel:function(){}})})}(document); !function(){var a=new Class({Extends:Component,property:"Risikozonen",options:{zip:".zip input",place:".place .select-value",street:".street .select-value",streetNumber:".street-number .select-value"},cache:{},requests:{running:1},buffer:{},initialize:function(a,b){return this.occlude(this.property,a)?this.occluded:(this.parent(a,b),this.addEvent("searchesComplete",this.walkBuffer.bind(this)),this.getZip().addEvents({validationPassed:function(){this.getPlace().setDisabled(!1),this.search("Place")}.bind(this),validationFailed:function(){this.getPlace().setDisabled(!0).clear(),this.getStreet().setDisabled(!0).clear(),this.getStreetNumber().setDisabled(!0).clear(),this.buffer={}}.bind(this),paste:function(a){this.fireEvent("change",[a])}}),this.getPlace().addEvent("change",function(){this.place.isValid()?(this.getStreet().setDisabled(!1),this.search("Street")):(this.getStreet().setDisabled(!0).clear(),this.getStreetNumber().setDisabled(!0).clear(),this.buffer={})}.bind(this)),this.getStreet().addEvent("change",function(){this.street.isValid()?(this.getStreetNumber().setDisabled(!1),this.search("StreetNumber",{street:this.street.getValue()})):(this.getStreetNumber().setDisabled(!0).clear(),this.buffer={})}.bind(this)),this.getStreetNumber().addEvents({change:function(){this.streetNumber.isValid()?this.searchZone():(this.fireEvent("cancel"),this.element.getElement(".risikozone").set("value",""))}.bind(this),setDisabled:function(a){a&&this.fireEvent("cancel")}.bind(this)}),void document.Initializer.addEvent("complete:once",function(){this.requests.running--,this.zip.hasClass("validation-passed")?this.walkBuffer():this.buffer={}}.bind(this)))},searchZone:function(){this.buffer.Zone=function(){var a={zip:this.zip.value,place:this.place.getValue(),street:this.street.getValue(),streetNumber:this.streetNumber.getValue()},b=Object.toQueryString(a);this.cache.Zone&&this.cache.Zone[b]?(this.element.getElement(".risikozone").set("value",this.cache.Zone[b].zone||""),this.fireEvent("risikozone",[this.cache.Zone[b]]),0===this.requests.running&&this.fireEvent.delay(50,this,["searchesComplete"])):(this.request||(this.request=new Request.JSON({link:"cancel"}).addEvents({request:function(){this.requests.running++}.bind(this),complete:function(){this.requests.running--,delete this.buffer.Zone,0===this.requests.running&&this.fireEvent("searchesComplete")}.bind(this),success:function(a){this.cache.Zone||(this.cache.Zone={}),this.cache.Zone[this.request.cache]=a,this.element.getElement(".risikozone").set("value",a.zone||""),this.fireEvent("risikozone",[a])}.bind(this)})),this.request.cache=b,this.request.send({data:{actions:{risikozone:a}}}))},0===this.requests.running&&this.walkBuffer()},get:function(a){return this[a]||(this[a]=$(this).getElement(this.options[a]).retrieve("ComboBox")),this[a]},getZip:function(){return this.zip||(this.zip=$(this).getElement(this.options.zip))},getPlace:function(){return this.get("place")},getStreet:function(){return this.get("street")},getStreetNumber:function(){return this.get("streetNumber")},setPlaces:function(a){this.getPlace().setItems(a,!1,!0),1!==a.length||this.place.getValue()?!this.buffer.Street&&this.place.getValue()&&this.search("Street"):this.place.select(0)},setStreets:function(a){this.getStreet().setOptions({max_results:a.length}).setItems(a,!1,!0),1!==a.length||this.street.getValue()?!this.buffer.StreetNumber&&this.street.getValue()&&this.search("StreetNumber",{street:this.street.getValue()}):this.street.select(0)},setStreetNumbers:function(a){this.getStreetNumber().setOptions({max_results:a.length}).setItems(a,!1,!0),1!==a.length||this.streetNumber.getValue()?!this.buffer.Zone&&this.streetNumber.getValue()&&this.searchZone():this.streetNumber.select(0)},walkBuffer:function(){["Place","Street","StreetNumber","Zone"].some(function(a){return!!this.buffer[a]&&(this.buffer[a].apply(this),delete this.buffer[a],!0)}.bind(this))},search:function(a,b){delete this.buffer[a],this.buffer[a]=function(){var c=this.zip.value+(b&&Object.toQueryString(b)||"");this.cache[a]&&this.cache[a][c]?(this["set"+a+"s"](this.cache[a][c]),0===this.requests.running&&this.fireEvent.delay(50,this,["searchesComplete"])):(this.requests[a]||(this.requests[a]=new Request.JSON({link:"cancel"}).addEvents({request:function(){this.requests.running++}.bind(this),complete:function(){this.requests.running--,0===this.requests.running&&this.fireEvent("searchesComplete")}.bind(this),success:function(b){this.cache[a]||(this.cache[a]={}),this.cache[a][this.requests[a].cache]=b,this["set"+a+"s"](b)}.bind(this)})),this.requests[a].cache=c,this.requests[a].send({data:{actions:{list:{type:"Risikozonen"+a,search:"",limit:20,params:Object.merge({zip:this.zip.value},b||{})}}}}))},0===this.requests.running&&this.walkBuffer()}});document.Initializer.add({selector:".risikozonen",Class:a})}();