var privacyChicesGeneral=new function(){var i={PropertyFindProperty:"Warranty/FindProperties",NewCaptcha:"captcha/GetCaptcha",PlayAudio:"captcha/GetAudio",Validate:"captcha/Validate"},n="",r={op:"",src:""},o=function(u){r=w(window.location.href);window.history.pushState({page:""},"","Home");n=u;h(r.op);$('input[type="tel"]').mask("(000) 000-0000");$("input#Zip").mask("00000");$('input[name="IsHortonBuyer"]').on("change",function(){$(this).val()==="1"?($("#FindZipcode").focus(),$("#FoundHouse").show(),$("#NotesNoVisit").hide()):($("#FoundHouse").hide(),$("#FindZipcode").val(""),t([],"FindHouseNumber"),$("input:radio[name='IsHortonLease']:checked").val()==="0"?$("#NotesNoVisit").show():$("#NotesNoVisit").hide())});$('input[name="IsHortonLease"]').on("change",function(){$(this).val()==="1"?($("#FindZipcodeLease").focus(),$("#FoundHouseLease").show(),$("#NotesNoVisit").hide()):($("#FoundHouseLease").hide(),$("#FindZipcodeLease").val(""),t([],"FindHouseNumberLease"),$("input:radio[name='IsHortonBuyer']:checked").val()==="0"?$("#NotesNoVisit").show():$("#NotesNoVisit").hide())});$('input[name="UseHortonInsurance"]').on("change",function(){$(this).val()==="1"?$("#YesUseHortonInsurance").show():($("#YesUseHortonInsurance").hide(),$("#HortonInsurancePolicy").val(""))});$('input[name="UseHortonMortgage"]').on("change",function(){$(this).val()==="1"?$("#YesUseHortonMortgage").show():($("#YesUseHortonMortgage").hide(),$("#HortonMortgageLoan").val(""))});$('input[name="UseHortonTitle"]').on("change",function(){$(this).val()==="1"?$("#YesUseHortonTitle").show():($("#YesUseHortonTitle").hide(),$("#HortonTitleEscrow").val(""))});$("#ResidencePlace").on("change",function(){$(this).val()==="OTHER"?$("#OtherState").show():$("#OtherState").val("").hide()});$("#captchaText").on("keyup",function(){$("#captcha div.captcha-code i.error").hide();$("#captcha div.captcha-code i.correct").hide();$(this).val().length===5?y():$("#captcha").attr("captcha-valid","false")});$("#submit").on("click",function(){l()});$("body").on("click","div.captcha a.speak",function(n){n.stopPropagation();p()});$("body").on("click","div.captcha a.refresh",function(n){n.stopPropagation();f(!1)});$("#FindZipcode").on("keyup",function(){if(""!==this.value&&this.value.length===5){$("label[for='FindHouseNumber']").text("Loading....");var r=n+i.PropertyFindProperty+"?";r+="postalCode="+$("#FindZipcode").val();r+="&onlyCloseLots=true";!1&&(r+="&houseNumber=");$.getJSON(r,function(n){t(n,"FindHouseNumber")})}else t([],"FindHouseNumber")});$("#FindZipcodeLease").on("keyup",function(){if(""!==this.value&&this.value.length==5){$("label[for='FindHouseNumberLease']").text("Loading....");var r=n+i.PropertyFindProperty+"?";r+="postalCode="+$("#FindZipcodeLease").val();r+="&onlyCloseLots=true";!1&&(r+="&houseNumber=");$.getJSON(r,function(n){t(n,"FindHouseNumberLease")})}else t([],"FindHouseNumberLease")});$.validator.addMethod("valueNotEquals",function(n,t,i){return i!==n});$("input[type='radio'][value='0']").each(function(){$(this).attr("checked","true")});f(!0);c()};this.init=o;var t=function(n,t){var i,r;addressListCustom=[];addressListOriginal=[];addressListOriginal=n;$("#"+t).val("");$.grep(n,function(n,t){addressListCustom[t]={name:n.Address+", "+n.City+", "+n.State+" "+n.PostalCode,code:""+n.LotId+""}});i=$.Event("keyup");i.keyCode=50;r=$.Event("keyup");r.keyCode=27;$("#"+t).easyAutocomplete({data:addressListCustom,getValue:"name",placeholder:"Find and Select your House Address",highlightPhrase:!0,list:{maxNumberOfElements:500,match:{enabled:!0},sort:{enabled:!0},onMouseOverEvent:function(){($("#"+t).val().length===0||$("#"+t).val()==="")&&$("label[for='"+t+"']").show();$("#eac-container-"+t+" ul li").removeClass("selected")},onClickEvent:function(){$("label[for='"+t+"']").hide();$("#eac-container-"+t+" ul li.selected").length>0?($("body .contact-info").removeClass("hide"),$("#eac-container-"+t+" ul").removeClass("force-display")):$("body .contact-info").addClass("hide")}}});$("#eac-container-"+t+" ul").on("scroll",function(){$(this).addClass("force-display")});$("#"+t).on("click keyup focus focusout",function(){var n=this.value.trim();n.length===0?($("#eac-container-"+t+" ul:first").show(),$("label[for='"+t+"']").show()):($("label[for='"+t+"']").hide(),$("#eac-container-"+t+" ul").removeClass("force-display"))});$("label[for='"+t+"']").on("click fucus",function(){$("#"+t).focus()});n.length>0?($("label[for='"+t+"']").removeClass("findHouseLabel").addClass("findHouseLabelNo"),s(t)):($("label[for='"+t+"']").text("No Address found on Zip Code "+$("#"+t).val()),$("label[for='"+t+"']").removeClass("findHouseLabel").addClass("findHouseLabelNo"),$("#eac-container-"+t+" ul:first").hide())},s=function(n){var t=jQuery.Event("keyup",{keyCode:65,which:65}),i=jQuery.Event("keyup",{keyCode:8,which:8});$("#"+n).focus();$("#"+n).attr("value","");$("#"+n).triggerHandler(t);$("#"+n).triggerHandler(i);$("#"+n).trigger("change");addressListCustom.length>0?($("#"+n).removeAttr("disabled").focus(),$("#eac-container-"+n+" ul:first").show()):($("label[for='"+n+"']").text("No Address found on Zip Code "+$("#zipcode").val()),$("#eac-container-"+n+" ul:first").hide())},h=function(n){$("div.form-page #frmPrivacyData").show();$("div.form-page #frmPrivacyData div.grid > div.op1").hide();$("div.form-page #frmPrivacyData div.grid > div.op2").hide();$("div.form-page #frmPrivacyData div.grid > div.op3").hide();$("div.container > div.form-page.op1").hide();$("div.container > div.form-page div.form-content p.op1").hide();$("div.container > div.form-page.op2").hide();$("div.container > div.form-page div.form-content p.op2").hide();$("div.container > div.form-page.op3").hide();$("div.container > div.form-page div.form-content p.op3").hide();n==="op1"?($("div.form-page #frmPrivacyData div.grid > div.op1").show(),$("div.container > div.form-page.op1").show(),$("div.container > div.form-page div.form-content p.op1").show()):n==="op2"?($("div.form-page #frmPrivacyData div.grid > div.op2").show(),$("div.container > div.form-page.op2").show(),$("div.container > div.form-page div.form-content p.op2").show()):n==="op3"&&($("div.form-page #frmPrivacyData div.grid > div.op3").show(),$("div.container > div.form-page.op3").show(),$("div.container > div.form-page div.form-content p.op3").show())},c=function(){$("form#frmPrivacyData").validate({errorClass:"error",highlight:function(n){$(n).addClass("invalid").removeClass("valid")},unhighlight:function(n){$(n).removeClass("invalid").addClass("valid")},rules:{FirstName:{required:!0,minlength:2},LastName:{required:!0,minlength:2},Email:{required:!0,email:!0,accept:!0},PhoneNumber:{required:!0,minlength:3},Address:{required:!0},City:{required:!0},State:{required:!0,valueNotEquals:"na"},Zip:{required:!0,digits:!0,minlength:5,maxlength:5},FindHouseNumber:{required:function(){return $("#FindHouseNumber").val()===""},minlength:1},FindZipcode:{required:!0,digits:!0,minlength:5,maxlength:5},FindHouseNumberLease:{required:function(){return $("#FindHouseNumberLease").val()===""},minlength:1},FindZipcodeLease:{required:!0,digits:!0,minlength:5,maxlength:5},captchaText:{required:!0,minlength:5,maxlength:5},SendMyInformation:{required:!0},DeleteMyInformation:{required:!0},HortonTitleEscrow:{required:!0},HortonMortgageLoan:{required:!0},HortonInsurancePolicy:{required:!0},ResidencePlace:{required:!0,valueNotEquals:"na"},Other:{required:!0}},messages:{FirstName:{required:"First Name is required"},LastName:{required:"Last Name  is required"},Email:{required:"Email Address is required",email:"Please enter a valid email address"},PhoneNumber:{required:"Phone Number is required"},Address:{required:"Physical Address information is required"},City:{required:"City is required"},State:{required:"State",valueNotEquals:"Please select the state"},Zip:{required:"Zip Code is required",minlength:"Zip code must be at least 5 characters"},FindHouseNumber:{required:"Please select a valid address from the list"},FindZipcode:{required:"Zip code is required to search your house",minlength:"Zip code must be at least 5 characters"},FindHouseNumberLease:{required:"Please select a valid address from the list"},FindZipcodeLease:{required:"Zip code is required to search your house",minlength:"Zip code must be at least 5 characters"},captchaText:{required:"Captcha text is required",minlength:"",maxlength:""},SendMyInformation:{required:"Option required"},DeleteMyInformation:{required:"Option required"},HortonTitleEscrow:{required:"Escrow number is required"},HortonMortgageLoan:{required:"Loan number is required"},HortonInsurancePolicy:{required:"Policy number is required"},ResidencePlace:{required:"Place of Residence",valueNotEquals:"Please select your place of residence"},Other:{required:"Please specify your place of residence"}}})},l=function(){$("form#frmPrivacyData").valid()&&$("#captcha").attr("captcha-valid")==="true"?v():$("#captcha").attr("captcha-valid")==="false"?($("#captchaText-error").text("Captcha text is required").show(),$("#captchaText").focus()):$("#captchaText-error").hide()},a=function(){var n=r.op.trim(),t=$("#FindHouseNumber").val(),i=$("#FindHouseNumberLease").val();return{SelectedOption:n==="op1"?1:n==="op2"?2:3,FirstName:$("#FirstName").val(),LastName:$("#LastName").val(),Email:$("#Email").val(),Phone:$("#PhoneNumber").val(),Address:$("#Address").val(),City:$("#City").val(),State:$("#State").val()===null?"":$("#State").val(),ZipCode:$("#Zip").val(),IsCaliResident:0,IsHortonBuyer:$("input[name='IsHortonBuyer']:checked").val()==="1",NotesOfVisit:$("#NotesVisited").val(),NotesOfNoVisit:$("#NotesNoVisited").val(),HortonZip:$("#FindZipcode").val(),HortonAddress:t,SendMyInfo:n==="op2",DeleteMyInfo:n==="op3",UseHortonInsurance:$("input[name='UseHortonInsurance']:checked").val()==="1",HortonInsurancePolicy:$("#HortonInsurancePolicy").val(),UseHortonMortgage:$("input[name='UseHortonMortgage']:checked").val()==="1",HortonMortgageLoan:$("#HortonMortgageLoan").val(),UseHortonTitle:$("input[name='UseHortonTitle']:checked").val()==="1",HortonTitleEscrow:$("#HortonTitleEscrow").val(),ReferenceCode:r.src,PlaceOfResidence:$("#ResidencePlace").val(),Other:$("#Other").val(),IsConfirmDeletion:!1,RequestInfoType:n==="op2"?$("input[name='RequestType']:checked").val():0,IsHortonLease:$("input[name='IsHortonLease']:checked").val()==="1",HortonLeaseZip:$("#FindZipcodeLease").val(),HortonLeaseAddress:i}},v=function(){var n=a();n.SelectedOption===3?Swal.fire({allowOutsideClick:!1,title:'<span class="modal-title">Confirmation<\/span>',html:'<div class="modal-text-confirm">You are about to submit a request to delete your personal information<br />Are your sure you wish to continue?<\/div>',showCancelButton:!0,cancelButtonColor:"#999999",cancelButtonText:"No, Cancel",confirmButtonColor:"#1a415d",confirmButtonText:"Yes, Submit",reverseButtons:!0}).then(function(t){t.value&&(n.IsConfirmDeletion=!0,u(n))}):u(n)},u=function(n){$.ajax({type:"POST",dataType:"json",url:"/Home/CreateNewRequest",data:{model:n},beforeSend:function(){$("#loading").removeClass("hide")},success:function(){$("#loading").addClass("hide");Swal.fire({icon:"success",allowOutsideClick:!1,title:'<span class="modal-title">Thank You<\/span>',html:'<div class="modal-text-confirm">Your request has been created.<br /><\/div>',showCancelButton:!1,confirmButtonColor:"#1a415d",confirmButtonText:"Ok"}).then(function(n){n.value&&(window.location.href="http://www.drhorton.com")})}})},y=function(){var t=$("#captchaKey").val(),r=$("#captchaText").val(),u=n+i.Validate;$.ajax({type:"POST",url:encodeURI(u),data:{ImageKey:t,TextCode:r},cache:!1,success:function(n){var t=JSON.parse(n);t.IsValid?($("#captcha div.captcha-code i.error").hide(),$("#captcha div.captcha-code i.correct").show(),$("button#submit").removeAttr("disabled"),$("#captcha").attr("captcha-valid","true")):(e(t.CaptchaImage),$("#captcha div.captcha-code i.error").show(),$("#captcha div.captcha-code i.correct").hide(),$("#captcha").attr("captcha-valid","false"),$("#captchaText").focus())}})},f=function(t){var r=n+i.NewCaptcha;$.ajax({type:"POST",url:r,cache:!1,success:function(n){var i=JSON.parse(n);e(i,t)}})},e=function(n,t){$("div.captcha span.imgDisplay").hide();$("div.captcha span.imgDisplay").html("<img src='data:image/png;base64,"+n.Base64Image+"' id='base64Img' class='span12 baseurlopa2'>");$("#captchaKey").val(n.ImageKey);$("div.captcha span.imgDisplay").show();t||$("#captchaText").val("").focus();$("#captcha div.captcha-code i.error").hide();$("#captcha div.captcha-code i.correct").hide()},p=function(){var t=$("#captchaKey").val(),r=n+i.PlayAudio;$.ajax({type:"POST",url:encodeURI(r),cache:!1,data:{ImageKey:t,TextCode:""},success:function(n){var i=JSON.parse(n),r=i.Base64Audio,t;r==""&&i.CaptchaImage.Base64Image!=""?populateNewCaptcha(i.CaptchaImage):(t=document.getElementById("audio"),t.src="data:audio/mp3;base64,"+r+"",t.load(),t.play())}})},w=function(n){var t,f,r,e,o;n=n.substring(n.indexOf("?")+1);for(var h=/([^&=]+)=?([^&]*)/g,c=/\+/g,s=function(n){return decodeURIComponent(n.replace(c," "))},i={},u;u=h.exec(n);)t=s(u[1]),f=s(u[2]),t.substring(t.length-2)==="[]"?(t=t.substring(0,t.length-2),(i[t]||(i[t]=[])).push(f)):i[t]=f.replace("/","").replace("\\","").trim();for(r in i)e=r.split("["),e.length>1&&(o=[],e.forEach(function(n){var t=n.replace(/[?[\]\\ ]/g,"");o.push(t)}),b(i,o,i[r]),delete i[r]);return i},b=function(n,t,i){for(var r,f=t.length-1,u=0;u<f;++u)r=t[u],r in n||(n[r]={}),n=n[r];n[t[f]]=i}};this.privacyChicesGeneral=privacyChicesGeneral