").text(t))})}function n(){$(".error-email").empty();$(".error-password").empty();$(".error-confirm-password").empty();$(".error-fullname").empty();$(".error-streetaddress").empty();$(".error-country").empty();$(".error-state").empty();$(".error-city").empty();$(".error-zipcode").empty();$(".error-phone").empty();$(".error-customertype").empty();$(".error-industryid").empty();$(".error-block").empty()}function u(){var t;if(f()){var i=$("#custom-registration-form")[0],n=new FormData(i);n.delete("Email");n.append("Email",$("#Email").val());n.append("Password",$("#Password").val());n.append("ConfirmPassword",$("#ConfirmPassword").val());t=$("input[name=__RequestVerificationToken]");t.length&&n.append("__RequestVerificationToken",t.val());$("#step1-loading-progress").css("display","");$.ajax({cache:!1,type:"POST",contentType:!1,processData:!1,url:"/customer/registerstep1",data:n,headers:{RequestVerificationToken:t.val()},success:function(n){n.ReturnUrl!=null?window.location.href=n.ReturnUrl:e(n);$("#step1-loading-progress").css("display","none")},error:function(){}})}}function f(){n();let t=[],i="Email is required",r="Password is required",u="Confirm Password is required";return $("#Email").val()?$(".error-email").empty():($(".error-email").text(i),t.push(i)),$("#Password").val()?$(".error-password").empty():($(".error-password").text(r),t.push(r)),$("#ConfirmPassword").val()?$(".error-confirm-password").empty():($(".error-confirm-password").text(u),t.push(u)),t.length===0}function e(t){t.Success?($("#registrationStep1").css("display","none"),$("#registrationStep2").css("display","block"),$("#registrationStep3").css("display","none"),$("#ConfirmEmail").val($("#Email").val())):(n(),i(t.Errors))}function o(){var t;if(s()){var i=$("#custom-registration-form")[0],n=new FormData(i);n.delete("Email");n.append("Email",$("#Email").val());n.append("Password",$("#Password").val());n.append("ConfirmPassword",$("#ConfirmPassword").val());n.append("FullName",$("#FullName").val());n.append("StreetAddress",$("#StreetAddress").val());n.append("StreetAddress2",$("#StreetAddress2").val());n.append("CountryId",$("#CountryId").val());n.append("StateProvinceId",$("#StateProvinceId").val());n.append("City",$("#City").val());n.append("ZipPostalCode",$("#ZipPostalCode").val());n.append("Phone",$("#Phone").val());n.append("CustomerType",$("input[type=radio][name=CustomerType]:checked").val());n.append("IndustryId",$("#IndustryId").val());n.append("TaxId",$("#TaxId").val());n.append("License",$("#License").val());n.append("LicenseReason",$("#LicenseReason").val());n.append("quote_id","");n.append("nurl","step6");n.append("returnUrl",$("#returnUrl").val());t=$("input[name=__RequestVerificationToken]");t.length&&n.append("__RequestVerificationToken",t.val());$("#step2-loading-progress").css("display","");$.ajax({cache:!1,type:"POST",contentType:!1,processData:!1,url:"/customer/registerstep2",data:n,headers:{RequestVerificationToken:t.val()},success:function(n){h(n);$("#step2-loading-progress").css("display","none");formInputs()},error:function(){}})}}function s(){let n=[],t="Full name is required",i="Address is required",r="Country is requried",u="State is required",f="City is required",e="Zip code is required",o="Phone number is required",s="Customer type is required.",h="Industry type is required";return $("#FullName").val()?$(".error-fullname").empty():($(".error-fullname").text(t),n.push(t)),$("#StreetAddress").val()?$(".error-streetaddress").empty():($(".error-streetaddress").text(i),n.push(i)),$("#CountryId").val()&&$("#CountryId").val()!="0"?$(".error-country").empty():($(".error-country").text(r),n.push(r)),$("#StateProvinceId").val()&&$("#StateProvinceId").val()!="0"?$(".error-state").empty():($(".error-state").text(u),n.push(u)),$("#City").val()?$(".error-city").empty():($(".error-city").text(f),n.push(f)),$("#ZipPostalCode").val()?$(".error-zipcode").empty():($(".error-zipcode").text(e),n.push(e)),$("#Phone").val()?$(".error-phone").empty():($(".error-phone").text(o),n.push(o)),$("input[type=radio][name=CustomerType]:checked").val()?$(".error-customertype").empty():($(".error-customertype").text(s),n.push(s)),$("input[type=radio][name=CustomerType]:checked").val()&&$("input[type=radio][name=CustomerType]:checked").val()=="2"&&($("#IndustryId").val()&&$("#IndustryId").val()!="0"?$(".error-industryid").empty():($(".error-industryid").text(h),n.push(h))),n.length===0}function h(t){t.Success?($("#registrationStep1").css("display","none"),$("#registrationStep2").css("display","none"),$("#registrationStep3").css("display","block"),$("#lblEmail").text($("#Email").val()),$("#registrationStatus").val("success"),$("html, body").animate({scrollTop:0},"slow"),t.ReturnUrl&&($("#redirectionMsg").css("display","block"),setTimeout(function(){window.location.href=t.ReturnUrl+"?IsNew=1"},500))):(n(),i(t.Errors))}var t,r;$("#CountryId").on("change",function(){addresAutoComplete=!1;stateCode="";GetStates()});$("#StreetAddress").change(function(){$(".divAddressBlock").css("display","block")});$("#btnStreetAddress2").on("click",function(){$("#divBtnStreetAddress2").css("display","none");$("#divStreetAddress2").css("display","block")});t=document.getElementById("Phone");t.addEventListener("blur",function(){FormatPhone(this)});$("input[type=radio][name=CustomerType]").change(function(){var n=$("input[type=radio][name=CustomerType]:checked").val();n=="1"?($("#IndustryId").val("0"),$("#divIndustry").css("display","none"),$("#divTaxId").css("display","none"),$("#divLicense").css("display","none"),$("#divLicenseReason").css("display","none"),$("#divLicenseNo").css("display","none"),$("#divLicenseYes").css("display","none")):n=="2"&&($("#divIndustry").css("display","block"),$("#divTaxId").css("display","block"),$("#divLicense").css("display","block"),$("#divLicenseNo").css("display","block"))});$("#btnLicenseNo").on("click",function(){$("#License").val("");$("#divLicense").css("display","none");$("#divLicenseNo").css("display","none");$("#divLicenseReason").css("display","block");$("#divLicenseYes").css("display","block")});$("#btnLicenseYes").on("click",function(){$("#LicenseReason").val("");$("#divLicense").css("display","block");$("#divLicenseNo").css("display","block");$("#divLicenseReason").css("display","none");$("#divLicenseYes").css("display","none")});$(".step1-continue").on("click",function(){var n=u()});r=function(){grecaptcha.render("dynamic-recaptcha",{sitekey:"6LefrEMpAAAAAAAPfHq5EFD2aghvjMJUb3jEvgSe==",callback:function(n){$('input[name="g-recaptcha-response"]').val(n)}})};$(".step2-register").on("click",function(){grecaptcha.ready(function(){grecaptcha.execute("6LefrEMpAAAAAAAPfHq5EFD2aghvjMJUb3jEvgSe==",{action:"Register"}).then(function(n){$('input[name="g-recaptcha-response"]').val(n);var t=o()})})})})