var xmlHttp
var baseurl="http://www.sprinsgroup.com";function showmile(str,url1)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
var str=str.replace('@','AT')
str=str.replace('.','DOT')
var url=url1+"page/succ_mail/"+str
xmlHttp.onreadystatechange=function(){}
xmlHttp.open("GET",url,false)
xmlHttp.send(null)
if(xmlHttp.responseText==1){return 1;}else{return 0;}}
function showzipcode(str)
{var xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
var url=baseurl+"page/validzipcode/"+str
xmlHttp.onreadystatechange=function(){}
xmlHttp.open("GET",url,false)
xmlHttp.send(null)
if(xmlHttp.responseText==1){return 0;}else{return 1;}}
function GetXmlHttpObject()
{var objXMLHttp=null
if(window.XMLHttpRequest)
{objXMLHttp=new XMLHttpRequest()}
else if(window.ActiveXObject)
{objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")}
return objXMLHttp}
function createAjax()
{var xt;xt=window.XMLHttpRequest?new XMLHttpRequest():(window.ActiveXObject?new window.ActiveXObject('Microsoft.XMLHTTP'):null)
return xt;}
function getid(str)
{return document.getElementById(str);}
function checkemailvalidity(str)
{var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(reg.test(str)==false){return 1;}else{return 0}}
function trim(str)
{if(!str||typeof str!='string')
return null;return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');}
function contact_validation()
{var emailRegxp=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;var strphone=/^((\([0-9]{3}\) ?)|([0-9]{3}-))?[0-9]{3}-[0-9]{4}$/i;var errors=0;var iChars="!#$%^&*()+=-_[]\\\;,/{}|\":<>?0123456789";for(var i=0;i<document.frmcontact.fname1.value.length;i++){if(iChars.indexOf(document.frmcontact.fname1.value.charAt(i))!=-1){animation.alert('<br /><h1>Please enter a valid First Name</h1>');document.frmcontact.fname1.value="";return false;}}
var iChars="!#$%^&*()+=-_[]\\\;,/{}|\":<>?0123456789";for(var i=0;i<document.frmcontact.lname1.value.length;i++){if(iChars.indexOf(document.frmcontact.lname1.value.charAt(i))!=-1){animation.alert('<br /><h1>Please enter a valid Last Name</h1>');document.frmcontact.lname1.value="";return false;}}
if(document.frmcontact.fname1.value=="")
{animation.alert('<br /><h1>Please enter a First Name</h1>');return false;}
if(document.frmcontact.lname1.value=="")
{animation.alert('<br /><h1>Please enter a Last Name</h1>');return false;}
if(emailRegxp.test(document.frmcontact.email1.value)!=true)
{animation.alert('<br /><h1>Please enter a valid Email Address</h1>');return false;}
if(document.frmcontact.phone.value=="")
{animation.alert('<br /><h1>Please enter a Phone Number</h1>');return false;}else if(strphone.test(document.frmcontact.phone.value)!=true){animation.alert('<br /><h1>Please enter a valid Phone Number</h1>');return false;}
if(document.frmcontact.message.value=="")
{animation.alert('<br /><h1>Please enter Message</h1>');return false;}}
function quotingvalidation_quot1()
{var zip=document.getElementById("zip_quot1").value;document.getElementById("city_quot_1").value='';if(zip.length>4)
{if(zip=="")
{animation.alert('<br /><h1>Please enter your zip code</h1>');return false;}
if(isNaN(zip))
{animation.alert('<br /><h1>Error. Please enter numbers only</h1> ');return false;}
if(showzipcode(zip)==1)
{animation.alert('<br /><h1>ZIP Code not valid. Please try again</h1> ');return false;}}else{animation.alert('<br /><h1>ZIP Code not valid. Please try again</h1>');return false;}
var str='command='+zip;var jax=createAjax();if(!jax)return;jax.open("POST",baseurl+"member/get_zip/",true)
jax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");jax.send(str)
jax.onreadystatechange=function(){statecha_quot(jax)}}
function statecha_quot(jax)
{if(jax.readyState==4||jax.readyState=="complete")
{if(jax.responseText!=''){document.getElementById("city_quot_1").value=jax.responseText;}else{document.getElementById("city_quot_1").value='';}}}
function quotingvalidation()
{if(document.frm_quoting.NewCategory.value=="")
{animation.alert('<br /><h1>Please select Insurance type</h1>');document.frm_quoting.NewCategory.focus();return false;}
if(document.frm_quoting.zip.value=="")
{animation.alert('<br /><h1>Please enter your zip code</h1>');document.frm_quoting.zip.focus();return false;}
if(isNaN(document.frm_quoting.zip.value))
{animation.alert('<br /><h1>Error. Please enter numbers only</h1> ');document.frm_quoting.zip.focus();return false;}
if(showzipcode(document.frm_quoting.zip.value)==1)
{animation.alert('<br /><h1>ZIP Code not valid. Please try again</h1> ');return false;}
document.frm_quoting.submit();}
function validationstep3()
{document.step3.submit();}
function basicvalidation()
{if(document.getElementById("zip_quot1").value=="")
{animation.alert('<br /><h1>Please enter your zip code</h1>');return false;}
if(isNaN(document.getElementById("zip_quot1").value))
{animation.alert('<br /><h1>Error. Please enter numbers only</h1> ');return false;}
if(showzipcode(document.getElementById("zip_quot1").value)==1)
{animation.alert('<br /><h1>ZIP Code not valid. Please try again</h1> ');return false;}
var emailRegxp=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;var regsss=/^((\([0-9]{3}\) ?)|([0-9]{3}-))?[0-9]{3}-[0-9]{4}$/;var iChars="!#$%^&*()+=-_[]\\\;,/{}|\":<>?0123456789";for(var i=0;i<document.basic_information.fname.value.length;i++){if(iChars.indexOf(document.basic_information.fname.value.charAt(i))!=-1){animation.alert('<br /><h1>Please enter a valid First Name</h1>');document.basic_information.fname.value="";document.basic_information.fname.focus();return false;}}
var iChars="!#$%^&*()+=-_[]\\\;,/{}|\":<>?0123456789";for(var i=0;i<document.basic_information.lname.value.length;i++){if(iChars.indexOf(document.basic_information.lname.value.charAt(i))!=-1){animation.alert('<br /><h1>Please enter a valid Last Name</h1>');document.basic_information.lname.value="";document.basic_information.lname.focus();return false;}}
var iChars="!#$%^&*()+=[]\\\;,/{}|\":<>?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(var i=0;i<document.basic_information.phone.value.length;i++){if(iChars.indexOf(document.basic_information.phone.value.charAt(i))!=-1){animation.alert('<br /><h1>Please enter a valid phone </h1>');document.basic_information.phone.value="";document.basic_information.phone.focus();return false;}}
if(!document.basic_information.individual[0].checked&&!document.basic_information.individual[1].checked)
{animation.alert("<br /><h1>Please Select Insurance Type</h1>");return false;}
if(document.basic_information.fname.value=="")
{animation.alert('<br /><h1>Please enter a First Name</h1>');document.basic_information.fname.focus();return false;}
if(document.basic_information.lname.value=="")
{animation.alert('<br /><h1>Please enter a Last Name</h1>');document.basic_information.lname.focus();return false;}
if((document.basic_information.phone.value=="")||(document.basic_information.phone.value=='877-948-8887'))
{animation.alert('<br /><h1>Please enter a Phone </h1>');document.basic_information.phone.focus();return false;}
else if(regsss.test(document.basic_information.phone.value)==false)
{animation.alert('<br /><h1>Please enter a valid Phone</h1>')
return false;}
if(document.basic_information.email.value=="")
{animation.alert('<br /><h1>Please enter a E-mail</h1>');document.basic_information.email.focus();return false;}
if(emailRegxp.test(document.basic_information.email.value)!=true)
{animation.alert('<br /><h1>Please enter a valid Email Address</h1>');document.basic_information.email.focus();return false;}
if(document.basic_information.agent.value=="")
{animation.alert('<br /><h1>Please select which agent are you working with?</h1>');return false;}
document.basic_information.submit();}
function quot1validation()
{var stat=getid("state_new").value;var health=getid("health_class").value;var insurance=getid("type_insurance").value;var bmonth=getid("birth_month").value;var bdate=getid("birth_date").value;var byear=getid("birth_year").value;var coverage=getid("coverage_desired").value;var agent=getid("agent").value;var ulocation=getid("userlocation").value;var tfile=getid("templatefile").value;var hfile=getid("htemplatefile").value;if(stat=='')
{animation.alert('<br /><h1>Please select State</h1>');return false;}
if(health=='')
{animation.alert('<br /><h1>Please select Health Class</h1>');return false;}
if(insurance=='')
{animation.alert('<br /><h1>Please select Type of Insurance</h1>');return false;}
if(bmonth=='')
{animation.alert('<br /><h1>Please select Birth Month</h1>');return false;}
if(bdate=='')
{animation.alert('<br /><h1>Please select Birth Date</h1>');return false;}
if(byear=='')
{animation.alert('<br /><h1>Please select Birth year</h1>');return false;}
var sex=document.getElementsByName("Sex")
var status=false;for(var ss=0;ss<sex.length;ss++)
{if(sex[ss].checked==true)
{status=true;break;}}
if(status==false)
{animation.alert('<br /><h1>Please select your Gender</h1>');return false;}
var smoker=document.getElementsByName("Smoker")
var stat=false;for(var smo=0;smo<sex.length;smo++)
{if(smoker[smo].checked==true)
{stat=true;break;}}
if(stat==false)
{animation.alert('<br /><h1>Please select whether you are a Smoker or not?</h1>');return false;}
if(coverage=='')
{animation.alert('<br /><h1>Please select Coverage Desired</h1>');return false;}
if(agent=='')
{animation.alert('<br /><h1>Please select a agent are you working with?</h1>');return false;}
viewquotes_quot1();}
function hash(val)
{window.location.hash=val}
function validationquoting3()
{if((document.frmquoting2.month.value.length<2)||(document.frmquoting2.month.value.value=='MM')||(document.frmquoting2.month.value>12))
{animation.alert('<br /><h1>Please enter a valid Date of Birth month.</h1> ');document.frmquoting2.month.focus();return false;}
if((document.frmquoting2.date.value.length<2)||(document.frmquoting2.date.value=='DD')||(document.frmquoting2.date.value>31))
{animation.alert('<br /><h1>Please enter a valid Date of Birth date.</h1> ');document.frmquoting2.date.focus();return false;}
if((document.frmquoting2.year.value.length<4)||(document.frmquoting2.year.value=='YYYY'))
{animation.alert('<br /><h1>Please enter a valid Date of Birth year.</h1> ');document.frmquoting2.year.value.focus();return false;}
if(parseInt(document.getElementById('spouseflag').value))
if(!validatespouse())return false;if(window.totchild)if(!validatechild())return false;viewquotes();}
function dateclick(){if((document.frmquoting2.date.value.length==2)&&(document.frmquoting2.date.value!='DD')){if(document.frmquoting2.year.value=='YYYY'){document.frmquoting2.year.value='';}
document.frmquoting2.year.focus();}}
function monthclick(){if((document.frmquoting2.month.value.length==2)&&(document.frmquoting2.month.value!='MM')){if(document.frmquoting2.date.value=='DD'){document.frmquoting2.date.value='';}
document.frmquoting2.date.focus();}}
function sdateclick(){if((document.frmquoting2.sdate.value.length==2)&&(document.frmquoting2.sdate.value!='DD')){if(document.frmquoting2.syear.value=='YYYY'){document.frmquoting2.syear.value='';}
document.frmquoting2.syear.focus();}}
function smonthclick(){if((document.frmquoting2.smonth.value.length==2)&&(document.frmquoting2.smonth.value!='MM')){if(document.frmquoting2.sdate.value=='DD'){document.frmquoting2.sdate.value='';}
document.frmquoting2.sdate.focus();}}
function validatechild()
{var cmo=document.getElementsByName('cmonth[]')
var cdo=document.getElementsByName('cdate[]')
var cyo=document.getElementsByName('cyear[]')
for(var i=0;i<totchild;i++)
{if((cmo[i].value.length<2)||(cmo[i].value=='MM')||(cmo[i].value>12))
{animation.alert('<h1>Please enter a valid Date of Birth <br />for child '+(i+1)+'.</h1><br />');cmo[i].focus();return false;}
if((cdo[i].value.length<2)||(cdo[i].value=='DD')||(cdo[i].value>31))
{animation.alert('<h1>Please enter a valid Date of Birth <br />for child '+(i+1)+'.</h1><br /> ');cdo[i].focus();return false;}
if((cyo[i].value.length<4)||(cyo[i].value=='YYYY'))
{animation.alert('<h1>Please enter a valid Date of Birth <br />for child '+(i+1)+'.</h1><br /> ');cyo[i].focus();return false;}}
return true;}
function validatespouse()
{if((document.frmquoting2.smonth.value.length<2)||(document.frmquoting2.smonth.value.value=='MM')||(document.frmquoting2.smonth.value>12))
{animation.alert('<br /><h1>Please enter a valid Date of Birth <br />for spouse.</h1><br /> ');document.frmquoting2.smonth.focus();return false;}
if((document.frmquoting2.sdate.value.length<2)||(document.frmquoting2.sdate.value=='DD')||(document.frmquoting2.sdate.value>31))
{animation.alert('<br /><h1>Please enter a valid Date of Birth <br />for spouse.</h1><br /> ');document.frmquoting2.sdate.focus();return false;}
if((document.frmquoting2.syear.value.length<4)||(document.frmquoting2.syear.value=='YYYY'))
{animation.alert('<br /><h1>Please enter a valid Date of Birth <br />for spouse.</h1><br /> ');document.frmquoting2.syear.value.focus();return false;}
return true}
function IsNumeric(sText)
{var ValidChars="0123456789.";var IsNumber=true;var Char;for(i=0;i<sText.length&&IsNumber==true;i++)
{Char=sText.charAt(i);if(ValidChars.indexOf(Char)==-1)
{IsNumber=false;}}
return IsNumber;}
function requestinfo(url,id)
{var nami=getid("request_name"+id).value;var emaisl=getid("request_email"+id).value;var inte=getid("interested"+id).value;var phon=getid("phone"+id).value;var comm=getid("comments"+id).value;if(nami=='')
{animation.alert('<br /><h1>Name should not be empty</h1>')
return false;}
if(emaisl=='')
{animation.alert('<br /><h1>Email Address should not be empty</h1>')
return false;}else if(checkemailvalidity(emaisl)){animation.alert('<br /><h1>Invalid Email Address</h1>')
return false;}
if(phon!='')
{if(phon=='877-948-8887'){animation.alert('<br /><h1>Please enter valid Phone number</h1>')
return false;}
var regss=/^((\([0-9]{3}\) ?)|([0-9]{3}-))?[0-9]{3}-[0-9]{4}$/;if(regss.test(phon)==false)
{animation.alert('<br /><h1>Please enter valid Phone number</h1>')
return false;}}
if(inte=='')
{animation.alert('<br /><h1>Please enter What are you interested in?</h1>')
return false;}
if(comm=='')
{animation.alert('<br /><h1>Please enter Details/Comments</h1>')
return false;}
var str='command=product';str+='&name='+nami;str+='&email='+emaisl;str+='&interested='+inte;str+='&comm='+comm;str+='&phon='+phon;var jax=createAjax();if(!jax)return;jax.open("POST",url+"page/request/",true)
jax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");jax.send(str)
jax.onreadystatechange=function(){statechangess(jax,url)}}
function statechangess(jax,url)
{if(jax.readyState==4||jax.readyState=="complete")
{if(jax.responseText==1){window.location=url+'page/thanks_request';}else{window.location=url+'page/error';}}}
function getproductcontent(id,url)
{var str='command=product';str+='&id='+id
var jax=createAjax();if(!jax)return;jax.open("POST",url+"page/product/",true)
jax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");jax.send(str)
jax.onreadystatechange=function(){statecontent(jax)}}
function statecontent(jax)
{if(jax.readyState==4||jax.readyState=="complete")
{var res=jax.responseText
var title=res.split('::::')
document.getElementById('pagetitle').innerHTML=title[0];document.getElementById('pagedynatitle').innerHTML=title[0];document.getElementById('pagebody').innerHTML=title[1];http:document.getElementById('pagedycaption').innerHTML=title[2];document.getElementById('pageimgages').src='//sprezzatura.com/media/presspage/'+title[3];}}
function getcontactvalues(url,id)
{var fn=getid("fname"+id).value;var ln=getid("lname"+id).value;var em=getid("email"+id).value;var org=getid("organization"+id).value;if(fn==''||fn=='First Name')
{animation.alert('<br /><h1>Please enter First Name</h1>')
return false;}
if(ln==''||ln=='Last Name')
{animation.alert('<br /><h1>Please enter Last Name</h1>')
return false;}
if(em==''||em=='E-mail Address')
{animation.alert('<br /><h1>Please enter Email Address</h1> ')
return false;}else if((em!="")&&(em!='E-mail Address'))
{if(checkemailvalidity(em)){animation.alert('<br /><h1>Invalid Email Address</h1>')
return false;}
if(showmile(em,url)==1)
{animation.alert('<br /><h1>Email Address is already in use!</h1>');return false;}}
if(org=='Organization (optional)')
{org='';}
var str='command=contactus';str+='&fname='+fn
str+='&lname='+ln
str+='&em='+em
str+='&organ='+org
var jax=createAjax();if(!jax)return;jax.open("POST",url+"member/contactus/",true)
jax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");jax.send(str)
jax.onreadystatechange=function(){Resultss(jax,url,id)}}
function Resultss(jax,url,id)
{if(jax.readyState==4||jax.readyState=="complete")
{if(jax.responseText==1){window.location=url+'page/result/'}else{window.location=url+'page/error';}}
clearall(id)}
function getsubscribe(url,str)
{if(str)
{var subs=getid('newsletter_subscribe').value;if(subs=='')
{animation.alert('<br /><h1>Email Address should not be empty</h1>')
return false;}else if(checkemailvalidity(subs)){animation.alert('<br /><h1>Invalid Email Address</h1>')
return false;}
if(showmile(subs,url)==1)
{animation.alert('<br /><h1>Email Address is already in use!</h1>');return false;}
var str='command=subsc';str+='&subs='+subs
var jax=createAjax();if(!jax)return;jax.open("POST",url+"member/subs_news/",true)
jax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");jax.send(str)
jax.onreadystatechange=function(){Result_userhome(jax,url)}}}
function Result_userhome(jax,url)
{if(jax.readyState==4||jax.readyState=="complete")
{if(jax.responseText==1){window.location=url+'page/result/'}else{window.location=url+'page/error';}}}
function clearall(id)
{getid('fname'+id).value='First Name';getid('lname'+id).value='Last Name';getid('email'+id).value='E-mail Address';getid('organization'+id).value='Organization (optional)';}
function changeforgot(id)
{getid('forgotemail').value='';if(id)
{getid('loginuserdetail').style.display='none';getid('loginforgotdetail').style.display='block';getid('loginerrormsg').innerHTML=" ";getid('forgotmsgtext').style.display='block';getid('loginmsgtext').style.display='none';getid('loguser_1').value="";getid('logpass_1').value="";getid('logintext_1').innerHTML="Forgot Password";}else{getid('loginmsgtext').style.display='block';getid('loginuserdetail').style.display='block';getid('loginforgotdetail').style.display='none';getid('loginerrormsg').innerHTML=" ";getid('forgotmsgtext').style.display='none';getid('loguser_1').value="";getid('logpass_1').value="";getid('logintext_1').innerHTML="User Login";}}
function clearregister()
{getid('firstname').value="";getid('lastname').value="";getid('username').value="";getid('emails').value="";getid('remail').value="";getid('phone').value="";getid('address').value="";getid('city').value="";getid('zipcode').value="";getid('nameInfo').innerHTML=" ";getid('userNameInfo').innerHTML=" ";getid('email1Info').innerHTML=" ";getid('email2Info').innerHTML=" ";getid('phoneInfo').innerHTML=" ";getid('zipInfo').innerHTML=" ";}
var ur=document.location.href.split("/");var swap=ur[3];function showimage(where)
{if(where)
{document.getElementById("swapimage").src=baseurl+"application/views/sprezzatura/images/Pressroom_h.jpg";}
else if((swap!='press-room')&&(swap!='pressnews')&&(swap!='pressarticles')&&(swap!='pressaudio')&&(swap!='pressvideo')&&(swap!='faq')&&(swap!='links'))
{document.getElementById("swapimage").src=baseurl+"application/views/sprezzatura/images/Pressroom.jpg";}}
function show_company(where)
{if(where)
{document.getElementById("swapcompany").src=baseurl+"application/views/sprezzatura/images/thecompany_h.jpg";}else if((swap!='about-us')&&(swap!='Company')&&(swap!='solutions')&&(swap!='service')&&(swap!='wellness')&&(swap!='events')&&(swap!='company'))
{document.getElementById("swapcompany").src=baseurl+"application/views/sprezzatura/images/thecompany.jpg";}}
function show_articles(where)
{if(where)
{document.getElementById('swap_wellness').src=baseurl+"application/views/sprezzatura/images/welnessprograms_h.jpg";}else if(swap!='articles'&&swap!='wellness-programs')
{document.getElementById('swap_wellness').src=baseurl+"application/views/sprezzatura/images/welnessprograms.jpg";}}
function trim(str,chars){return ltrim(rtrim(str,chars),chars);}
function ltrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("^["+chars+"]+","g"),"");}
function rtrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("["+chars+"]+$","g"),"");}
function check_pho_count(str,id,evt)
{evt=(evt)?evt:window.event
var charCode=(evt.which)?evt.which:evt.keyCode
if(charCode!=8)
{if(str.length==3)
{getid("phone"+id).value=getid("phone"+id).value+'-';}
if(str.length==7)
{getid("phone"+id).value=getid("phone"+id).value+'-';}}}
function check_pho_regis(str,evt)
{evt=(evt)?evt:window.event
var charCode=(evt.which)?evt.which:evt.keyCode
if(charCode!=8)
{if(str.length==3)
{getid("phone").value=getid("phone").value+'-';}
if(str.length==7)
{getid("phone").value=getid("phone").value+'-';}}}
function check_pho_count_quot(str,id)
{if(str.length==3)
{getid(id).value=getid(id).value+'-';}
if(str.length==7)
{getid(id).value=getid(id).value+'-';}}
function checkIt(e)
{var key;var status;if(window.event)key=event.keyCode;else key=e.which;if((key>47&&key<59)||(key==40)||(key==41)||(key==8)||((key==0)))
{status="";return true;}else
{status="Enter Numeric Value";return false;}}
function getHostname(str){var re=new RegExp('^(?:f|ht)tp(?:s)?\://([^/]+)','im');return str.match(re)[1].toString();}
function getjsRadioText(nami)
{var al=document.getElementsByName(nami)
var str='';for(var i=0;i<al.length;i++)
if(al[i].checked)return al[i].value
return null}
