function PopulateStates(b,d){stateArray=new Array("AA","AE","AK","AL","AP","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY");for(x=0;x<b.length;x++){var g=document.forms[b[x]].state;for(var c=0;c<stateArray.length;c++){var a=((stateArray[c]==d)?true:false);try{g.options[c+1]=new Option(stateArray[c],stateArray[c],a,a)}catch(f){g.options[c+1]=new Option(stateArray[c],stateArray[c],a)}}}do_prefill(d)}function setSelectBox(c,b){if(!c){return}if(b.length){for(var a=0;a<c.length;a++){if(c[a].value==b){c.selectedIndex=a;break}}}}function checkForErrors(a,b){if(a!=""){$("."+b+"_error").hide();$("#"+b).css("background","#F3FFF6")}else{$("."+b+"_error").show();$("#"+b).css("background","#FFCDC9")}}function do_prefill(a){if(document.forms[0]){setSelectBox(document.forms[0].state,a)}if(document.state){setSelectBox(document.state.state,a)}if(document.adult){setSelectBox(document.adult.state,a)}if(document.child){setSelectBox(document.child.state,a)}}function AutoChecker(e){var d=document.forms[e];var b=validate_form(d,false);var c=new Array();var a=new Array();if(b){if($("#clickedSubmitted").val()!="true"){c=Array("event16");a=Array("gmadInquirySubmissionMethod=autosubmit");CallThirdPartyEvent("exec_bus_event","Submitted without a clicking submit button",c,a,d.omniture_uniq_id.value);SetDefaults(d)}}return b}var second_try=false;function Checker(c,b){$("#SubmitForm").hide();var a=validate_form(c,true);if(a&&!second_try){second_try=true;a=VerifyChoices(c)}else{if(a){SetDefaults(c)}}if(a){autosubmit=false;c.button.value="submit"}else{$("#SubmitForm").show()}if(c.adult.checked==true&&c.juvenile.checked==true){c.action=b+"/combo"}else{if(c.juvenile.checked==true){c.action=b+"/child"}else{c.action=b+"/adult"}}return a}function SetDefaults(g){var f=((g.adult.checked==true&&g.juvenile.checked==false)?true:false);var c=((g.adult.checked==false&&g.juvenile.checked==true)?true:false);var b=((g.adult.checked==true&&g.juvenile.checked==true)?true:false);var d=((g.adult.checked==false&&g.juvenile.checked==false)?true:false);var e=new Array();var a=new Array();if(d){e=Array("event2");a=Array("gmadInquiryProductChosen=none");CallThirdPartyEvent("exec_bus_event","Form boxes blank",e,a,g.omniture_uniq_id.value);g.adultHolder.value="Y"}else{if(c){e=Array("event4");a=Array("gmadInquiryProductChosen=childSolo");CallThirdPartyEvent("exec_bus_event","Checked Child on Form",e,a,g.omniture_uniq_id.value)}else{if(b){e=Array("event5");a=Array("gmadInquiryProductChosen=combo");CallThirdPartyEvent("exec_bus_event","Checked Combo on Form",e,a,g.omniture_uniq_id.value)}else{e=Array("event3");a=Array("gmadInquiryProductChosen=adultSolo");CallThirdPartyEvent("exec_bus_event","Checked Adult on Form",e,a,g.omniture_uniq_id.value)}}}return true}function VerifyChoices(d){var c=new Array();var a=new Array();var b=new Array();SetDefaults(d);if(d.juvenile.checked==false){c=Array("event10");a=Array("gmadInquiryAddlJuvOffered=true");b.PageName="Child Popup";CallThirdPartyEvent("exec_bus_event_and_pagename","Child Popup Offered",c,a,d.omniture_uniq_id.value,b);$("div.inquire_holder").hide(1500).fadeOut("slow");$("div.inquire_child").show(1500).fadeIn("slow");$("select").hide();return false}else{if(checkShowHealth(document.Inquire)){a=Array("gmadInquiryAddlJuvOffered=false");CallThirdPartyEvent("exec_bus_event","Clicked Child checkbox, Child Popup NOT Shown",c,a,"",b);$("div.inquire_holder").hide(1500).fadeOut("slow");$("div.healthLayer").show(1500).fadeIn("slow");return false}else{a=Array("gmadInquiryAddlJuvOffered=false");CallThirdPartyEvent("exec_bus_event","Clicked Child checkbox, Child Popup NOT Shown",c,a,"",b);$("div.inquire_holder").hide("fast");$("div.loadingReceipt").show(1500).fadeIn("fast");$("div.glInquiryHeaderText").text("Next: Get Your FREE Quote And Apply Online");$.ajax({type:"GET",url:"autosubmit",dataType:"xml",async:false,data:"just-ignore-this",cache:false,success:function(e){e}});return true}}}function AutoChecker2(e){var d=document.forms[e];var b=validate_form(d,false);var c=new Array();var a=new Array();if(b){if(d.clickedSubmitted.value!="true"){c=Array("event16");a=Array("gmadInquirySubmissionMethod=autosubmit");CallThirdPartyEvent("exec_bus_event","Submitted without a Checkbox",c,a,d.omniture_uniq_id.value);SetDefaults2(d)}}return b}function Checker2(c,b){var a=validate_form(c,true);if(a&&!second_try){second_try=true;a=VerifyChoices2(c)}else{if(a){SetDefaults(c)}}if(a){autosubmit=false;c.button.value="submit"}if(c.policy_type.value=="combo"){c.action=b+"/combo"}else{if(c.policy_type.value=="juvenile"){c.action=b+"/child"}else{c.action=b+"/adult"}}return a}function SetDefaults2(g){var f=((g.policy_type.value=="adult")?true:false);var c=((g.policy_type.value=="juvenile")?true:false);var b=((g.policy_type.value=="combo")?true:false);var d=((g.policy_type.value=="")?true:false);var e=new Array();var a=new Array();if(d){e=Array("event2");a=Array("gmadInquiryProductChosen=none");CallThirdPartyEvent("exec_bus_event","Form boxes blank",e,a,g.omniture_uniq_id.value);g.adultHolder.value="Y"}else{if(c){e=Array("event4");a=Array("gmadInquiryProductChosen=childSolo");CallThirdPartyEvent("exec_bus_event","Checked Child on Form",e,a,g.omniture_uniq_id.value)}else{if(b){e=Array("event5");a=Array("gmadInquiryProductChosen=combo");CallThirdPartyEvent("exec_bus_event","Checked Combo on Form",e,a,g.omniture_uniq_id.value)}else{e=Array("event3");a=Array("gmadInquiryProductChosen=adultSolo");CallThirdPartyEvent("exec_bus_event","Checked Adult on Form",e,a,g.omniture_uniq_id.value)}}}return true}function VerifyChoices2(d){var c=new Array();var a=new Array();var b=new Array();SetDefaults2(d);if(d.policy_type.value=="adult"){c=Array("event10");a=Array("gmadInquiryAddlJuvOffered=true");b.PageName="Child Popup";CallThirdPartyEvent("exec_bus_event_and_pagename","Child Popup Offered",c,a,d.omniture_uniq_id.value,b);$("div.inquire_holder").hide(1500).fadeOut("slow");$("div.inquire_child").show(1500).fadeIn("slow");return false}else{if(checkShowHealth(document.Inquire)){a=Array("gmadInquiryAddlJuvOffered=false");CallThirdPartyEvent("exec_bus_event","Clicked Child checkbox, Child Popup NOT Shown",c,a,"",b);$("div.inquire_holder").hide(1500).fadeOut("slow");$("div.healthLayer").show(1500).fadeIn("slow");return false}else{a=Array("gmadInquiryAddlJuvOffered=false");CallThirdPartyEvent("exec_bus_event","Clicked Child checkbox, Child Popup NOT Shown",c,a,"",b);$("div.inquire_holder").hide("fast");$("div.loadingReceipt").show(1500).fadeIn("fast");return true}}}function FormElement(a,d,b,c){this.name=a;this.description=d;this.validator=b;this.type=c}var PatternsDict=new Object();PatternsDict.textPat=/.+/;PatternsDict.zipPat=/^\d{5}(-\d{4})?$/;PatternsDict.numbPat=/^\d+?$/;PatternsDict.codePat=/^\d{4}$/;fe=new Array();fe[0]=new FormElement("line1","Street Address","textPat","address");fe[1]=new FormElement("city","City","textPat","city");fe[2]=new FormElement("state","State","textPat","selection");fe[3]=new FormElement("zip","Zip","textPat","zip code");function validate_form(e,c){var d=true;var a="";errorFieldIds=new Array();if(!PatternsDict.textPat.exec(document.Inquire.fname.value)){a+="- First Name cannot be blank.\n";errorFieldIds.push("fname")}if(!PatternsDict.textPat.exec(document.Inquire.lname.value)){a+="- Last Name cannot be blank.\n";errorFieldIds.push("lname")}if(!PatternsDict.textPat.exec(document.Inquire.line1.value)){a+="- Street address does not contain a valid address.\n";errorFieldIds.push("line1")}if(!PatternsDict.textPat.exec(document.Inquire.city.value)){errorFieldIds.push("city");a+="- City does not contain a valid city.\n"}if(!PatternsDict.zipPat.exec(document.Inquire.zip.value)){errorFieldIds.push("zip");a+="- Zip Code does not contain a valid zip.\n"}if(!PatternsDict.textPat.exec(document.Inquire.state.value)){a+="- Please choose a State.\n";errorFieldIds.push("state")}if(a!=""&&c){alert(a+"Please enter this information before proceeding.");for(var b in errorFieldIds){$("#"+errorFieldIds[b]).css("background","#FFCDC9")}$("#"+errorFieldIds[0]).focus();d=false}else{if(a!=""){d=false}}return d}function AlertUsers(){alert("Please select a policy before filling out this form")}function createQuery(c){var f=c.elements;var e=new Array();e.push("tracking=ignore");for(var b=0;b<f.length;b++){var a=f[b];if(a.name&&a.value){var d="";if(a.type=="select-one"){d=a[a.selectedIndex].value}else{if(a.type=="radio"||a.type=="checkbox"){if(a.checked){d=a.value}}else{d=a.value}}if(d.length){e.push(a.name+"="+encodeURIComponent(d))}}}return e.join("&")}function SyncStates(a){var b=$(a).val();if(b!=""){$("[name=state]").val(b);return true}else{return false}}function WindowStatus(a){window.status=a;return true}function ValidateState(a){if(a.state.selectedIndex==0){alert("Please choose a state and click GO again!");return false}return true}var state="";function ChangeState(a,b){if(a!=""){document.forms[b].submit()}}function InquireChangeState(a,b){if((a=="NY"&&state!="NY")||(a=="MT"&&state!="MT")||(a=="UT"&&state!="UT")||(a!="NY"&&state=="NY")||(a!="MT"&&state=="MT")||(a!="UT"&&state=="UT")){document.getElementById("UpdatingPage").innerHTML='<span style="color: white; font-weight: bold; font-size: 16px; padding-right: 50px;">Page is reloading. Please stand by ...</span>';$("div.UpdatingPage").show(1500).fadeIn("fast");setTimeout("ReloadPage1('"+a+"','"+b+"')",1500)}}function ReloadPage1(a,b){document.forms[b].action="";document.forms[b].submit()}function Allow2Options(){$(document).ready(function(){var a=0;$("input[name^=age]").each(function(){if(this.checked){a++}});$("input[name^=age]").click(function(b){if(b.target.checked){a++}else{a--}if(a>2){$("div.alertbox").show("fast");a--;return false}else{$("div.alertbox").hide("fast")}})})}function getThisSelection(a){if(a=="existing_client"){$("div.contact_chooserHolder").show(500).fadeOut("fast");$("div.UpdatingPage_contact").show(1500).fadeIn("slow");setTimeout("ReloadPage('https://www.globeontheweb.com/eservicecenter/')",2500)}else{if(a=="other_question"){$("#submit_form").fadeIn()}else{alert("Please choose a reason for contacting Globe Life & Accident Insurance")}}}function ReloadPage(a){document.location.href=a}function checkContactInfo(){if(($("#globeLine1").val()==""||$("#globeCity").val()==""||$("#globeState").val()=="")&&($("#globePhone").val()==""&&$("#globeEmail").val()=="")||$("#globeReason").val()==""){alert("Globe Life Insurance would like to contact you regarding your question/comment below, but you will need to:\n\n 1) select a 'Reason for Inquiry' and \n\n 2) fill in at least one of the following: \n     A) your address, city, and state OR \n     B) your phone number OR \n     C) e-mail address.\n\nThank you for your understanding.");return false}else{if($("#globeCaptcha").val()==""&&$("#globeReason").val()!="LifeInsInfo"){alert("Please complete the security check at the bottom of the form.");return false}else{hideSubmit();return true}}}function showPolicy(){var a=document.getElementById("globeReason").value;if(a=="CustomerService"||a=="Other"){$("div#policy_num").fadeIn()}else{$("div#policy_num").fadeOut()}}function showComments(a){if(a!=""&&a!="LifeInsInfo"){$("#contact_comments").fadeIn();$("#contact_captcha").fadeIn()}else{$("#contact_comments").fadeOut();$("#contact_captcha").fadeOut()}}function hideSubmit(){$("div#showSubmit").show(500).fadeOut("fast");$("div#showLoading").show(1500).fadeIn("slow")}function ChangeStateContact(a,b){if((a=="NY"&&state!="NY")||(a!="NY"&&state=="NY")){document.getElementById("UpdatingPage").innerHTML='<span style="color: white; font-weight: bold; font-size: 16px; padding-right: 50px;">Page is reloading. Please stand by ...</span>';$("div.UpdatingPage").show(1500).fadeIn("fast");$("#globeReloadPage").val("true");setTimeout("ReloadPage1('"+a+"','"+b+"')",1500)}}function child_yes(){var c=document.Inquire;window.autosubmit=false;c.button.value="submit";c.juvenileHolder.value="Y";var b=new Array("event6");var a=new Array("gmadInquiryAddlJuvChosen=Y");CallThirdPartyEvent("exec_bus_event","Child Pop - Clicked Yes",b,a,c.omniture_uniq_id.value);$.ajax({type:"GET",url:"/autosubmit",dataType:"html",async:false,data:"just_insert_policy=J",cache:false,success:function(d){d}});$("div.inquire_child").hide();if(checkShowHealth(c)){$("div.healthLayer").show(1500).fadeIn("slow");return true}else{$("div.loadingReceipt").show();$("div.glInquiryHeaderText").text("Next: Get Your FREE Quote And Apply Online.");document.Inquire.submit()}}function child_no(){var c=document.Inquire;window.autosubmit=false;c.button.value="submit";var b=new Array("event7");var a=new Array("gmadInquiryAddlJuvChosen=N");CallThirdPartyEvent("exec_bus_event","Child Pop - Clicked No",b,a,c.omniture_uniq_id.value);$.ajax({type:"GET",url:"/autosubmit",dataType:"xml",async:false,data:"just-ignore-this",cache:false,success:function(d){d}});$("div.inquire_child").hide();if(checkShowHealth(c)){$("div.healthLayer").show(1500).fadeIn("slow");return true}else{$("div.loadingReceipt").show();$("div.glInquiryHeaderText").text("Next: Get Your FREE Quote And Apply Online.");document.Inquire.submit()}}function checkShowHealth(a){return false}function CallThirdPartyEvent(c,b,d,a,h,f){var g=true;try{if(c=="exec_bus_event"){exec_bus_event(d,b,a,h)}else{if(c=="exec_bus_event_and_pagename"){exec_bus_event_and_pagename(d,a,h,f)}}}catch(e){return g=false}return g}function exec_bus_event(i,e,a,h){var j=true;try{if((typeof(s_gi)=="object"||typeof(s_gi)=="function")&&i){var c="";var f="";if(typeof(s_account)=="undefined"){s_account="gmadglobereportingtest"}var k=s_gi(s_account);k.linkTrackVars="events";for(var g=0;g<i.length;g++){f=f+i;c=c+i+((h)?":"+h:"");if(g<(i.length-1)){c=c+",";f=f+","}}if(f!=""){k.linkTrackEvents=f;k.events=c;k.tl(this,"o",e);sendAjaxForDebugging(s_account+" - sending the following Omniture events: "+c)}else{if(typeof(s_gi)=="object"||typeof(s_gi)=="function"){sendAjaxForDebugging(s_account+" - Called the exec_bus_event function, but had no Events to send")}}}if(typeof(gmadaAdd)=="function"&&typeof(gmadaSubmit)=="function"&&a){for(var g=0;g<a.length;g++){gmadaAdd(a[g])}}if(typeof(di_cue)=="function"&&a){for(var g=0;g<a.length;g++){var b=a[g].split("=");if(b.length==2){di_cue(b[0],b[1])}}}}catch(d){return j=false}return j}function exec_bus_event_and_pagename(g,a,f,e){var i=true;try{if(typeof(s)=="object"&&g){if(typeof(s_account)=="undefined"){s_account="gmadglobereportingtest"}if(e.PageName){s.pageName=e.PageName}var c="";for(var h=0;h<g.length;h++){c=c+g+((f)?":"+f:"");if(h<(g.length-1)){c=c+","}}s.events=c;void (s.t());sendAjaxForDebugging(s_account+" - sending the following Omniture events: "+c)}else{if(typeof(s)=="object"){sendAjaxForDebugging(s_account+" - Called the exec_bus_event function, but had no Events to send")}}if(typeof(gmadaAdd)=="function"&&typeof(gmadaSubmit)=="function"&&a){for(var h=0;h<a.length;h++){gmadaAdd(a[h])}}if(typeof(di_cue)=="function"&&a){for(var h=0;h<a.length;h++){var b=a[h].split("=");if(b.length==2){di_cue(b[0],b[1])}}}}catch(d){return i=false}return i}function sendAjaxForDebugging(b){return true;try{if(typeof(debugMode)!="undefined"&&debugMode==1){$.ajax({type:"GET",url:"debug_events",dataType:"xml",data:("logevents="+b),cache:false})}}catch(a){}};
