function makePopUp(whereTo, winWidth, winHeight) 
{
  remote = window.open("","remotewin","width="+winWidth+",height="+winHeight+",menubar=0,toolbar=no,scrollbars=yes");
  remote.location.href = whereTo; 
  remote.focus();
}

function LifeVal(form){
	form.redirect.value="http://www.compare5quotes.com/exit/thanks-life.jsp?addressZip="+form.address_1_zip.value+"&firstName="+form.first_name.value;
	if (form.insured_1_dobMM.value==""){
             alert("Please enter your birthdate.");
             return false;
        }
          if (form.insured_1_dobDD.value==""){
             alert("Please enter your birthdate.");
             return false;
        }
          if (form.insured_1_dobYYYY.value==""){
             alert("Please enter your birthdate.");
             return false;
        }
            if (form.insured_1_gender.value==""){
             alert("Please enter your gender.");
             return false;
        }
            if (form.insured_1_heightFT.value==""){
             alert("Please enter your height.");
             return false;
        }
            if (form.insured_1_heightIN.value==""){
             alert("Please enter your height.");
             return false;
        }
            if (form.insured_1_weight.value==""){
             alert("Please enter your weight.");
             return false;
        }
	if (form.insured_1_smoker.value=="Select"){
	 alert("Please enter a tobacco usage.");
	 return false;
	}
	if (form.insured_1_coverage_amount.value=="Select"){
	 alert("Please choose a desired Coverage Amount.");
	 return false;
	}
	if (form.insured_1_term_length.value=="Select"){
	 alert("Please choose a desired Term Length.");
	 return false;
	}
		if (form.first_name.value==""){
												 alert("Please enter your first name.");
												 return false;
												}
												if (form.last_name.value==""){
												 alert("Please enter your last name.");
												 return false;
												}

										  
										  if (form.address_1_street1.value==""){
												 alert("Please enter your address.");
												 return false;
												}
										  if (form.address_1_city.value==""){
												 alert("Please select the city you live in.");
												 return false;
												}
										  if (form.address_1_state.value==""){
												 alert("Please select the state you live in.");
												 return false;
												}
										   if (form.address_1_zip.value==""){
												 alert("Please enter your zip code.");
												 return false;
												}
												var stripped = form.phone.value.replace(/[\(\)\.\-\ ]/g, '');
												//strip out acceptable non-numeric characters
												if (isNaN(parseInt(stripped))) {
												alert("The Day phone number contains illegal characters.");
												return false;
												}
												if (!(stripped.length == 10)) {
												 alert("The Day phone number is the wrong length.\nMake sure you included an area code.\n");
												 return false;
												}
												  var stripped = form.phone2.value.replace(/[\(\)\.\-\ ]/g, '');
												//strip out acceptable non-numeric characters
												if (isNaN(parseInt(stripped))) {
												alert("The Evening phone number contains illegal characters.");
												return false;
												}
												if (!(stripped.length == 10)) {
												 alert("The Evening phone number is the wrong length.\nMake sure you included an area code.\n");
												 return false;
												}
												 
										 		 if (!emailCheck(form.email.value)) {
											   alert ("Please enter a valid email address.");
												return false;
											   }
	return true;
}
function emailCheck (emailStr) {
   var emailPat=/^(.+)@(.+)$/
   var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
   var validChars="\[^\\s" + specialChars + "\]"
   var quotedUser="(\"[^\"]*\")"
   var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
   var atom=validChars + '+'
   var word="(" + atom + "|" + quotedUser + ")"
   var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
   var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
   var matchArray=emailStr.match(emailPat)
   if (matchArray==null) {
    alert("Email address seems incorrect (check @ and .'s)")
    return false
   }
   var user=matchArray[1]
   var domain=matchArray[2]
   // See if "user" is valid
   if (user.match(userPat)==null) {
       // user is not valid
       alert("The username of the email address doesn't seem to be valid.")
       return false
   }
   var IPArray=domain.match(ipDomainPat)
   if (IPArray!=null) {
       // this is an IP address
      for (var i=1;i<=4;i++) {
        if (IPArray[i]>255) {
            alert("Destination IP address is invalid!")
     return false
        }
       }
       return true
   }
   // Domain is symbolic name
   var domainArray=domain.match(domainPat)
   if (domainArray==null) {
    alert("The domain name doesn't seem to be valid.")
       return false
   }
   var atomPat=new RegExp(atom,"g")
   var domArr=domain.match(atomPat)
   var len=domArr.length
   if (domArr[domArr.length-1].length<2 ||
       domArr[domArr.length-1].length>3) {
      // the address must end in a two letter or three letter word.
      alert("The email address must end in a three-letter domain, or two letter country.")
      return false
   }
   // Make sure there's a host name preceding the domain.
   if (len<2) {
      var errStr="This address is missing a hostname!"
      alert(errStr)
      return false
   }
   // If we've gotten this far, everything's valid!
   return true;
   }


function getElement(e)
{
	var temp;
	if (document.all && !document.getElementById) {  //IE4
		 temp = eval('document.all.' + e);
	}
	else if (document.layers) {  //NS4
		temp = eval('document.' + e);
	}
	else if (document.getElementById) {  //IE5 and NS6
		temp = document.getElementById(e);
	}
	return temp;
}

function makePopUp(whereTo, winWidth, winHeight) 
{
  remote = window.open("","remotewin","width="+winWidth+",height="+winHeight+",menubar=0,toolbar=no,scrollbars=yes");
  remote.location.href = whereTo; 
  remote.focus();
}