
											function getDocObj(elem,parent) {
												  if (document.layers) {
													if (parent) {
													  return "document."+parent+".document."+elem;
													} else {
													  return "document."+elem;
													}
										
												  } else if (document.all) {
													return "document.all."+ elem;
												  } else if (document.getElementById) {
													return "document.getElementById('"+elem+"')";
												  }
											}
											function getDocObj(elem,parent) {
											  if (document.layers) {
													if (parent) {
														  return "document."+parent+".document."+elem;
													} else {
														  return "document."+elem;
													}
										
											  } else if (document.all) {
													return "document.all."+ elem;
											  } else if (document.getElementById) {
													return "document.getElementById('"+elem+"')";
											  }
										}
										
										function displayCommentBox(commentId, flag) {
											if(flag){
														eval(getDocObj(commentId)).style.display="block";
											}
											else {
														eval(getDocObj(commentId)).style.display="none";
											}
										}
										function changeChildren(value) {
										//  alert("checked"+value+"a");
										
											  if(value==1){//alert("checked"+value+"a");
												eval(getDocObj("child_option1")).style.display="none";
												eval(getDocObj("child_option2")).style.display="none";
												eval(getDocObj("child_option3")).style.display="none";
												eval(getDocObj("child_option4")).style.display="none";
												eval(getDocObj("child_option5")).style.display="none";
												eval(getDocObj("child_option")).style.display="block";
										
												} else if (value==2){// alert("checked"+value+"a");
										
												eval(getDocObj("child_option2")).style.display="none";
												eval(getDocObj("child_option3")).style.display="none";
												eval(getDocObj("child_option4")).style.display="none";
												eval(getDocObj("child_option5")).style.display="none";
												eval(getDocObj("child_option")).style.display="block";
												eval(getDocObj("child_option1")).style.display="block";
										
												}else if (value==3){ //alert("checked"+value+"a");
												eval(getDocObj("child_option3")).style.display="none";
												eval(getDocObj("child_option4")).style.display="none";
												eval(getDocObj("child_option5")).style.display="none";
												eval(getDocObj("child_option")).style.display="block";
												eval(getDocObj("child_option1")).style.display="block";
												eval(getDocObj("child_option2")).style.display="block";
										
												}else if (value==4){ //alert("checked"+value+"a");
												eval(getDocObj("child_option5")).style.display="none";
												eval(getDocObj("child_option")).style.display="none";
												eval(getDocObj("child_option1")).style.display="block";
												eval(getDocObj("child_option2")).style.display="block";
												eval(getDocObj("child_option3")).style.display="block";
												eval(getDocObj("child_option4")).style.display="block";
										
												}else if (value==5){ //alert("checked"+value+"a");
												eval(getDocObj("child_option")).style.display="block";
												eval(getDocObj("child_option1")).style.display="block";
												eval(getDocObj("child_option2")).style.display="block";
												eval(getDocObj("child_option3")).style.display="block";
												eval(getDocObj("child_option4")).style.display="block";
												eval(getDocObj("child_option5")).style.display="none";
												}else if (value==6){ //alert("checked"+value+"a");
												eval(getDocObj("child_option")).style.display="block";
												eval(getDocObj("child_option1")).style.display="block";
												eval(getDocObj("child_option2")).style.display="block";
												eval(getDocObj("child_option3")).style.display="block";
												eval(getDocObj("child_option4")).style.display="block";
												eval(getDocObj("child_option5")).style.display="block";
												}else{
												eval(getDocObj("child_option")).style.display="none";
												eval(getDocObj("child_option1")).style.display="none";
												eval(getDocObj("child_option2")).style.display="none";
												eval(getDocObj("child_option3")).style.display="none";
												eval(getDocObj("child_option4")).style.display="none";
												eval(getDocObj("child_option5")).style.display="none";
												}
										}
										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 checkSubmit(form){
												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.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 (!emailCheck(form.email.value)) {
											   //alert ("Please enter a valid email address.");
												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 phone number contains illegal characters.");
												return false;
												}
												if (!(stripped.length == 10)) {
												 alert("The 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 phone number contains illegal characters.");
												return false;
												}
												if (!(stripped.length == 10)) {
												 alert("The phone number is the wrong length.\nMake sure you included an area code.\n");
												 return false;
												}
												  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(document.getElementById){
													var conditionYes = document.getElementById("insured_1_health_conditions_yes").checked;
													var medicationYes = document.getElementById("insured_1_current_medications_yes").checked;
													var conditionDetail = document.getElementById("insured_1_health_conditions_detail").value;
													var medicationDetail = document.getElementById("insured_1_current_medications_detail").value;
													var conditionNo = document.getElementById("insured_1_health_conditions_no").checked;
													var medicationNo = document.getElementById("insured_1_current_medications_no").checked;
													//if(!conditionYes && !conditionNo){
													//	alert("Please check whether any insured has any preexisting conditions.");
													//	return false;
													//}
													//if(!medicationYes && !medicationNo){
													//	alert("Please check whether any insured currently takes any medications.");
													//	return false;
													//}
													if(conditionYes && trim(conditionDetail).length==0){
													alert("Please specify preexisting conditions.");
													return false;
													}
													if(conditionNo){
													document.getElementById("insured_1_health_conditions_detail").value="None listed";
													}
													if(medicationYes && trim(medicationDetail).length==0){
													alert("Please specify medications taken.");
													return false;
													}	    
													if(medicationNo){
													document.getElementById("insured_1_current_medications_detail").value="None listed";
													}
													}
											if(form.redirect.value!=""){form.redirect.value=form.redirect.value+"?address_1_zip="+form.address_1_zip.value+"&first_name="+form.first_name.value; }
											else{ form.redirect.value="/thanks-short-term.jsp?address_1_zip="+form.address_1_zip.value+"&first_name="+form.first_name.value; }
											 return true;
												}
												
												function ltrim ( s )
												{
													return s.replace( /^\s*/, "" )
												}
										
												function rtrim ( s )
												{
													return s.replace( /\s*$/, "" );
												}
										
												function trim ( s )
												{
													return rtrim(ltrim(s));
												}