(function($){function offerteFormStap1Handler(){var bereken=function(){var hellingshoek=$('#hellingshoek').val(),orientatie=$('#orientatie').val(),lokatie=$('#locatie').val(),dakBreedte=new Number($('#breedte').val()),dakLengte=new Number($('#lengte').val()),hellingshoekGewicht={'0':1,'15':0.9,'20':1,'35':1,'45':1,'60':0.9},orientatieGewicht={'n':0.4,'no':0.4,'o':0.8,'zo':0.95,'z':1,'zw':0.95,'w':0.9,'nw':0.5},lokatieGewicht={'w':0.9,'m':0.87,'o':0.85},kostenEnergie=0.22,paneelLengteDakSchuin=1.655,paneelBreedteDakSchuin=0.995,paneelVermogenDakSchuin=235,paneelLengteDakPlat=1.655,paneelBreedteDakPlat=2.260,paneelVermogenDakPlat=235,aantalPanelenDakSchuin=Math.floor(dakBreedte/paneelBreedteDakSchuin)*Math.floor(dakLengte/paneelLengteDakSchuin),aantalPanelenDakPlat=Math.floor(dakBreedte/paneelBreedteDakPlat)*Math.floor(dakLengte/paneelLengteDakPlat),vermogenDakSchuin=aantalPanelenDakSchuin*paneelVermogenDakSchuin,vermogenDakPlat=aantalPanelenDakPlat*paneelVermogenDakPlat,gebruikPanelenDakSchuin=hellingshoek>=20&&vermogenDakSchuin>vermogenDakPlat,aantalPanelen=gebruikPanelenDakSchuin?aantalPanelenDakSchuin:aantalPanelenDakPlat,vermogen=gebruikPanelenDakSchuin?vermogenDakSchuin:vermogenDakPlat,rendement=vermogen*new Number(hellingshoekGewicht[hellingshoek])*new Number(orientatieGewicht[orientatie]),opbrengstKWu=rendement*new Number(lokatieGewicht[lokatie]),opbrengstEuro=opbrengstKWu*kostenEnergie;if(!isNaN(vermogen)){setCookie('aantalwp',Math.round(vermogen));} if(!isNaN(aantalPanelen)){setCookie('aantalpanelen',aantalPanelen);} if(!isNaN(opbrengstKWu)){setCookie('energieopbrengst',Math.round(opbrengstKWu));} if(!isNaN(opbrengstKWu)){setCookie('co2besparing',Math.round(opbrengstKWu*0.566));} if(!isNaN(opbrengstEuro)){setCookie('geldbesparing',Math.round(opbrengstEuro));} $('#result-aantalpanelen dd span').text(isNaN(aantalPanelen)?'--':aantalPanelen);$('#result-wp dd span').text(isNaN(vermogen)?'--':Math.round(vermogen));$('.co2 span').text(isNaN(opbrengstKWu)?'--':Math.round(opbrengstKWu*0.566));$('#result-opbrengst dd span').text(isNaN(opbrengstKWu)?'--':Math.round(opbrengstKWu));$('#result-besparing dd span').text(isNaN(opbrengstEuro)?'--':Math.round(opbrengstEuro));$('#result-wp dd span, #result-opbrengst dd span, #result-besparing dd span').css('color','#2bb245');return vermogen;};$('#hellingshoek').change(function(){$('.house img').attr('src','/theme/atama/default/img/offerte/huis-'+this.value+'.png');});$('#orientatie').change(function(){$('.wind img').attr('src','/theme/atama/default/img/offerte/wind-'+this.value+'.png');});$('#breedte, #lengte').focus(function(){$(this).removeClass('idleField').addClass('focusField');if(this.value==this.defaultValue){this.value='';}});$('#breedte, #lengte').blur(function(){$(this).removeClass('focusField').addClass('idleField');if($.trim(this.value)==''){this.value=this.defaultValue;}});$('#hellingshoek, #orientatie, #breedte, #lengte, #locatie').change(bereken);$('input[name="type-offerte"]:radio').change(function(){if($(this).val()==='prive'){$('#result-besparing-prive').show();$('#result-besparing-zakelijk').hide();}else{$('#result-besparing-prive').hide();$('#result-besparing-zakelijk').show();}});$('#offerteform form').validate({errorLabelContainer:$('#offerteform div.error'),rules:{hellingshoek:{required:true},orientatie:{required:true},breedte:{required:true,number:true},lengte:{required:true,number:true},locatie:{required:true}},messages:{breedte:'Vul de breedte van uw dak in',lengte:'Vul de lengte van uw dak in'},submitHandler:function(form){setCookies({'hellingshoek':$('#hellingshoek').val(),'orientatie':$('#orientatie option:selected').text(),'afmeting':$('#lengte').val()+' x '+$('#breedte').val(),'oppervlakte':$('#lengte').val()*$('#breedte').val(),'locatie':$('#locatie option:selected').text(),'type':$('input[name="type-offerte"]:checked').val()});form.submit();}});} function offerteFormStap2Handler(){$(function(){var n,c=getCookies();for(n in c){switch(n){case'type':if(c[n]==='prive'){$('.offerte-prive').show();$('.offerte-zakelijk').hide();}else{$('.offerte-prive').hide();$('.offerte-zakelijk').show();} break;case'geldbesparing':$('#geldbesparing').val((c['type']=='prive'?c[n]:'n.v.t.'));$('.samenvatting-'+n+' span').text(c[n]);break;default:$('#'+n).val(c[n]);$('.samenvatting-'+n+' span').text(c[n]);break;}}});$('#phone').mask('9999999999');$('#zip').mask('9999 aa');$('#offerteform').validate({errorLabelContainer:$('#offerteform div.error'),rules:{first_name:{required:true,maxlength:50},last_name:{required:true,maxlength:50},company:{maxlength:50},email:{required:true,maxlength:255,email:true},phone:{required:true,rangelength:[10,10]},street:{required:true,maxlength:50},zip:{required:true,rangelength:[7,7]},city:{required:true,maxlength:50},'00N200000020HCN':{required:true},},messages:{first_name:'Vul uw voornaam in.',last_name:'Vul uw achternaam in.',company:'Vul uw achternaam in.',email:'Vul een geldig email adres in.',phone:'Vul uw telefoonnumer in.',street:'Vul uw straatnaam in.',zip:'Vul uw postcode in.',city:'Vul uw woonplaats in.','00N200000020HCN':'Selecteer een dakbedekking.',}});} function setCookie(name,value,path){path=path||'/';document.cookie=name+'='+escape(value)+'; path='+path;} function setCookies(cookies,ttl){for(var c in cookies){setCookie(c,cookies[c],ttl);}} function getCookie(name){var n,c=getCookies();for(n in c){if(n==name){return c[n];}}} function getCookies(){var i,o={},c=document.cookie.split(';'),n,v;for(i=0;i