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){this.Calculator=Class.refactor(window.Calculator,{init:function(){this.previous.apply(this,arguments),this.firstVp=this.element.getElements(".steps > .step > .substeps .substep")[1].retrieve("Substep").addEvent("show",this.updateVps.bind(this)),this.oldCountVps=this.countVps=$$("input[name=Vertrag_anzahl_personen_form]")[0].value},toggleHealthQuestion:function(a,b){var c=a.getForm(),d=$(a.name+"_textarea"),e=a.value.toBoolean();$$([d,d.get("slide").wrapper]).setStyles({overflow:"hidden"}),d.get("slide").addEvent("complete:once",function(){c.validate({showErrors:!1}),$$([d,d.get("slide").wrapper]).setStyles({overflow:"inherit",height:"auto"})})["slide"+(e===b?"In":"Out")]()},updateVps:function(){if(this.oldCountVps!==this.countVps){var b,c,d,e=this.firstVp.step,f=e.element,g=new Element("div.hidden").inject(f),h=new Element("div.substeps").inject(g),i=function(a,b,c){return a.get(b)&&a.set(b,a.get(b).replace("##",c)),i},j=this.firstVp.getLength(),k=this.firstVp.index+this.countVps,l=function(a){i(a,"name",c)(a,"id",c)},m=function(a){i(a,"id",c)(a,"for",c)};if(j>k){for(;j>k;)e.removeSubstep(this.firstVp.getLast(),!0),j=this.firstVp.getLength();e.updateSubsteps()}if(k>j){for(;k>j;)c=j-this.firstVp.index,b=new Element("div.substep.step"+(this.firstVp.index+1)+".form.hidden").inject(h),d=this.element.getElement(".versicherteperson-template").cloneNode(!0),d.removeClass("versicherteperson-template").removeClass("form").removeClass("form-pseudo").removeClass("hidden").inject(b),d.getElements("input,textarea,button").each(l),d.getElements("label").each(m),d.getElement(".form-caption").set("html",d.getElement(".form-caption").get("html").replace("##",c+1)),d.getElements(".pseudo-input").removeClass("pseudo-input"),b.adopt(this.firstVp.element.getElement(".buttons").cloneNode(!0)),j++;a.Initializer.run(g),e.addSubsteps(h.getChildren(".substep").retrieve("Substep")),g.dispose()}this.oldCountVps=this.countVps,e.validator.initChildForms(),this.firstVp.each(function(a){a.isLast()?(a.element.getElement(".buttons .next-substep").addClass("hidden"),a.element.getElement(".buttons .next-step").removeClass("hidden")):(a.element.getElement(".buttons .next-substep").removeClass("hidden"),a.element.getElement(".buttons .next-step").addClass("hidden")),a.validator.validate({showErrors:!1})},this,this.firstVp),this.firstVp.step.validate()}},isStepValid:function(){return this.oldCountVps===this.countVps&&this.firstVp.every(function(a){return a.isValid()},null,this.firstVp)},setVpCount:function(a){this.countVps=Math.max(1,a),this.firstVp.step.validate()},autochangeNextVps:function(a,b,c){this.firstVp.eachNext(function(d){var e,f=d.element.getElement("."+a+":not(.changed)");f&&(b.hasClass("slidebar")?(e=f.retrieve("SlideBar"),e.init_done=!1,e.set(c),e.init_done=!0):f.getElement("input").set("value",c))})}}),Form.Validator.addAllThese([["validate-ja-required-radio",{errorMsg:'Die Frage muss mit "Ja" beantwortet werden.',test:function(b){var c=a.getElementById(b.get("id").replace("_0","_1")).checked;if(c){var d=a.getElementById(b.get("id").replace("_1","_0")),e=a.getElementById("label_"+b.get("id").replace("_1","_0"));d.removeClass("validation-failed"),d.removeClass("input-validation-failed"),d.addClass("validation-passed input-validation-passed"),e.removeClass("validation-failed"),e.removeClass("input-validation-failed")}return c}}],["validate-nein-required-radio",{errorMsg:"Auf Grund der Vorerkrankung ist kein Abschluss möglich.",test:function(b){var c=a.getElementById(b.get("id").replace("_1","_0")).checked;if(c){var d=a.getElementById(b.get("id").replace("_0","_1")),e=a.getElementById("label_"+b.get("id").replace("_0","_1"));d.removeClass("validation-failed"),d.removeClass("input-validation-failed"),d.addClass("validation-passed input-validation-passed"),e.removeClass("validation-failed"),e.removeClass("input-validation-failed")}return c}}]])}(document); !function(){var a=[{property:"geburtsdatum",customer:"geburtsdatum",check:!0},{property:"vorname",customer:"vorname_person"},{property:"nachname",customer:"nachname_person"}],b=new Class({Extends:Component,property:"VpForm",initialize:function(a,b){if(this.parent(a,b),this.occlude())return this.occluded},add:function(a){var b,c=a.getForm(),d=this.element.getElement(".versicherteperson-template").cloneNode(!0),e=this.element.getElements(".versicherteperson-form"),f=e.length,g=this.options.max,h=this.options.min,i=function(a,b){return a.get(b)&&a.set(b,a.get(b).replace("##",f)),i},j={};d.removeClass("versicherteperson-template").removeClass("form").removeClass("form-pseudo").addClass("versicherteperson-form").inject(a,"before"),e.push(d),b=this.element.getElements(".versicherteperson-form .form-grid .versicherteperson-delete"),b.length>h+1&&(b=$$(b.getLast())),d.getElements("input,textarea,button").each(function(a){i(a,"name")(a,"id"),c.addField(a)}),d.getElements("label").each(function(a){i(a,"id")(a,"for")}),d.getElement(".form-caption").set("html",d.getElement(".form-caption").get("html").replace("##",f+1)),d.getElements(".pseudo-input").removeClass("pseudo-input"),document.Initializer.run(d),d.hasClass("versicherteperson-inheritance")&&(d.removeClass("versicherteperson-inheritance"),this.inheritance(d,f)),b.each(function(a,b){j[b]={opacity:1}}),new Fx.Elements(b.setStyle("opacity",0).removeClass("hidden")).start(j),g&&e.length===g&&a.addClass("disabled"),d.get("slide").addEvent("complete",function(){c.validate({showErrors:!1})}).slideIn()},inheritance:function(a,b){elements=a.getElements("input[type=text],input[type=checkbox]"),elements.each(function(a){return elemTemplateName=a.name.replace("["+b+"]","[0]"),elemTemplate=$$$('input[name="'+elemTemplateName+'"]'),"checkbox"==a.type?void(a.checked!==elemTemplate.checked&&a.click()):a.getParent().hasClass("dateinput")?void a.retrieve("DateInput").setValue(elemTemplate.retrieve("DateInput").Date).format():a.hasClass("select-value")?void a.retrieve("SelectBox").setValue(elemTemplate.value):void 0})},remove:function(a){var b,c=a.getForm(),d=this,e=d.element.getElements(".versicherteperson-form"),f=a.getParent(".versicherteperson-form"),g=(this.options.max,this.options.min),h=0,i=function(a,b){return a.get(b)&&a.set(b,a.get(b).replace(/\[\d+\]/,"["+h+"]")),i};e.each(function(a){a!==f&&(a.getElements("input,textarea,button").each(function(a){i(a,"name")(a,"id")}),a.getElements("label").each(function(a){i(a,"id")(a,"for")}),a.getElement(".form-caption").set("html",a.getElement(".form-caption").get("html").replace(/\d+$/,h+1)),h++)}),f.get("slide").addEvent("complete",function(){this.wrapper.dispose(),d.element.getElement(".form-grid-add").removeClass("disabled"),c.validate({showErrors:!1})}).slideOut(),e.length-1===g&&(b=$$(".versicherteperson-form .form-grid-delete").erase(a),new Fx.Elements(b).addEvent("complete",function(){b.addClass("hidden")}).start({0:{opacity:1}}))},checkVnPossibility:function(b){return a.filter(function(a){return a.check}).every(function(a){var c=this.element.getParentStep().getFirst().element,d=c.getElement('input[name="Vertrag_Kunde_'+a.customer+'"]'),e=b.getElement('input[name="Vertrag_versichertepersonen['+b.getDataAttribute("index")+"]["+a.property+']"]');return d.get("value")===e.get("value")},this)},checkVnPossibilities:function(){var a=!1,b=this.element.getElement(".versicherteperson-form.toggler-changed .vn-toggler:checked");return b&&(this.checkVnPossibility(b.getParent(".versicherteperson-form"))||(a=!0,b.set("checked",!1).setDisabled(!0))),this.element.getElements(".versicherteperson-form:not(.toggler-changed)").each(function(b){this.checkVnPossibility(b)?(b.getElement(".vn-toggler").setDisabled(!1),a||(a=!0,b.getElement(".vn-toggler").set("checked",!0))):b.getElement(".vn-toggler").set("checked",!1).setDisabled(!0)},this),this.toggleIsVnTogglers()},toggleIsVnTogglers:function(){return this.element.getElements(".vn-toggler").each(function(a){this.toggleIsVn(a,!0)},this),this},toggleIsVn:function(a,b,c,d){var e=a.getParent(".versicherteperson-form");return b||e.addClass("toggler-changed"),a.checked?(c||this.element.getElements(".vn-toggler:checked").each(function(b){a!==b&&(b.set("checked",!1),this.toggleIsVn(b,!0,!0,!0))},this),this.syncVpForm(e,null,null,!0)):this.unsyncVpForm(e,!0),d||this.element.getForm().validate({showErrors:!1}),this},watchVnFields:function(){return a.each(function(a){var b,c,d=this.element.getParentStep().getFirst().element.getElement('input[name="Vertrag_Kunde_'+a.customer+'"]');c=(this.options.sync.contains(a.property)?function(c){(b=this.element.getElement(".vn-toggler:checked"))&&this.syncVpForm(b.getParent(".versicherteperson-form"),[d],[a])}:function(){this.checkVnPossibilities()}).bind(this),d.addEvents({change:c,validationPassed:c,validationFailed:c})},this),this},syncVpForm:function(b,c,d,e){(d||a.filter(function(a){return this.options.sync.contains(a.property)},this)).each(function(a,d){var e=c&&c[d]||this.element.getParentStep().getFirst().element.getElement('input[name="Vertrag_Kunde_'+a.customer+'"]'),f=b.getElement('input[name="Vertrag_versichertepersonen['+b.getDataAttribute("index")+"]["+a.property+']"]');f.setDisabled(!0),f.retrieve("origValue",f.get("value")),f.retrieve("DateInput")?f.retrieve("DateInput").setDisabled(!0).setValue(f.retrieve("DateInput")):f.set("value",e.get("value"))},this),e||this.element.getForm().validate({showErrors:!1})},unsyncVpForm:function(b,c){a.filter(function(a){return this.options.sync.contains(a.property)},this).each(function(a,c){var d=b.getElement('input[name="Vertrag_versichertepersonen['+b.getDataAttribute("index")+"]["+a.property+']"]'),e=d.retrieve("origValue","");d.eliminate("origValue",""),d.setDisabled(!1),d.retrieve("DateInput")?d.retrieve("DateInput").setDisabled(!1).setValue(e):d.set("value",e)}),c||this.element.getForm().validate({showErrors:!1})},toggleVpFieldGroup:function(a){var b=a.closest(".form-grid").querySelector(".subgroup");if(a.checked)return void new Fx.Slide(b).slideIn();new Fx.Slide(b).slideOut()}});window.Order=Class.refactor(window.Order,{initialize:function(){this.previous.apply(this,arguments),this.element.addEvent("reload",function(){document.Initializer.addEvent("complete:once",function(){this.element.getElement(".versichertepersonen").retrieve("VpForm").watchVnFields().checkVnPossibilities()}.bind(this))}.bind(this))}}),document.Initializer.add({selector:".versichertepersonen",Class:b})}();