
function clearFields()
{$('.appForm2').val('');$('.appForm3').val('');}
function do_prefill(state)
{if(document.forms[0])
setSelectBox(document.forms[0].state,state);}
function setSelectBox(obj,value)
{if(!obj)
return;if(value.length)
for(var j=0;j<obj.length;j++)
{if(obj[j].value==value)
{obj.selectedIndex=j;break;}}}
function AutoGCChecker(theFormName)
{var theForm=document.forms[theFormName];var isOk=gcChecker(theForm,false,false);if(isOk)
{if(theForm.clickedSubmitted.value!="true")
{var OmnEvents=new Array("event16");var GMADevents=new Array("gmadInquirySubmissionMethod=autosubmit");CallThirdPartyEvent("exec_bus_event","Submitted without a Checkbox",OmnEvents,GMADevents,theForm.omniture_uniq_id.value);}}
return isOk;}
function gcChecker(theForm,page,shouldShowError)
{var error=new Array();var e=0;if($('#fname').val()=='')error[e++]=".fname_error";if($('#lname').val()=='')error[e++]=".lname_error";if($('#line1').val()=='')error[e++]=".line1_error";if($('#state').val()=='')error[e++]=".state_error";if($('#city').val()==''&&$('#zip').val()==''){if($('#city').val()=='')error[e++]=".city_error";if($('#zip').val()=='')error[e++]=".zip_error";}
else if($('#zip').val()!=''&&!validateType($('#zip').val(),'zip'))
error[e++]=".zip_error";if(!checkStates($('#state').val()))error[e++]=".state_not_allowed_error";if(error.length==0&&page)theForm.action=page;if(shouldShowError)return showError(error)
else return((error.length>0)?false:true);}
function showError(errorArray)
{if(errorArray.length>0)
{for(var x=0;x<errorArray.length;x++)
{$(errorArray[x]).show();}
return false;}
else return true;}
function checkForType(inputID,type)
{if(!validateType($('#'+inputID).val(),type)&&$('#'+inputID).val()!='')$("."+inputID+"_error").show();else $("."+inputID+"_error").hide();}
function validateType(thisValue,type)
{if(type&&thisValue)
{regE=false;if(type=='chars')var regE=/^[a-zA-Z]*\s{0,1}[a-zA-Z]*\s*$/i;else if(type=='state')var regE=/^[a-zA-Z]{2,}$/;else if(type=='numbers')var regE=/^[0-9]{1,}$/;else if(type=='zip')var regE=/^[0-9]{5}$/;else if(type=='phone')var regE=/^[1-9]\d{2}\-?\d{3}\-?\d{4}$/;else if(type=='email')var regE=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;else if(type=='phone3')var regE=/^\d{3}$/;else if(type=='phone4')var regE=/^\d{4}$/;if(type=='general')return true;if(regE&&!regE.test(thisValue))return false;else return true;}return false;}
function getThisSelection(selection)
{if(selection=='existing_client'){$('div.contact_chooserHolder').show(500).fadeOut("fast");$('div.UpdatingPage_contact').show(1500).fadeIn("slow");setTimeout('ReloadPage(\'https://www.unitedamerican.com/eservicecenter/\')',2500);}
else if(selection=='other_question'){document.getElementById('chooser_holder').style.marginBottom='0';document.getElementById('submit_form').style.display='block';}
else alert("Please choose a reason for contacting Globe Life & Accident Insurance");}
function ReloadPage(thisValue)
{document.location.href=thisValue;}
function checkContactInfo()
{if(((document.getElementById('globeAddress').value==''||document.getElementById('globeCity').value==''||document.getElementById('globeState').value=='')&&(document.getElementById('globePhone').value=='')&&(document.getElementById('globeEmail').value==''))||(document.getElementById('globeReason').value==''))
{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 return true;}
function showPolicy()
{var selectValue=document.getElementById('globeReason').value;if(selectValue=='CustomerService'||selectValue=='Other')
$('div#policy_num').show(1500).fadeIn("fast");}
function checkStates(state)
{var allowedState=true;var noInquireStates=Array("FL","MA","MN","NH","NJ","NY");for(var i=0;i<noInquireStates.length;i++)
{if(noInquireStates[i]==state)
{allowedState=false;break;}}
if(!allowedState)$(".state_not_allowed_error").show();else $(".state_not_allowed_error").hide();return allowedState;}
function CallThirdPartyEvent(eventType,eventName,omnEvent,GMADevent,UniqueID,addVarArray)
{var success=true;try
{if(eventType=="exec_bus_event")exec_bus_event(omnEvent,eventName,GMADevent,UniqueID);else if(eventType=="exec_bus_event_and_pagename")exec_bus_event_and_pagename(omnEvent,GMADevent,UniqueID,addVarArray);}
catch(err)
{return success=false;}
return success;}
function exec_bus_event(omnEvent,eventName,GMADevent,UniqueID)
{var success=true;try
{if((typeof(s_gi)=="object"||typeof(s_gi)=="function")&&omnEvent)
{var collectEvents='';var trackTheseEvents='';if(typeof(s_account)=="undefined")s_account='gmadglobereportingtest';var s=s_gi(s_account);s.linkTrackVars='events';for(var x=0;x<omnEvent.length;x++)
{trackTheseEvents=trackTheseEvents+omnEvent;collectEvents=collectEvents+omnEvent+((UniqueID)?":"+UniqueID:'');if(x<(omnEvent.length-1)){collectEvents=collectEvents+",";trackTheseEvents=trackTheseEvents+",";}}
if(trackTheseEvents!='')
{s.linkTrackEvents=trackTheseEvents;s.events=collectEvents;s.tl(this,'o',eventName);sendAjaxForDebugging(s_account+" - sending the following Omniture events: "+collectEvents);}
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"&&GMADevent)
{for(var x=0;x<GMADevent.length;x++)
{gmadaAdd(GMADevent[x]);}}}
catch(err)
{return success=false;}
return success;}
function exec_bus_event_and_pagename(omnEvent,GMADevent,UniqueID,addVarArray)
{var success=true;try
{if(typeof(s)=="object"&&omnEvent)
{if(typeof(s_account)=="undefined")s_account='gmadglobereportingtest';if(addVarArray['PageName'])s.pageName=addVarArray['PageName'];var collectEvents='';for(var x=0;x<omnEvent.length;x++)
{collectEvents=collectEvents+omnEvent+((UniqueID)?":"+UniqueID:'')
if(x<(omnEvent.length-1))collectEvents=collectEvents+",";}
s.events=collectEvents;void(s.t());sendAjaxForDebugging(s_account+" - sending the following Omniture events: "+collectEvents);}
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"&&GMADevent)
{for(var x=0;x<GMADevent.length;x++)
{gmadaAdd(GMADevent[x]);}}}
catch(err)
{return success=false;}
return success;}
function sendAjaxForDebugging(theseEvents)
{try
{if(typeof(debugMode)!="undefined"&&debugMode==1)
{$.ajax({type:"GET",url:"debug_events",dataType:"xml",data:("logevents="+theseEvents),cache:false});}}
catch(err)
{}}