function ValidateMailingAddress(){var i=!0,r=$('#residential-Form [data-valmsg-for="MailingAddress_AddressLine1"]'),o=$('#residential-Form [data-valmsg-for="MailingAddress_AddressLine2"]'),t=$('#residential-Form [data-valmsg-for="MailingAddress_City"]'),u=$('#residential-Form [data-valmsg-for="MailingAddress_State"]'),l=$('#residential-Form [data-valmsg-for="MailingAddress_ForeignState"]'),f=$('#residential-Form [data-valmsg-for="MailingAddress_ZipCode"]'),h=$("#MailingAddress_AddressLine1").val().trim(),a=$("#MailingAddress_AddressLine2").val().trim(),e=$("#MailingAddress_City").val().trim(),v=$("#MailingAddress_State").val().trim(),c=$("#MailingAddress_ZipCode").val().trim(),y=$("#MailingAddress_ForeignState").val().trim(),n="",s;if(r.removeClass("field-validation-error").addClass("field-validation-valid"),r.text(""),o.removeClass("field-validation-error").addClass("field-validation-valid"),o.text(""),t.removeClass("field-validation-error").addClass("field-validation-valid"),t.text(""),u.removeClass("field-validation-error").addClass("field-validation-valid"),u.text(""),l.removeClass("field-validation-error").addClass("field-validation-valid"),l.text(""),f.removeClass("field-validation-error").addClass("field-validation-valid"),f.text(""),!$("#SameAsResidential").prop("checked")){if(s=h.length+a.length+e.length+c.length,s+=$("#IsForeignAddress").prop("checked")?y.length:v.length-1,s==0)return QVFtoastr.Error('Please enter a mailing address or click "Same as my residential address".'),!1;s>0&&(h.length==0?(i=!1,r.removeClass("field-validation-valid").addClass("field-validation-error"),r.attr("role","alert"),r.text("Please enter mailing address line 1."),n.length==0&&(n=$("#MailingAddress_AddressLine1"))):h.length>50&&(i=!1,r.removeClass("field-validation-valid").addClass("field-validation-error"),r.attr("role","alert"),r.text("MAILING ADDRESS SHOULD BE LESS THAN OR EQUAL 50 CHARACTERS."),n.length==0&&(n=$("#MailingAddress_AddressLine1"))),a.length>50&&(i=!1,o.removeClass("field-validation-valid").addClass("field-validation-error"),o.attr("role","alert"),o.text("MAILING ADDRESS SHOULD BE LESS THAN OR EQUAL 50 CHARACTERS."),n.length==0&&(n=$("#MailingAddress_AddressLine2"))),$("#IsForeignAddress").prop("checked")?($("#military").prop("checked")?e.length==0?(i=!1,t.removeClass("field-validation-valid").addClass("field-validation-error"),t.attr("role","alert"),t.text("Please enter mailing address line 3."),n.length==0&&(n=$("#MailingAddress_City"))):e.length>50&&(i=!1,t.removeClass("field-validation-valid").addClass("field-validation-error"),t.attr("role","alert"),t.text("Mailing address city should less than or equal to 50 character"),n.length==0&&(n=$("#MailingAddress_City"))):e.length>50&&(i=!1,t.removeClass("field-validation-valid").addClass("field-validation-error"),t.attr("role","alert"),t.text("MAILING ADDRESS SHOULD BE LESS THAN OR EQUAL 50 CHARACTERS."),n.length==0&&(n=$("#MailingAddress_City"))),y.length>50&&(i=!1,u.removeClass("field-validation-valid").addClass("field-validation-error"),u.attr("role","alert"),u.text("MAILING ADDRESS SHOULD BE LESS THAN OR EQUAL 50 CHARACTERS."),n.length==0&&(n=$("#MailingAddress_State")))):(e.length==0?(i=!1,t.removeClass("field-validation-valid").addClass("field-validation-error"),t.attr("role","alert"),t.text("Please enter  mailing address city."),n.length==0&&(n=$("#MailingAddress_City"))):e.length>100&&(i=!1,t.removeClass("field-validation-valid").addClass("field-validation-error"),t.attr("role","alert"),t.text("Mailing address city should less than or equal to 100 character"),n.length==0&&(n=$("#MailingAddress_City"))),v.length==1&&(i=!1,u.removeClass("field-validation-valid").addClass("field-validation-error"),u.attr("role","alert"),u.text("Please select a mailing address State."),n.length==0&&(n=$("#MailingAddress_State"))),c.length==0&&(i=!1,f.removeClass("field-validation-valid").addClass("field-validation-error"),f.attr("role","alert"),f.text("Please enter mailing address zip code."),n.length==0&&(n=$("#MailingAddress_ZipCode")))),c.length>50&&(i=!1,f.removeClass("field-validation-valid").addClass("field-validation-error"),f.attr("role","alert"),f.text("MAILING ADDRESS SHOULD BE LESS THAN OR EQUAL 50 CHARACTERS."),n.length==0&&(n=$("#MailingAddress_ZipCode"))))}return $("#EmailNotificationSignup").is(":checked")&&$("#EmailAddress").val().trim().length==0&&(i=!1,n.length==0&&(n=$("#EmailAddress"))),i||n.focus(),i}function setCookie(n,t,i){var u=getCookie(n),r,f;u!=null&&u!=""&&u!=undefined||(r=new Date,r.setDate(r.getDate()+i),f=escape(t)+(i==null?"":"; expires="+r.toUTCString()),document.cookie=n+"="+f+";path=/;secure")}function setCookieForSessionTimeout(){document.cookie="OVR_SessionTimeout="+new Date+"; path=/"}function getCookie(n){for(var r,u,i=document.cookie.trim().split(";"),t=0;t<i.length;t++)if(r=i[t].substr(0,i[t].indexOf("=")),u=i[t].substr(i[t].indexOf("=")+1),r=r.replace(/^\s+|\s+$/g,""),r==n)return unescape(u)}function deleteCookie(n){var t=new Date;t.setDate(t.getDate()-1);var i=";expires="+t,r=n;document.cookie=r+"="+i+"; path=/;secure"}$(document).ready(function(){var n=window.location.pathname;$.sessionTimeout({warnAfter:78e4,redirAfter:9e5});$("som-modal > div > div").css("bottom","auto");$("#RegistrationAddress").hide();$("#RegistrationAddress").attr("aria-hidden",!0);$("#RegistrationAddress").removeAttr("role");$("#AddressNotMatched").hide();$("#AddressNotMatched").attr("aria-hidden",!0);$("#AddressNotMatched").removeAttr("role");$("html, body").animate({scrollTop:"0px"},500);$("#phone-help").disableValidation=!0;$(".date-field").mask("99/99/9999");$(".phone-field").mask("999-999-9999");$("#Moved").off("click").on("click",function(){$("#moved_no").attr("aria-checked","false");$("#Moved").attr("aria-checked","true");document.getElementById("dlnAddressChangeModal").open();$("som-modal > div > div").css("bottom","auto")});$("#moved_no").off("click").on("click",function(){$("#moved_no").attr("aria-checked","true");$("#Moved").attr("aria-checked","false")});$("#DupDlnID").off("click").on("click",function(){$("#duplicate_no").attr("aria-checked","false");$("#DupDlnID").attr("aria-checked","true");document.getElementById("duplicateToday").open();$("som-modal > div > div").css("bottom","auto")});$("#duplicate_no").off("click").on("click",function(){$("#duplicate_no").attr("aria-checked","true");$("#DupDlnID").attr("aria-checked","false")});$("#IsAcpaID").off("click").on("click",function(){$("#acpa_no").attr("aria-checked","false");$("#IsAcpaID").attr("aria-checked","true");$("som-modal > div > div").css("bottom","auto")});$("#acpa_no").off("click").on("click",function(){$("#acpa_no").attr("aria-checked","true");$("#IsAcpaID").attr("aria-checked","false")});$("#Citizen").off("click").on("click",function(){$(".not-a-citizen").attr("aria-checked","false");$("#Citizen").attr("aria-checked","true")});$(".not-a-citizen").off("click").on("click",function(){$(".not-a-citizen").attr("aria-checked","true");$("#Citizen").attr("aria-checked","false");document.getElementById("citizenship").open();$("som-modal > div > div").css("bottom","auto")});$("#Eighteen").off("click").on("click",function(){$("#age_no").attr("aria-checked","false");$("#Eighteen").attr("aria-checked","true")});$(".age").off("click").on("click",function(){$("#age_no").attr("aria-checked","true");$("#Eighteen").attr("aria-checked","false");document.getElementById("age").open();$("som-modal > div > div").css("bottom","auto")});$("#Resident").off("click").on("click",function(){$(".not-a-resident").attr("aria-checked","false");$("#Resident").attr("aria-checked","true")});$(".not-a-resident").off("click").on("click",function(){$(".not-a-resident").attr("aria-checked","true");$("#Resident").attr("aria-checked","false");document.getElementById("resident").open();$("som-modal > div > div").css("bottom","auto")});$("#CancelPreviousReg").off("click").on("click",function(){$(".cancel-registration").attr("aria-checked","false");$("#CancelPreviousReg").attr("aria-checked","true")});$(".cancel-registration").off("click").on("click",function(){$(".cancel-registration").attr("aria-checked","true");$("#CancelPreviousReg").attr("aria-checked","false");document.getElementById("cancelReg").open();$("som-modal > div > div").css("bottom","auto")});$("#DigitalSignature").off("click").on("click",function(){$(".digital-signature").attr("aria-checked","false");$("#DigitalSignature").attr("aria-checked","true")});$(".digital-signature").off("click").on("click",function(){$(".digital-signature").attr("aria-checked","true");$("#DigitalSignature").attr("aria-checked","false");document.getElementById("digitalSignature").open();$("som-modal > div > div").css("bottom","auto")});$("#EmailTheReceipt").change(function(){$("#EmailTheReceipt").is(":checked")?$("#EmailAddress").attr("disabled",!1):($("#EmailAddress").attr("disabled",!0),$("#EmailAddress").val(""),$('#success-Form [data-valmsg-for="EmailAddress"]').text(""),$('#success-Form [data-valmsg-for="EmailAddress"]').removeClass("field-validation-error").addClass("field-validation-valid"))});$(".information-button").off("click").on("click",function(n){n.preventDefault();switch(n.currentTarget.id){case"phone-help":document.getElementById("phone-modal").open();break;case"email-help":document.getElementById("email-modal").open();break;case"residential-address-help":document.getElementById("residential-address-modal").open();break;case"dln-help":document.getElementById("dln-modal").open()}});$("#btnQualificationsBack").off("click").on("click",function(n){n.preventDefault();$.ajax({method:"GET",cache:!1,url:"/RegisterVoter/Index2",success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());$("#moved_no").prop("checked",!0);$("#duplicate_no").prop("checked",!0)},error:function(){QVFtoastr.Error("Sorry, but the online voter registration website is not working right now. Driver's License validation is not available, please exit and try again.")}})});$("#btnNameBack").off("click").on("click",function(n){n.preventDefault();$.ajax({method:"POST",cache:!1,data:{Moved:!1,DupDlnID:!1},url:"/RegisterVoter/DL",success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());$(".checked-yes").prop("checked",!0)},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".')}})});$("#btnAddressBack").off("click").on("click",function(n){n.preventDefault();$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/Qualified",data:{Citizen:!0,Resident:!0,Eighteen:!0,DigitalSignature:!0,CancelPreviousReg:!0},success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val())},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".')}})});$("#btnAcpaBack").off("click").on("click",function(n){n.preventDefault();$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/Qualified",data:{Citizen:!0,Resident:!0,Eighteen:!0,DigitalSignature:!0,CancelPreviousReg:!0},success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val())},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".')}})});$("#btnNoticeBack").off("click").on("click",function(){$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/RegisterVoter",data:{AddressErrorMessage:"",ResidenceStreet:"  ",ResidenceCity:"  ",ResidenceZipCode:"  ",ResidenceApartment:"",MailingAddress1:"",MailingAddress2:"",MailingCity:"",MailingState:"",MailingZipCode:"",PhoneNumber:"",EmailAddress:"",RegisterAsPermAV:!1,States:null},success:function(n){n.AddressNotFound&&QVFtoastr.Error("Could not validate voter address.");$("#body").html(n);$("#page-title").text($("#hfPageTitle").val())},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".')}})});window.ShowAddressNotFoundError=function(){};$("[id^=btnAddressVerify]").off("click").on("click",function(n){var i,r,t;if(n.preventDefault(),$("#AddressNotMatched").hide(),!ValidateMailingAddress())return!1;Spinner.StartSpinner();$("[id^=btnAddressVerify]").attr("disabled",!0);$("#residential-Form").valid()?(i=$("#ResidenceStreet").val(),r=$("#ResidenceZipCode").val(),$.get("/RegisterVoter/ResolveStreetRange",{residenceStreet:$("#ResidenceStreet").val(),city:$("#ResidenceCity").val(),zipCode:$("#ResidenceZipCode").val()},function(n){var r,t,e,u,f,i;n.zipVerify>0?($("#addressErrorMessage").html("<p class='validationAddressMessageStyle no-border'>Your address could not be verified.  Please check the accuracy of your residential address. If you believe you entered it accurately, please contact <a class= 'menu-buttton' href = '/Clerk'> your local clerk<\/a>.<\/p>"),r=$("#addressErrorMessage").text(),n.zipVerify==1&&$("#addressErrorMessage").text("Invalid city. "+r),n.zipVerify==2&&$("#addressErrorMessage").text("Invalid zip code. "+r),n.zipVerify==3&&$("#addressErrorMessage").text("Invalid city/zip combination. "+r),$("#RegistrationAddress").hide(),$("#RegistrationAddress").attr("aria-hidden","true"),$("#RegistrationAddress").removeAttr("role"),$("#MatchedStreetRangeId").text("0"),$("#AddressNotMatched").show(),$("#AddressNotMatched").attr("aria-hidden","false"),$("#AddressNotMatched").attr("role","alert"),i=$("#phone-help").offset().top,$("HTML, BODY").animate({scrollTop:i},1e3)):n.matchSuccess?($("#AddressNotMatched").hide(),$("#AddressNotMatched").attr("aria-hidden",!0),$("#AddressNotMatched").removeAttr("role"),t="",e=n.matchedStreet.CITY.concat(", MI ",n.matchedStreet.ZIP_CODE),t=n.parsedStreet[0].HouseNumber.toString(),n.parsedStreet[0].HouseNumberSuffix!=null&&(t=isNaN(n.parsedStreet[0].HouseNumberSuffix.toString().substring(0,1))?t.concat(n.parsedStreet[0].HouseNumberSuffix):t.concat(" ",n.parsedStreet[0].HouseNumberSuffix)),n.matchedStreet.DIRECTION_PREFIX!=null&&(t=t.concat(" ",n.matchedStreet.DIRECTION_PREFIX)),n.matchedStreet.STREET_NAME!=null&&(t=t.concat(" ",n.matchedStreet.STREET_NAME)),n.matchedStreet.StreetType!=null&&(t=t.concat(" ",n.matchedStreet.StreetType)),n.matchedStreet.DIRECTION_SUFFIX!=null&&(t=t.concat(" ",n.matchedStreet.DIRECTION_SUFFIX)),t=t.trim(),$("#resultAddressLine1").text(t),$("#resultMatchedCityZip").text(e),$("#MatchedStreetRangeId").text(n.matchedStreet.ID),$("#ParsedHouseNumber").text(n.parsedStreet[0].HouseNumber),$("#ParsedHouseNumberCharacter").text(n.parsedStreet[0].HouseNumberCharacter),$("#ParsedHouseNumberSuffix").text(n.parsedStreet[0].HouseNumberSuffix),$("#ResidenceApartment").val()!=null&&$("#ResidenceApartment").val().length>0?($("#resultApt").text($("#ResidenceApartment").val().toUpperCase()),$("#resultApt").show()):$("#resultApt").hide(),$("#RegistrationAddress").show(),$("#RegistrationAddress").attr("aria-hidden",!1),$("#RegistrationAddress").attr("role","alert"),$("#IsPermAv").hide(),$("#NotPermAv").hide(),$("#NoPermAvList").hide(),n.matchedStreet.HasPermAV?n.matchedStreet.IsPermAV?$("#IsPermAv").show():$("#NotPermAv").show():$("#NoPermAvList").show(),i=$("#btnAddressVerify").offset().top,$("HTML, BODY").animate({scrollTop:i},1e3)):n.matchCount>1?(u="",$("#ResidenceApartment").val()!=null&&$("#ResidenceApartment").val().length>0&&(u=$("#ResidenceApartment").val().toUpperCase()),f=[],$(n.matchedStreet).each(function(t,i){f.push({id:i.ID,houseNumberCharacter:n.parsedStreet[0].HouseNumberCharacter,houseNumber:n.parsedStreet[0].HouseNumber,houseNumberSuffix:n.parsedStreet[0].HouseNumberSuffix,houseNumberLow:i.HOUSE_NUMBER_LOW,houseNumberHigh:i.HOUSE_NUMBER_HIGH,residenceApartment:u,extensionLow:i.EXTENSION_LOW,extensionHigh:i.EXTENSION_HIGH,jurisdiction:i.JURISDICTION_ID,streetPrefix:i.DIRECTION_PREFIX,streetName:i.STREET_NAME,streetType:i.StreetType,streetSuffix:i.DIRECTION_SUFFIX,city:i.CITY,zip:i.ZIP_CODE,oddEvenIndicator:i.ODD_EVEN_INDICATOR,streetAlias:i.StreetAliasName,dpaid:i.DISTINCT_POLITICAL_AREA_ID,HAS_ELECTION_GEOGRAPHY:i.HAS_ELECTION_GEOGRAPHY,jurisdictionName:i.JURISDICTION_NAME,countyName:i.AlternateCountyName,hasPermAV:i.HasPermAV,isPermAV:i.IsPermAV})}),StreetSearch.promptWindow.promptStreetRange(f)):($("#RegistrationAddress").hide(),$("#MatchedStreetRangeId").text("0"),$("#addressErrorMessage").html("<p class='validationAddressMessageStyle no-border'>Your address could not be verified.  Please check the accuracy of your residential address. If you believe you entered it accurately, please contact <a class= 'menu-buttton' href = '/Clerk'> your local clerk.<\/a><\/p>"),$("#AddressNotMatched").show(),$("#AddressNotMatched").attr("aria-hidden",!1),$("#AddressNotMatched").attr("role","alert"),i=$("#phone-help").offset().top,$("HTML, BODY").animate({scrollTop:i},1e3));Spinner.StopSpinner();$("[id^=btnAddressVerify]").attr("disabled",!1)})):(t=$(".input-validation-error:first"),t&&t.focus(),Spinner.StopSpinner(),$("[id^=btnAddressVerify]").attr("disabled",!1))});$("#btnConfirmDlRequirements").off("click").on("click",function(n){if(!$("#dl-Form").valid())return!1;Spinner.StartSpinner();n.preventDefault();var t={Moved:$("#Moved")[0].checked,DupDlnID:$("#DupDlnID")[0].checked,IsAcpaID:$("#IsAcpaID")[0].checked};$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/DL",data:t,success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnConfirmQualifications").off("click").on("click",function(n){if(!$("#qualified-Form").valid())return!1;Spinner.StartSpinner();n.preventDefault();var t={Citizen:$("#Citizen")[0].checked,Resident:$("#Resident")[0].checked,Eighteen:$("#Eighteen")[0].checked,DigitalSignature:$("#DigitalSignature")[0].checked,CancelPreviousReg:$("#CancelPreviousReg")[0].checked,IsAcpaParticipant:$("#IsAcpaParticipant").val()};$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/Qualified",data:t,success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnChangeAddress").off("click").on("click",function(n){if(!$("#alreadyRegistered-Form").valid())return!1;$("#btnChangeAddress").attr("disabled",!0);n.preventDefault();Spinner.StartSpinner();$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/ChangeAddress",data:"",success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner();$("#btnChangeAddress").attr("disabled",!1)},error:function(){Spinner.StopSpinner();$("#btnChangeAddress").attr("disabled",!1);QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".')}})});$("#btnValidateName").off("click").on("click",function(n){var t,i,r,u,f;if(n.preventDefault(),$('#name-Form [data-valmsg-for="Birthdate"]').text(""),$('#name-Form [data-valmsg-for="Birthdate"]').removeClass("field-validation-error field-validation-valid").addClass("field-validation-valid"),!$("#name-Form").valid())return!1;if(!isDate($("#Birthdate").val()))return $('#name-Form [data-valmsg-for="Birthdate"]').text("Please enter a valid birthdate."),$('#name-Form [data-valmsg-for="Birthdate"]').removeClass("field-validation-valid").addClass("field-validation-error"),!1;if(t=moment($("#Birthdate").val(),"MM/DD/YYYY").format("YYYYMMDD"),i=moment().subtract(192,"months").format("YYYYMMDD"),t>i)return $('#name-Form [data-valmsg-for="Birthdate"]').text("You must be at least 16 years old to register to vote using this website."),$('#name-Form [data-valmsg-for="Birthdate"]').removeClass("field-validation-valid").addClass("field-validation-error"),!1;if(r=moment($("#Birthdate").val(),"MM/DD/YYYY").format("YYYY"),u=(new Date).getFullYear(),u-r>110)return $('#name-Form [data-valmsg-for="Birthdate"]').text("Please enter a valid birth year."),$('#name-Form [data-valmsg-for="Birthdate"]').removeClass("field-validation-valid").addClass("field-validation-error"),!1;Spinner.StartSpinner();f={FullName:$("#FullName").val(),Dln:$("#Dln").val(),Birthdate:$("#Birthdate").val(),EyeColor:$("#EyeColor").val(),SSN:$("#SSN").val(),Months:null,Days:null,VoterNotFound:!1,IsAcpaRegistration:$("#IsAcpaRegistration").val()};$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/ValidateName",data:f,success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnRegister").off("click").on("click",function(n){var t,i,r;if(!ValidateMailingAddress()||!$("#residential-Form").valid())return!1;n.preventDefault();Spinner.StartSpinner();t="";i="";$("#MailingAddress_ForeignState").length&&(i=$("#MailingAddress_ForeignState").val());$("#MailingAddress_State").length&&(t=$("#MailingAddress_State option:selected").val());r={AddressErrorMessage:$("#AddressErrorMessage").text(),ResidenceStreet:$("#ResidenceStreet").val(),ResidenceCity:$("#ResidenceCity").val(),ResidenceZipCode:$("#ResidenceZipCode").val(),ResidenceApartment:$("#ResidenceApartment").val(),StatusID:$("#StatusID option:selected").val(),SameAsResidential:$('input[name="SameAsResidential"]').prop("checked"),IsForeignAddress:$('input[name="IsForeignAddress"]').prop("checked"),MailingAddress_AddressLine1:$("#MailingAddress_AddressLine1").val(),MailingAddress_AddressLine2:$("#MailingAddress_AddressLine2").val(),MailingAddress_City:$("#MailingAddress_City").val(),MailingAddress_State:t,MailingAddress_ZipCode:$("#MailingAddress_ZipCode").val(),MailingAddress_ForeignState:i,PhoneNumber:$("#PhoneNumber").val(),EmailAddress:$("#EmailAddress").val(),MatchedStreetRangeId:$("#MatchedStreetRangeId").text(),ParsedHouseNumber:$("#ParsedHouseNumber").text(),ParsedHouseNumberCharacter:$("#ParsedHouseNumberCharacter").text(),ParsedHouseNumberSuffix:$("#ParsedHouseNumberSuffix").text(),RegisterAsPermAV:$('input[name="RegisterAsPermAV"]').prop("checked"),EmailNotificationSignup:$('input[name="EmailNotificationSignup"]').prop("checked"),MailingAddressStates:null};$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/RegisterVoter",data:r,success:function(n){n.AddressNotFound&&QVFtoastr.Error("Could not validate voter address.");$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnRegisterAcpa").off("click").on("click",function(n){if(!$("#acpa-Form").valid())return!1;n.preventDefault();Spinner.StartSpinner();var t={AcpaErrorMessage:$("#AcpaErrorMessage").text(),AcpaParticipantId:$("#AcpaParticipantId").val()};$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/RegisterAcpaVoter",data:t,success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnContinue14DayIntro").off("click").on("click",function(n){n.preventDefault();Spinner.StartSpinner();$.ajax({method:"GET",cache:!1,url:"/RegisterVoter/Index2",success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnContinue14DayRegister").off("click").on("click",function(n){n.preventDefault();Spinner.StartSpinner();$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/ContinueRegistrationSuccess",success:function(n){n.AddressNotFound&&QVFtoastr.Error("Could not validate voter address.");$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnContinue14DayChangeAddress").off("click").on("click",function(n){n.preventDefault();Spinner.StartSpinner();$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/ContinueAddressSuccess",success:function(n){n.AddressNotFound&&QVFtoastr.Error("Could not validate voter address.");$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnDoNotChange").off("click").on("click",function(n){n.preventDefault();Spinner.StartSpinner();$.ajax({method:"GET",cache:!1,url:"/RegisterVoter/DontChangeAddress/",data:null,success:function(n){n.success&&$.ajax({method:"GET",cache:!1,url:"/Voter/VoterInfo/",data:null,success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner()},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner()}})});$("#btnUpdateAddress").off("click").on("click",function(n){var t,i,r;if(!ValidateMailingAddress()||!$("#residential-Form").valid())return!1;n.preventDefault();$("#btnUpdateAddress").attr("disabled",!0);Spinner.StartSpinner();t="";i="";$("#MailingAddress_State").length&&(i=$("#MailingAddress_ForeignState").val());$("#MailingAddress_ForeignState").length&&(t=$("#MailingAddress_State option:selected").val());r={AddressErrorMessage:$("#AddressErrorMessage").text(),ResidenceStreet:$("#ResidenceStreet").val(),ResidenceCity:$("#ResidenceCity").val(),ResidenceZipCode:$("#ResidenceZipCode").val(),ResidenceApartment:$("#ResidenceApartment").val(),StatusID:$("#StatusID option:selected").val(),SameAsResidential:$('input[name="SameAsResidential"]').prop("checked"),IsForeignAddress:$('input[name="IsForeignAddress"]').prop("checked"),MailingAddress_AddressLine1:$("#MailingAddress_AddressLine1").val(),MailingAddress_AddressLine2:$("#MailingAddress_AddressLine2").val(),MailingAddress_City:$("#MailingAddress_City").val(),MailingAddress_State:t,MailingAddress_ZipCode:$("#MailingAddress_ZipCode").val(),MailingAddress_ForeignState:i,PhoneNumber:$("#PhoneNumber").val(),EmailAddress:$("#EmailAddress").val(),MatchedStreetRangeId:$("#MatchedStreetRangeId").text(),ParsedHouseNumber:$("#ParsedHouseNumber").text(),ParsedHouseNumberCharacter:$("#ParsedHouseNumberCharacter").text(),ParsedHouseNumberSuffix:$("#ParsedHouseNumberSuffix").text(),RegisterAsPermAV:$('input[name="RegisterAsPermAV"]').prop("checked"),MailingAddressStates:null};$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/UpdateVoterAddress",data:r,success:function(n){n.AddressNotFound&&QVFtoastr.Error("Could not validate voter address.");$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());Spinner.StopSpinner();$("#btnUpdateAddress").attr("disabled",!1)},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner();$("#btnUpdateAddress").attr("disabled",!1)}})});$("#btnFinish").off("click").on("click",function(n){if(!$("#success-Form").valid())return!1;n.preventDefault();$("#btnFinish").attr("disabled",!0);Spinner.StartSpinner();var t;t=document.getElementById("new-address")?{ResidenceStreet:$("#new-street").val(),ResidenceApartment:$("#new-appartment").val(),ResidenceCity:$("#new-city").val(),ResidenceZipCode:$("#new-zip").val(),EmailTheReceipt:$("#EmailTheReceipt").prop("checked"),EmailAddress:$("#EmailAddress").val()}:{EmailTheReceipt:$("#EmailTheReceipt").prop("checked"),EmailAddress:$("#EmailAddress").val()};$.ajax({method:"POST",cache:!1,url:"/RegisterVoter/Finish",data:t,success:function(n){$("#body").html(n);$("#page-title").text($("#hfPageTitle").val());$("#EmailTheReceipt").is(":checked")?$("#EmailAddress").attr("disabled",!1):$("#EmailAddress").attr("disabled",!0);Spinner.StopSpinner();$("#btnFinish").attr("disabled",!1)},error:function(){QVFtoastr.Error('Sorry, but the online voter registration website is not working right now. Please try again later or visit "How do I register to vote".');Spinner.StopSpinner();$("#btnFinish").attr("disabled",!1)}})});jQuery.fn.preventDoubleSubmission=function(){$(this).on("submit",function(n){var t=$(this);$(".modal").show();t.data("submitted")===!0?n.preventDefault():t.data("submitted",!0)});return this};jQuery.validator.setDefaults({submitHandler:function(n){return $(n).data("submitted")===!0?!1:($(n).data("submitted",!0),!0)}})});var StreetSearch=StreetSearch||{};StreetSearch.promptWindow=function(n,t){function e(){(function(){t.ajaxSetup({cache:!1});t("#prompt-save").html("SAVE");t(".prompt-text-group").hide();t(".prompt-select-group").hide();t(".prompt-radiobutton-group").hide();t("#prompt-save").unbind("click");t("#prompt-close").unbind("click");t("#prompt-cancel").unbind("click");t("#prompt-date").unbind("change");t("#prompt-cancel").click(function(){i.close();f()});t("#prompt-save").click(function(){alert("CLICKED");o()==!1?(t("#dateError").removeClass("hide"),alert("ERROR")):i.close()});u=!1;i=document.getElementById("prompt-window");i.addEventListener("onClose",function(){f()})})()}function o(){var r=t("#prompt-date").val(),n=r.split("/"),u=n[0],f=n[1],e=n[2],i=new Date(t(element).val());return alert("checking"),u==i.getMonth()+1&&f==i.getDate()&&e==i.getFullYear()}function f(){n.previous_value!=null&&n.previous_value_control!=null&&n.previous_value_control.val(n.previous_value);n.previous_value=null;n.previous_value_control=null}function s(n,e,o,s){t.isFunction(n)==!1&&alert("goo requires function");t("#prompt-save").unbind("click");document.getElementById("prompt-window").open();t(".modal-header .modal-title").text(s);t("#prompt-save").click(function(){if(r=="radiobutton"){var f=t("input[name='street-range-rbgroup']:checked").val();if(u===!0&&!f&&!(f=="")){alert("Please make a selection.");return}n();i.close()}});t.isFunction(e)==!0&&(t("#prompt-cancel").unbind("click"),t("#prompt-cancel").click(function(){r=="radiobutton"&&(e(),i.close(),f())}))}function h(n,i,u,f){l();r="radiobutton";var e=t(".prompt-radiobutton-group");t(".prompt-radiobutton-group").show();s(n,i,u,f)}function c(){t("#prompt-select").find("option").remove()}function l(){t("#prompt-date").val("");t("#prompt-select").val("");t("#prompt-text").val("");t("#prompt-text").val("");t("input[name='street-range-rbgroup']").attr("checked",!1)}jQuery.event.handle=jQuery.event.dispatch;var r,u,i;return n.previous_value=null,n.previous_value_control=null,n.promptStreetRange=function(n,i){var r,p,o,k,f,i;for(e(),c(),u=!0,p=t(".prompt-radiobutton-group > .radio-button-list"),p.empty(),r=0;r<n.length;++r){var d=n[r].id,s=n[r].houseNumberCharacter,g=n[r].houseNumber,l=n[r].houseNumberSuffix,ot=n[r].houseNumberLow,st=n[r].houseNumberHigh,w=n[r].extensionLow,nt=n[r].extensionHigh,a=n[r].streetPrefix,tt=n[r].streetName,v=n[r].streetSuffix,it=n[r].streetType,rt=n[r].city,ht=n[r].zip,ct=n[r].jurisdiction,lt=n[r].oddEvenIndicator,b=n[r].streetAlias.trim(),at=n[r].dpaid,vt=n[r].HAS_ELECTION_GEOGRAPHY,y=n[r].residenceApartment,yt=n[r].hasPermAV,ut=n[r].countyName,ft=n[r].jurisdictionName,pt=n[r].isPermAV,et="";w&&(et=" "+w+"-"+nt);s==null&&(s="");l==null&&(l="");o=s+g+l;o+=et;a&&a.length&&(o+=" "+a);o+=" "+tt;o+=" "+it;v&&v.length&&(o+=" "+v);b&&b.trim().length>0&&(o+=" ("+b+")");y!=null&&y.length>0&&(o+=" "+y+",");o+=" "+rt;o+=", MI";o+=" - "+ut;o+=", "+ft;k="streetRange"+d;f="<input type='radio' name='street-range-rbgroup' id='"+k+"'";f+=" value='"+d+"'";f+=" data-house-number='"+g+"'";f+=" data-house-number-character='"+s+"'";f+=" data-house-number-suffix='"+l+"'";f+=" data-city='"+rt+"'";f+=" data-jurisdiction='"+ct+"'";f+=" data-jurisdictionName='"+ft+"'";f+=" data-zip='"+ht+"'";f+=" data-house-number-high='"+st+"'";f+=" data-house-number-low='"+ot+"'";f+=" data-prefix='"+a+"'";f+=" data-suffix='"+v+"'";f+=" data-street-name='"+tt+"'";f+=" data-odd-even='"+lt+"'";f+=" data-extension-low='"+w+"'";f+=" data-extension-high='"+nt+"'";f+=" data-residence-apartment='"+y+"'";f+=" data-dpaid='"+at+"'";f+=" data-haselectiongeography='"+vt+"'";f+=" data-hasPermAv='"+yt+"'";f+=" data-isPermAv='"+pt+"'";f+=" data-countyName='"+ut+"'";f+=" data-street-type='"+it+"' />";f+="<label for='"+k+"'>"+o+"<\/label><br/>";p.append(f)}typeof i=="undefined"&&(i=function(){var n=t("input[name='street-range-rbgroup']:checked"),i,h,y;if(!(n.length<1)){var p=n.val(),o=n.data("house-number"),e=n.data("house-number-character"),r=n.data("house-number-suffix"),u=n.data("prefix"),f=n.data("suffix"),c=n.data("street-type"),l=n.data("zip"),a=n.data("city"),v=n.data("street-name"),s=n.data("residence-apartment"),g=n.data("dpaid"),nt=n.data("haselectiongeography"),w=n.data("countyname"),b=n.data("jurisdictionname"),k=n.data("haspermav"),d=n.data("ispermav");u&&u!="undefined"||(u="");f&&f!="undefined"||(f="");t("#AddressNotMatched").hide();t("#AddressNotMatched").attr("aria-hidden",!0);t("#AddressNotMatched").removeAttr("role");i="";h=a.concat(", MI ",l);i=e!=null&&e.length>0?e.toString().concat(o.toString()):o.toString();r!=null&&r.length>0&&(i=isNaN(r.toString().substring(0,1))?i.concat(r):i.concat(" ",r));u!=null&&(i=i.concat(" ",u));v!=null&&(i=i.concat(" ",v));c!=null&&(i=i.concat(" ",c));f!=null&&(i=i.concat(" ",f));h=a.concat(", MI ",l);i=i.trim();t("#resultAddressLine1").text(i);t("#resultMatchedCityZip").text(h);t("#MatchedStreetRangeId").text(p);t("#ParsedHouseNumber").text(o);t("#ParsedHouseNumberCharacter").text(e);t("#ParsedHouseNumberSuffix").text(r);s!=null&&s.length>0?(t("#resultApt").text(s.toUpperCase()),t("#resultApt").show()):t("#resultApt").hide();t("#resultCountyJuris").text(w+", "+b);t("#RegistrationAddress").show();t("#RegistrationAddress").attr("aria-hidden",!1);t("#RegistrationAddress").attr("role","alert");t("#IsPermAv").hide();t("#NotPermAv").hide();t("#NoPermAvList").hide();k?d?t("#IsPermAv").show():t("#NotPermAv").show():t("#NoPermAvList").show();y=t("#btnAddressVerify").offset().top;t("HTML, BODY").animate({scrollTop:y},1e3)}});h(i,ShowAddressNotFoundError,null,"Choose Address")},n}(StreetSearch.promptWindow||{},jQuery),function(n){jQuery.sessionTimeout=function(t){function r(n){switch(n){case"start":f=setTimeout(function(){s(i.warnAfter)},i.warnAfter);break;case"restart":var r=getCookie("OVR_SessionTimeout"),t=i.warnAfter;r!=undefined&&(t=t-((new Date).getTime()-new Date(r).getTime()));f=setTimeout(function(){s(t)},t);break;case"stop":clearTimeout(f)}}function u(n){switch(n){case"start":o=setTimeout(function(){c()},i.redirAfter-i.warnAfter);break;case"stop":clearTimeout(o)}}function s(n){var t=getCookie("OVR_SessionTimeout");t!=undefined?(new Date).getTime()-new Date(t).getTime()>=n?u("start"):(r("stop"),r("restart")):u("start")}function h(n,t,i){var u=new RegExp("([?|&])"+t+"=.*?(&|#|$)","i"),r,f;return n.match(u)?n.replace(u,"$1"+t+"="+i+"$2"):(r="",n.indexOf("#")!==-1&&(r=n.replace(/.*#/,"#"),n=n.replace(/#.*/,"")),f=n.indexOf("?")!==-1?"&":"?",n+f+t+"="+i+r)}function c(){var t=getCookie("OVR_SessionTimeout");t!=undefined?(new Date).getTime()-new Date(t).getTime()>=i.redirAfter-i.warnAfter?window.location=i.redirUrl:(n(".btnExit").click(),u("stop"),r("restart")):window.location=i.redirUrl}var e={message:"Your session is about to expire.",keepAliveUrl:"/RegisterVoter/KeepAlive",keepAliveAjaxRequestType:"POST",redirUrl:"/RegisterVoter/OnlineVoterTimeout",logoutUrl:"/RegisterVoter/OnlineVoterTimeout",warnAfter:78e4,redirAfter:9e5,appendTime:!0},i=e,f,o;t&&(i=n.extend(e,t));n("html").on("click",".btnExit",function(){window.location=i.logoutUrl});n("html").on("click",".btnContinueWorking",function(){n.ajax({type:i.keepAliveAjaxRequestType,url:i.appendTime?h(i.keepAliveUrl,"_",(new Date).getTime()):i.keepAliveUrl});u("stop");r("start")});n(document).ajaxComplete(function(){u("stop");r("stop");r("start");setCookieForSessionTimeout()});r("start");setCookieForSessionTimeout()}}(jQuery)