/**
 * Return User Instant Quote Form
 * @requires gen_validatorv31.js
 * @requires ie.overlay.quote.css
 * @requires overlay.quote.css
 *
 */
var trackStateInfo = "";
var s_prop_6 = "individualhealthquotes";
if(GHI_LEAD_DATA){
	if(GHI_LEAD_DATA["address_1_state"]) {
		trackStateInfo = GHI_LEAD_DATA["address_1_state"];
	}
}

var returnFormValidator;
var returnForm = "\
	<div id='returnFormDivContainer'>\
		<div id='returnFormDivContainerTop'>\
		</div>\
		<div id='returnFormDivContainerContent'>\
			<h2>View instant quotes online right now!</h2>\
			<p>Welcome back shopper! Review you basic information below to view your free quotes in one simple click.</p>\
			<br />\
			<p>If this is your first time visiting and you&rsquo;d like to receive quotes from licensed agents, please <a href='javascript: void(0);' class='overlayClose'>click here</a> to complete our request form.</p>\
			<form name='instant-quote' id='instant-quote' method='post' action='http://www.gohealthinsurance.com/instant/quoteengine.jsp?page=Quote'>\
				<fieldset>\
					<input type='hidden' name='firstName' id='firstName'/>\
					<input type='hidden' name='lastName' id='lastName'/>\
					<input type='hidden' name='how_hear' id='how_hear'/>\
					<input type='hidden' name='source' id='repo'/>\
					<input type='hidden' name='_method' id='_method' value='post'/>\
					<span class='legend'>See your free quotes in just one click&hellip;</span>\
					<div class='returnFormApplicantInfoTop'>\
					</div>\
					<div class='returnFormApplicantInfo'>\
						<div class='returnFormApplicantInfoLabel'>\
							<span class='returnFormApplicantInfoGender'><sup>*</sup>Gender</span>\
							<label class='returnFormApplicantInfoDOB' for='applicant_dobMM'><sup>*</sup>Date of Birth</label>\
							<span class='returnFormApplicantInfoSmoker'><sup>*</sup>Smoker</span>\
							<label class='returnFormApplicantInfoZip' for='zip'><sup>*</sup>ZIP Code</label>\
						</div>\
						<div class='returnFormApplicantInfoForm'>\
							<span class='returnFormTitle'>Applicant</span>\
							<input type='radio' name='applicant_gender' id='applicant_gender_male' class='instaquote_gender_male' value='Male'/><label for='applicant_gender_male' class='returnFormApplicantInfoMale'>M</label>\
							<input type='radio' name='applicant_gender' id='applicant_gender_female' class='instaquote_gender_female' value='Female'/><label for='applicant_gender_female' class='returnFormApplicantInfoFemale'>F</label>\
							<input type='text' name='applicant_dobMM' id='applicant_dobMM' maxlength='2' size='2' class='instantquote_dobMM' /><span class='dateSlash'>/</span>\
							<input type='text' name='applicant_dobDD' id='applicant_dobDD' maxlength='2' size='2' class='instantquote_dobDD'/><span class='dateSlash'>/</span>\
							<input type='text' name='applicant_dobYYYY' id='applicant_dobYYYY' maxlength='4' size='4' class='instantquote_dobYYYY'/>\
							<input type='hidden' name='applicant_dob' id='applicant_dob'/>\
							<input type='radio' name='applicant_smoker' id='applicant_smoker_yes' class='instaquote_smoker_yes' value='yes'/><label for='applicant_smoker_yes' class='returnFormApplicantInfoSmokeYes'>Yes</label>\
							<input type='radio' name='applicant_smoker' id='applicant_smoker_no' class='instaquote_smoker_no' value='no' checked='checked'/><label for='applicant_smoker_no' class='returnFormApplicantInfoSmokeNo'>No</label>\
							<input type='text' name='zip' id='zip' maxlength='5' size='5' class='instantquote_zip'/>\
						</div>\
					</div>\
					<div class='returnFormApplicantInfoBottom'>\
					</div>\
					<div id='returnFormDependentButtons'>\
						<a href='javascript: void(0);'>\
							<img src='/returnVisitor/images/add-spouse.jpg' alt='Add spouse' id='returnFormDependentButtonsAddSpouse'/></a>\
						<a href='javascript: void(0);'>\
							<img src='/returnVisitor/images/add-spouse-gray.jpg' alt='You have already added your spouse' title='You have already added your spouse' id='returnFormDependentButtonsAddSpouseDisabled'/></a>\
						<a href='javascript: void(0);'>\
							<img src='/returnVisitor/images/add-child.jpg' alt='Add child' id='returnFormDependentButtonsAddChild'/></a>\
						<a href='javascript: void(0);'>\
							<img src='/returnVisitor/images/add-child-gray.jpg' alt='You cannot add another child' id='returnFormDependentButtonsAddChildDisabled'/></a>\
					</div>\
					\
					\
					\
					<div id='returnFormSpouse' class='returnFormDependent'>\
						<div class='returnFormApplicantInfoTop'>\
						</div>\
						<div class='returnFormApplicantInfo'>\
							<a href='javascript: void(0);' id='returnFormRemoveSpouse'><img alt='Remove spouse' title='Remove spouse' src='/returnVisitor/images/close.jpg'/></a>\
							<div class='returnFormApplicantInfoLabel'>\
								<span class='returnFormApplicantInfoGender'><sup>*</sup>Gender</span>\
								<label class='returnFormApplicantInfoDOB' for='spouse_dobMM'><sup>*</sup>Date of Birth</label>\
								<span class='returnFormApplicantInfoSmoker'><sup>*</sup>Smoker</span>\
							</div>\
							<div class='returnFormApplicantInfoForm'>\
								<span class='returnFormTitle returnFormTitleSpouse'>Spouse</span>\
								<input type='radio' name='spouse_gender' id='spouse_gender_male' class='instaquote_gender_male' value='Male'/><label for='spouse_gender_male' class='returnFormApplicantInfoMale'>M</label>\
								<input type='radio' name='spouse_gender' id='spouse_gender_female' class='instaquote_gender_female' value='Female'/><label for='spouse_gender_female' class='returnFormApplicantInfoFemale'>F</label>\
								<input type='text' name='spouse_dobMM' id='spouse_dobMM' maxlength='2' size='2' class='instantquote_dobMM'/><span class='dateSlash'>/</span>\
								<input type='text' name='spouse_dobDD' id='spouse_dobDD' maxlength='2' size='2' class='instantquote_dobDD'/><span class='dateSlash'>/</span>\
								<input type='text' name='spouse_dobYYYY' id='spouse_dobYYYY' maxlength='4' size='4' class='instantquote_dobYYYY'/>\
								<input type='hidden' name='spouse_dob' id='spouse_dob'/>\
								<input type='radio' name='spouse_smoker' id='spouse_smoker_yes' class='instaquote_smoker_yes' value='yes'/><label for='spouse_smoker_yes' class='returnFormApplicantInfoSmokeYes'>Yes</label>\
								<input type='radio' name='spouse_smoker' id='spouse_smoker_no' class='instaquote_smoker_no' value='no' checked='checked'/><label for='spouse_smoker_no' class='returnFormApplicantInfoSmokeNo'>No</label>\
							</div>\
						</div>\
						<div class='returnFormApplicantInfoBottom returnFormDependentInfoBottom'>\
						</div>\
					</div>\
					\
					\
					\
					\
					\
					\
					<div id='returnFormChild1' class='returnFormDependent'>\
						<div class='returnFormApplicantInfoTop'>\
						</div>\
						<div class='returnFormApplicantInfo'>\
							<a href='javascript: void(0);' id='returnFormRemoveChild1'><img alt='Remove child' title='Remove child' src='/returnVisitor/images/close.jpg'/></a>\
							<div class='returnFormApplicantInfoLabel'>\
								<span class='returnFormApplicantInfoGender'><sup>*</sup>Gender</span>\
								<label class='returnFormApplicantInfoDOB' for='dependent1_dobMM'><sup>*</sup>Date of Birth</label>\
							</div>\
							<div class='returnFormApplicantInfoForm'>\
								<span class='returnFormTitle returnFormTitleChild'>Child 1</span>\
								<input type='radio' name='dependent1_gender' id='dependent1_gender_male' class='instaquote_gender_male' value='Male'/><label for='dependent1_gender_male' class='returnFormApplicantInfoMale'>M</label>\
								<input type='radio' name='dependent1_gender' id='dependent1_gender_female' class='instaquote_gender_female' value='Female'/><label for='dependent1_gender_female' class='returnFormApplicantInfoFemale'>F</label>\
								<input type='text' name='dependent1_dobMM' id='dependent1_dobMM' maxlength='2' size='2' class='instantquote_dobMM' /><span class='dateSlash'>/</span>\
								<input type='text' name='dependent1_dobDD' id='dependent1_dobDD' maxlength='2' size='2' class='instantquote_dobDD'/><span class='dateSlash'>/</span>\
								<input type='text' name='dependent1_dobYYYY' id='dependent1_dobYYYY' maxlength='4' size='4' class='instantquote_dobYYYY'/>\
								<input type='hidden' name='dependent1_dob' id='dependent1_dob'/>\
								<input type='hidden' name='dependent1_student' id='dependent1_student' value='yes'/>\
								<input type='hidden' name='dependent1_smoker' id='dependent1_smoker' value='no'/>\
							</div>\
						</div>\
						<div class='returnFormApplicantInfoBottom returnFormDependentInfoBottom'>\
						</div>\
					</div>\
					\
					\
					\
					\
					\
					\
					<div id='returnFormChild2' class='returnFormDependent'>\
						<div class='returnFormApplicantInfoTop'>\
						</div>\
						<div class='returnFormApplicantInfo'>\
							<a href='javascript: void(0);' id='returnFormRemoveChild2'><img alt='Remove child' title='Remove child' src='/returnVisitor/images/close.jpg'/></a>\
							<div class='returnFormApplicantInfoLabel'>\
								<span class='returnFormApplicantInfoGender'><sup>*</sup>Gender</span>\
								<label class='returnFormApplicantInfoDOB' for='dependent2_dobMM'><sup>*</sup>Date of Birth</label>\
							</div>\
							<div class='returnFormApplicantInfoForm'>\
								<span class='returnFormTitle returnFormTitleChild'>Child 2</span>\
								<input type='radio' name='dependent2_gender' id='dependent2_gender_male' class='instaquote_gender_male' value='Male'/><label for='dependent2_gender_male' class='returnFormApplicantInfoMale'>M</label>\
								<input type='radio' name='dependent2_gender' id='dependent2_gender_female' class='instaquote_gender_female' value='Female'/><label for='dependent2_gender_female' class='returnFormApplicantInfoFemale'>F</label>\
								<input type='text' name='dependent2_dobMM' id='dependent2_dobMM' maxlength='2' size='2' class='instantquote_dobMM' /><span class='dateSlash'>/</span>\
								<input type='text' name='dependent2_dobDD' id='dependent2_dobDD' maxlength='2' size='2' class='instantquote_dobDD'/><span class='dateSlash'>/</span>\
								<input type='text' name='dependent2_dobYYYY' id='dependent2_dobYYYY' maxlength='4' size='4' class='instantquote_dobYYYY'/>\
								<input type='hidden' name='dependent2_dob' id='dependent2_dob'/>\
								<input type='hidden' name='dependent2_student' id='dependent2_student' value='yes'/>\
								<input type='hidden' name='dependent2_smoker' id='dependent2_smoker' value='no'/>\
							</div>\
						</div>\
						<div class='returnFormApplicantInfoBottom returnFormDependentInfoBottom'>\
						</div>\
					</div>\
					\
					\
					\
					\
					\
					\
					<div id='returnFormChild3' class='returnFormDependent'>\
						<div class='returnFormApplicantInfoTop'>\
						</div>\
						<div class='returnFormApplicantInfo'>\
							<a href='javascript: void(0);' id='returnFormRemoveChild3'><img alt='Remove child' title='Remove child' src='/returnVisitor/images/close.jpg'/></a>\
							<div class='returnFormApplicantInfoLabel'>\
								<span class='returnFormApplicantInfoGender'><sup>*</sup>Gender</span>\
								<label class='returnFormApplicantInfoDOB' for='dependent3_dobMM'><sup>*</sup>Date of Birth</label>\
							</div>\
							<div class='returnFormApplicantInfoForm'>\
								<span class='returnFormTitle returnFormTitleChild'>Child 3</span>\
								<input type='radio' name='dependent3_gender' id='dependent3_gender_male' class='instaquote_gender_male' value='Male'/><label for='dependent3_gender_male' class='returnFormApplicantInfoMale'>M</label>\
								<input type='radio' name='dependent3_gender' id='dependent3_gender_female' class='instaquote_gender_female' value='Female'/><label for='dependent3_gender_female' class='returnFormApplicantInfoFemale'>F</label>\
								<input type='text' name='dependent3_dobMM' id='dependent3_dobMM' maxlength='2' size='2' class='instantquote_dobMM' /><span class='dateSlash'>/</span>\
								<input type='text' name='dependent3_dobDD' id='dependent3_dobDD' maxlength='2' size='2' class='instantquote_dobDD'/><span class='dateSlash'>/</span>\
								<input type='text' name='dependent3_dobYYYY' id='dependent3_dobYYYY' maxlength='4' size='4' class='instantquote_dobYYYY'/>\
								<input type='hidden' name='dependent3_dob' id='dependent3_dob'/>\
								<input type='hidden' name='dependent3_student' id='dependent3_student' value='yes'/>\
								<input type='hidden' name='dependent3_smoker' id='dependent3_smoker' value='no'/>\
							</div>\
						</div>\
						<div class='returnFormApplicantInfoBottom returnFormDependentInfoBottom'>\
						</div>\
					</div>\
					\
					\
					\
					\
					\
					\
					<div id='returnFormChild4' class='returnFormDependent'>\
						<div class='returnFormApplicantInfoTop'>\
						</div>\
						<div class='returnFormApplicantInfo'>\
							<a href='javascript: void(0);' id='returnFormRemoveChild4'><img alt='Remove child' title='Remove child' src='/returnVisitor/images/close.jpg'/></a>\
							<div class='returnFormApplicantInfoLabel'>\
								<span class='returnFormApplicantInfoGender'><sup>*</sup>Gender</span>\
								<label class='returnFormApplicantInfoDOB' for='dependent4_dobMM'><sup>*</sup>Date of Birth</label>\
							</div>\
							<div class='returnFormApplicantInfoForm'>\
								<span class='returnFormTitle returnFormTitleChild'>Child 4</span>\
								<input type='radio' name='dependent4_gender' id='dependent4_gender_male' class='instaquote_gender_male' value='Male'/><label for='dependent4_gender_male' class='returnFormApplicantInfoMale'>M</label>\
								<input type='radio' name='dependent4_gender' id='dependent4_gender_female' class='instaquote_gender_female' value='Female'/><label for='dependent4_gender_female' class='returnFormApplicantInfoFemale'>F</label>\
								<input type='text' name='dependent4_dobMM' id='dependent4_dobMM' maxlength='2' size='2' class='instantquote_dobMM' /><span class='dateSlash'>/</span>\
								<input type='text' name='dependent4_dobDD' id='dependent4_dobDD' maxlength='2' size='2' class='instantquote_dobDD'/><span class='dateSlash'>/</span>\
								<input type='text' name='dependent4_dobYYYY' id='dependent4_dobYYYY' maxlength='4' size='4' class='instantquote_dobYYYY'/>\
								<input type='hidden' name='dependent4_dob' id='dependent4_dob'/>\
								<input type='hidden' name='dependent4_student' id='dependent4_student' value='yes'/>\
								<input type='hidden' name='dependent4_smoker' id='dependent4_smoker' value='no'/>\
							</div>\
						</div>\
						<div class='returnFormApplicantInfoBottom returnFormDependentInfoBottom'>\
						</div>\
					</div>\
					\
					\
					\
					\
					\
					\
					<div id='returnFormChild5' class='returnFormDependent'>\
						<div class='returnFormApplicantInfoTop'>\
						</div>\
						<div class='returnFormApplicantInfo'>\
							<a href='javascript: void(0);' id='returnFormRemoveChild5'><img alt='Remove child' title='Remove child' src='/returnVisitor/images/close.jpg'/></a>\
							<div class='returnFormApplicantInfoLabel'>\
								<span class='returnFormApplicantInfoGender'><sup>*</sup>Gender</span>\
								<label class='returnFormApplicantInfoDOB' for='dependent5_dobMM'><sup>*</sup>Date of Birth</label>\
							</div>\
							<div class='returnFormApplicantInfoForm'>\
								<span class='returnFormTitle returnFormTitleChild'>Child 5</span>\
								<input type='radio' name='dependent5_gender' id='dependent5_gender_male' class='instaquote_gender_male' value='Male'/><label for='dependent5_gender_male' class='returnFormApplicantInfoMale'>M</label>\
								<input type='radio' name='dependent5_gender' id='dependent5_gender_female' class='instaquote_gender_female' value='Female'/><label for='dependent5_gender_female' class='returnFormApplicantInfoFemale'>F</label>\
								<input type='text' name='dependent5_dobMM' id='dependent5_dobMM' maxlength='2' size='2' class='instantquote_dobMM' /><span class='dateSlash'>/</span>\
								<input type='text' name='dependent5_dobDD' id='dependent5_dobDD' maxlength='2' size='2' class='instantquote_dobDD'/><span class='dateSlash'>/</span>\
								<input type='text' name='dependent5_dobYYYY' id='dependent5_dobYYYY' maxlength='4' size='4' class='instantquote_dobYYYY'/>\
								<input type='hidden' name='dependent5_dob' id='dependent5_dob'/>\
								<input type='hidden' name='dependent5_student' id='dependent5_student' value='yes'/>\
								<input type='hidden' name='dependent5_smoker' id='dependent5_smoker' value='no'/>\
							</div>\
						</div>\
						<div class='returnFormApplicantInfoBottom returnFormDependentInfoBottom'>\
						</div>\
					</div>\
					\
					\
					\
					\
					\
					\
					<div id='returnFormChild6' class='returnFormDependent'>\
						<div class='returnFormApplicantInfoTop'>\
						</div>\
						<div class='returnFormApplicantInfo'>\
							<a href='javascript: void(0);' id='returnFormRemoveChild6'><img alt='Remove child' title='Remove child' src='/returnVisitor/images/close.jpg'/></a>\
							<div class='returnFormApplicantInfoLabel'>\
								<span class='returnFormApplicantInfoGender'><sup>*</sup>Gender</span>\
								<label class='returnFormApplicantInfoDOB' for='dependent6_dobMM'><sup>*</sup>Date of Birth</label>\
							</div>\
							<div class='returnFormApplicantInfoForm'>\
								<span class='returnFormTitle returnFormTitleChild'>Child 6</span>\
								<input type='radio' name='dependent6_gender' id='dependent6_gender_male' class='instaquote_gender_male' value='Male'/><label for='dependent6_gender_male' class='returnFormApplicantInfoMale'>M</label>\
								<input type='radio' name='dependent6_gender' id='dependent6_gender_female' class='instaquote_gender_female' value='Female'/><label for='dependent6_gender_female' class='returnFormApplicantInfoFemale'>F</label>\
								<input type='text' name='dependent6_dobMM' id='dependent6_dobMM' maxlength='2' size='2' class='instantquote_dobMM' /><span class='dateSlash'>/</span>\
								<input type='text' name='dependent6_dobDD' id='dependent6_dobDD' maxlength='2' size='2' class='instantquote_dobDD'/><span class='dateSlash'>/</span>\
								<input type='text' name='dependent6_dobYYYY' id='dependent6_dobYYYY' maxlength='4' size='4' class='instantquote_dobYYYY'/>\
								<input type='hidden' name='dependent6_dob' id='dependent6_dob'/>\
								<input type='hidden' name='dependent6_student' id='dependent6_student' value='yes'/>\
								<input type='hidden' name='dependent6_smoker' id='dependent6_smoker' value='no'/>\
							</div>\
						</div>\
						<div class='returnFormApplicantInfoBottom returnFormDependentInfoBottom'>\
						</div>\
					</div>\
					\
					\
					\
				</fieldset>\
				<div id='returnFormSubmit'>\
				<input type='image' src='/returnVisitor/images/button-view-quotes-orange.jpg' value='View Quotes' />\
				</div>\
			</form>\
			<iframe src='http://www.gohealthinsurance.com/iframeTracking.jsp?s_prop6="+s_prop_6+"&amp;s_prop24="+config_id+"&amp;s_prop25="+affiliate_id+"&amp;s_prop26="+trackStateInfo+"&amp;s_prop27="+link_id+"&amp;s_prop29=Return_Visit_Form&amp;s_events=event36' id='GHIiframeTracking'>\
			</iframe>\
			<p class='returnFormFooter'><small>To make it easier for you to view quotes instantly online, we&rsquo;ve kept your basic information secured as you may have already requested quotes from agents in our network. Your information above will not be shared or sold to any third parties, nor will you be contacted by any additional agents.</small></p>\
		</div>\
		<div id='returnFormDivContainerBottom'>\
		</div>\
	</div>\
";

// Form Validation
function returnUserValidation(frmvalidator) {
	var todayDate = new Date();
	//form name
	var form = document.forms[frmvalidator.formobj._sfm_form_name];
	
	//validate gender
	frmvalidator.addValidation("applicant_gender","selone_radio",SEL_GENDER);
	
	//validate smoker
	frmvalidator.addValidation("applicant_smoker","selone_radio",SMOKER_REQ);
	
	//Validate DOB month
	frmvalidator.addValidation("applicant_dobMM","req", DOB_MM_REQ);
	frmvalidator.addValidation("applicant_dobMM","numeric", DOB_MM_NUMERIC);
	frmvalidator.addValidation("applicant_dobMM","lt=13",DOB_MM_LESS_THAN);
	frmvalidator.addValidation("applicant_dobMM","gt=0",DOB_MM_GREATER_THAN);
		
	//Validate DOB day
	frmvalidator.addValidation("applicant_dobDD","req", DOB_DD_REQ);
	frmvalidator.addValidation("applicant_dobDD","numeric", DOB_DD_NUMERIC);
	frmvalidator.addValidation("applicant_dobDD","lt=32",DOB_DD_LESS_THAN);
	frmvalidator.addValidation("applicant_dobDD","gt=0",DOB_DD_GREATER_THAN);
		
	//Validate DOB year		
	frmvalidator.addValidation("applicant_dobYYYY","req",DOB_YYYY_REQ);
	frmvalidator.addValidation("applicant_dobYYYY","num",DOB_YYYY_NUMERIC);
	frmvalidator.addValidation("applicant_dobYYYY", "minlen=4", DOB_YYYY_MIN_LEN)
	frmvalidator.addValidation("applicant_dobYYYY","gt="+(todayDate.getFullYear()-101),DOB_YYYY_GREATER_THAN);	
	frmvalidator.addValidation("applicant_dobYYYY","lt="+(todayDate.getFullYear()+1),DOB_YYYY_LESS_THAN);	

		
	// Validate Zip Code
	frmvalidator.addValidation("zip","req",ADDRESS_ZIP_REQ);	
	frmvalidator.addValidation("zip","num",ADDRESS_ZIP_NUMERIC);		
	frmvalidator.addValidation("zip","minlen=5",ADDRESS_ZIP_MIN_LENGTH);
	
	// Validate spouse
	if(document.getElementById("returnFormSpouse").style.display=="block") {
		//validate gender
		frmvalidator.addValidation("spouse_gender","selone_radio",SPOUSE_SEL_GENDER);
		
		//validate smoker
		frmvalidator.addValidation("spouse_smoker","selone_radio",SPOUSE_SEL_SMOKING);
		
		//Validate DOB month
		frmvalidator.addValidation("spouse_dobMM","req", SPOUSE_DOB_MM_REQ);
		frmvalidator.addValidation("spouse_dobMM","numeric", SPOUSE_DOB_MM_NUMERIC);
		frmvalidator.addValidation("spouse_dobMM","lt=13", SPOUSE_DOB_MM_LESS_THAN);
		frmvalidator.addValidation("spouse_dobMM","gt=0",SPOUSE_DOB_MM_GREATER_THAN);
			
		//Validate DOB day
		frmvalidator.addValidation("spouse_dobDD","req", SPOUSE_DOB_DD_REQ);
		frmvalidator.addValidation("spouse_dobDD","numeric", SPOUSE_DOB_DD_NUMERIC);
		frmvalidator.addValidation("spouse_dobDD","lt=32", SPOUSE_DOB_DD_LESS_THAN);
		frmvalidator.addValidation("spouse_dobDD","gt=0", SPOUSE_DOB_DD_GREATER_THAN);
			
		//Validate DOB year		
		frmvalidator.addValidation("spouse_dobYYYY","req", SPOUSE_DOB_YYYY_REQ);
		frmvalidator.addValidation("spouse_dobYYYY","num", SPOUSE_DOB_YYYY_NUMERIC);
		frmvalidator.addValidation("spouse_dobYYYY", "minlen=4", SPOUSE_DOB_YYYY_MIN_LEN)
		frmvalidator.addValidation("spouse_dobYYYY","gt="+(todayDate.getFullYear()-101),SPOUSE_DOB_YYYY_GREATER_THAN);	
		frmvalidator.addValidation("spouse_dobYYYY","lt="+(todayDate.getFullYear()+1), SPOUSE_DOB_YYYY_LESS_THAN);	
	}
	// Validate children
	for(var i=1; i<7; i++) {
		if(document.getElementById("returnFormChild"+i).style.display=="block") {
			//validate gender
			frmvalidator.addValidation("dependent"+i+"_gender","selone_radio",CHILD_SEL_GENDER);
		
			//Validate DOB month
			frmvalidator.addValidation("dependent"+i+"_dobMM","req", CHILD_DOB_MM_REQ);
			frmvalidator.addValidation("dependent"+i+"_dobMM","numeric", CHILD_DOB_MM_NUMERIC);
			frmvalidator.addValidation("dependent"+i+"_dobMM","lt=13", CHILD_DOB_MM_GREATER_THAN);
			frmvalidator.addValidation("dependent"+i+"_dobMM","gt=0", CHILD_DOB_MM_LESS_THAN);
				
			//Validate DOB day
			frmvalidator.addValidation("dependent"+i+"_dobDD","req", CHILD_DOB_DD_REQ);
			frmvalidator.addValidation("dependent"+i+"_dobDD","numeric", CHILD_DOB_DD_NUMERIC);
			frmvalidator.addValidation("dependent"+i+"_dobDD","lt=32", CHILD_DOB_DD_GREATER_THAN);
			frmvalidator.addValidation("dependent"+i+"_dobDD","gt=0", CHILD_DOB_DD_LESS_THAN);
				
			//Validate DOB year		
			frmvalidator.addValidation("dependent"+i+"_dobYYYY","req", CHILD_DOB_YYYY_REQ);
			frmvalidator.addValidation("dependent"+i+"_dobYYYY","num", CHILD_DOB_YYYY_NUMERIC);
			frmvalidator.addValidation("dependent"+i+"_dobYYYY", "minlen=4", CHILD_DOB_YYYY_MIN_LEN)
			frmvalidator.addValidation("dependent"+i+"_dobYYYY","gt="+(todayDate.getFullYear()-101),CHILD_DOB_YYYY_GREATER_THAN);	
			frmvalidator.addValidation("dependent"+i+"_dobYYYY","lt="+(todayDate.getFullYear()+1), CHILD_DOB_YYYY_LESS_THAN);
		}
	}
	
	// Send to form post-processing
	frmvalidator.setAddnlValidationFunction("returnUserValidationComplete");
}

// Form Validation Post-Processing
function returnUserValidationComplete () {
	function getDOB(monthFieldID, dayFieldID, yearFieldID) {
		var monthElem = document.getElementById(monthFieldID);
		var dayElem = document.getElementById(dayFieldID);
		var yearElem = document.getElementById(yearFieldID);
		if( monthElem.value == null || monthElem.value == "" || dayElem.value == null || dayElem.value == "" || yearElem.value == null || yearElem.value == ""){
			return "";
		}else{
			return monthElem.value+"/"+ dayElem.value+"/"+yearElem.value;
		}
	};
	function getGender(fieldName) {
		return document.getElementById(fieldName).checked ? "Male" : "Female";
	};
	function getSmoker(fieldName) {
		return document.getElementById(fieldName).checked ? "on" : "off";
	};
	document.getElementById("applicant_dob").value = getDOB('applicant_dobMM','applicant_dobDD','applicant_dobYYYY');
	document.getElementById("spouse_dob").value = getDOB('spouse_dobMM','spouse_dobDD','spouse_dobYYYY');
	for(var i=1; i<7; i++) {
		document.getElementById("dependent"+i+"_dob").value = getDOB('dependent'+i+'_dobMM','dependent'+i+'_dobDD','dependent'+i+'_dobYYYY');
	}
	document.getElementById("returnFormSubmit").className = "returnProgressBar"
	document.getElementById("returnFormSubmit").innerHTML = "<img src='/returnVisitor/images/return-progress-bar.gif' alt='Retrieving your quotes' title='Retrieving your quotes' id='returnProgressBar'/>";
	setTimeout('document.getElementById("returnProgressBar").src=document.getElementById("returnProgressBar").src',50);
	window.onbeforeunload = returnUserValidationLoadImg;

	// Ehealth Check
	var applicant_gender = getGender("applicant_gender_male");
	var applicant_smoker = getSmoker("applicant_smoker_yes");
	var applicant_dob = document.getElementById("applicant_dob").value;
	var zip = document.getElementById("zip").value;
	var spouse_gender = getGender("spouse_gender_male");
	var spouse_smoker = getSmoker("spouse_smoker_yes");
	var spouse_dob = document.getElementById("spouse_dob").value;
	var children_str="";
	for(var c=1; c<7; c++) {
		var i = c+2;
		children_str+="&dependent"+c+"_gender="+getGender('dependent'+c+'_gender_male');
		children_str+="&dependent"+c+"_dob="+document.getElementById("dependent"+c+"_dob").value;
		children_str+="&dependent"+c+"_student=on";
		children_str+="&dependent"+c+"_smoker=off";
	}
	
	if(navigator.userAgent.indexOf('Chrome/') < 0) {
		var win=window.open("http://www.gohealthinsurance.com/plans/quote/thankyou8.jsp?id="+document.getElementById('how_hear').value +"&affiliate_id="+affiliate_id+"&link_id="+link_id+"&zip="+zip+"&applicant_gender="+applicant_gender+"&applicant_dob="+applicant_dob+"&applicant_smoker=\
				"+applicant_smoker+"&spouse_gender="+spouse_gender+"&spouse_smoker="+spouse_smoker+"&spouse_dob="+spouse_dob+children_str,'win','toolbar=1, location=1,directories=1,status=1,menubar=1, scrollbars=1,resizable=1');
		if (win)
			win.blur();
	}
}
function returnUserValidationLoadImg() {
	setTimeout('document.getElementById("returnProgressBar").src=document.getElementById("returnProgressBar").src',50);
}

// Form Validation Reset
function returnUserValidationReset() {
	returnFormValidator.clearAllValidations();
	returnUserValidation(returnFormValidator);
}

// Initialize the Overlay
function returnOverlay() {
	var returnOverlayInst = new returnOverlayObj(GHI_LEAD_DATA);
	returnOverlayInst.addOverlay();
	returnOverlayInst.addValuesToDefaultForm("healthform", "sprop29", "Return_Visit_Form");
}

/* returnOverlayObj Class to render the form and implement functionality */
function returnOverlayObj(leadData) {

	/* ATTRIBUTES */
	this.bodyElem = document.getElementsByTagName("body")[0];
	this.htmlElem = document.getElementsByTagName("html")[0];
	this.browser = checkForInternetExplorer();
	this.returnLeadData = leadData;
	var spouse = false;
	var children = 0;
	var returnOverlayDiv;
	var returnFormDiv;
	
	/* METHODS */
	/* Add and Remove the Overlay */
	this.addOverlay = function() {
	
		/* Create the element*/
		returnOverlayDiv = document.createElement("div");
		returnOverlayDiv.id = "returnOverlayDiv";
		returnOverlayDiv.style.height = this.adjustHeightOverlay();
		
		/* Add overlay handling to Internet Explorer */
		this.addSelectElemOverlay(true);
		
		/* Display the overlay*/
		document.body.appendChild(returnOverlayDiv);
		
		/* Add the form */
		this.addForm();
	};
	this.removeOverlay = function() {
		document.getElementById("GHIiframeTracking").src = "http://www.gohealthinsurance.com/iframeTracking.jsp?s_prop6="+s_prop_6+"&s_prop24="+config_id+"&s_prop25="+affiliate_id+"&s_prop26="+trackStateInfo+"&s_prop27="+link_id+"&s_prop29=Return_Visit_Form&s_events=event64";
		returnOverlayDiv.style.display = "none";
		returnFormDiv.style.display = "none";
		removeSelectElemOverlay();
	};
	this.addForm = function() {
		/* Create the element */
		returnFormDiv = document.createElement("div");
		returnFormDiv.id = "returnFormDiv";
		returnFormDiv.innerHTML = returnForm;
		
		/* Add event handling to the page before load*/
		this.enableCloseLinks(returnFormDiv.getElementsByTagName("a"));
		
		/* Display the form */
		document.body.appendChild(returnFormDiv);
		
		/* Add validation */
		returnFormValidator = new Validator("instant-quote");
		returnUserValidation(returnFormValidator);
		
		/* Bind some functions to the form */
		this.addDependents();
		this.removeDependents();
		
		/* Populate the form */
		this.populateForm();
	};
	
	this.populateForm = function () {
		var mappedFields = this.mapFields();
		var childIndexer = new Array(6);
		for(var fieldName in this.returnLeadData) {
			if(mappedFields[fieldName] != undefined) {
				var formElems = document.getElementsByName(mappedFields[fieldName]);
				if(formElems != null) {
					if(mappedFields[fieldName].indexOf("spouse")!=-1) {
						showSpouse();
					}
					for(var i=1; i<7; i++) {
						if(mappedFields[fieldName].indexOf("dependent"+i)!=-1 && (!childIndexer[i])) {
							childIndexer[i]=true;
							showChild();
						}
					}
					if(formElems.length==1) {
						// Check if we have a hidden field for dependent smoker
						if(formElems[0].id.slice(-6) == "smoker") {
							this.returnLeadData[fieldName] = this.returnLeadData[fieldName].toLowerCase();
						}
						formElems[0].value = this.returnLeadData[fieldName];
					}
					else if(formElems.length==2) {
						for(var i=0; i<2; i++) {
							// Check female
							if(this.returnLeadData[fieldName].toLowerCase() == formElems[i].id.slice(-6).toLowerCase()) {
								formElems[i].checked = true;
								break;
							}
							// Check male
							else if(this.returnLeadData[fieldName].toLowerCase() == formElems[i].id.slice(-4).toLowerCase()) {
								formElems[i].checked = true;
								break;
							}
							// Check smoker yes
							else if(this.returnLeadData[fieldName].toLowerCase() == formElems[i].id.slice(-3).toLowerCase()) {
								formElems[i].checked = true;
							}
							// Check smoker no
							else if(this.returnLeadData[fieldName].toLowerCase() == formElems[i].id.slice(-2).toLowerCase()) {
								formElems[i].checked = true;
							}
						}
					}
				}
			}
		}
	};
	this.addValuesToDefaultForm = function(formName, fieldName, value){
		var hiddenElem = document.createElement("input");
		hiddenElem.type = "hidden";
		hiddenElem.id = fieldName;
		hiddenElem.name = fieldName;
		hiddenElem.value = value;
		document.forms[formName].appendChild(hiddenElem);
	};
	/* HELPER FUNCTIONS */
	
	/* Bind add dependents events */
	this.addDependents = function () {
		document.getElementById("returnFormDependentButtonsAddSpouse").parentNode.onclick = showSpouse;
		document.getElementById("returnFormDependentButtonsAddChild").parentNode.onclick = showChild;
	}
	/* Bind remove dependents events */
	this.removeDependents = function() {
		document.getElementById("returnFormRemoveSpouse").onclick = deleteSpouse;
		document.getElementById("returnFormRemoveChild1").onclick = deleteChildInst01;
		document.getElementById("returnFormRemoveChild2").onclick = deleteChildInst02;
		document.getElementById("returnFormRemoveChild3").onclick = deleteChildInst03;
		document.getElementById("returnFormRemoveChild4").onclick = deleteChildInst04;
		document.getElementById("returnFormRemoveChild5").onclick = deleteChildInst05;
		document.getElementById("returnFormRemoveChild6").onclick = deleteChildInst06;
	}
	
	/* Show spouse */
	function showSpouse() {
		spouse = true;
		document.getElementById("returnFormSpouse").style.display = "block";
		document.getElementById("returnFormDependentButtonsAddSpouse").style.display = "none";
		returnUserValidationReset();
	}
	
	/* Show child */
	function showChild() {
		if(children<6) {
			children++;
			document.getElementById("returnFormChild"+children).style.display = "block";
			if(children==6) {
				document.getElementById("returnFormDependentButtonsAddChild").style.display = "none";
			}
			returnUserValidationReset();
		}
	}
	
	/* Delete spouse */
	function deleteSpouse() {
		spouse = false;
		document.getElementById("returnFormDependentButtonsAddSpouse").style.display = "";
		document.getElementById("returnFormSpouse").style.display = "none";
		document.getElementById("spouse_gender_male").checked = false;
		document.getElementById("spouse_gender_female").checked = false;
		document.getElementById("spouse_smoker_yes").checked = false;
		document.getElementById("spouse_smoker_no").checked = false;
		document.getElementById("spouse_dobMM").value = "";
		document.getElementById("spouse_dobDD").value = "";
		document.getElementById("spouse_dobYYYY").value = "";
		returnUserValidationReset();
	}
	/* Delete child helper functions */
	function deleteChildInst01() {
		deleteChildren(1);
	}
	function deleteChildInst02() {
		deleteChildren(2);
	}
	function deleteChildInst03() {
		deleteChildren(3);
	}
	function deleteChildInst04() {
		deleteChildren(4);
	}
	function deleteChildInst05() {
		deleteChildren(5);
	}
	function deleteChildInst06() {
		deleteChildren(6);
	}
	
	/* Delete child */
	function deleteChildren(childIndex) {
		document.getElementById("returnFormChild"+children).style.display = "none";
		for(var i = (childIndex); i < (children); i++) {
			document.getElementById("dependent"+(i) +"_gender_male").checked = document.getElementById("dependent"+(i*1+1) +"_gender_male").checked;
			document.getElementById("dependent"+(i) +"_gender_female").checked = document.getElementById("dependent"+(i*1+1) +"_gender_female").checked;
			document.getElementById("dependent"+(i) +"_dobMM").value = document.getElementById("dependent"+(i*1+1) +"_dobMM").value;
			document.getElementById("dependent"+(i) +"_dobDD").value = document.getElementById("dependent"+(i*1+1) +"_dobDD").value;
			document.getElementById("dependent"+(i) +"_dobYYYY").value = document.getElementById("dependent"+(i*1+1) +"_dobYYYY").value;
			document.getElementById("dependent"+(i) +"_smoker").value = document.getElementById("dependent"+(i*1+1) +"_smoker").value;
		}
		document.getElementById("dependent"+(children)+"_gender_male").checked = false;
		document.getElementById("dependent"+(children)+"_gender_female").checked = false;
		document.getElementById("dependent"+(children)+"_dobMM").value = "";
		document.getElementById("dependent"+(children)+"_dobDD").value = "";
		document.getElementById("dependent"+(children)+"_dobYYYY").value = "";
		// Set smoker to "no" if the child so validation does not fail
		document.getElementById("dependent"+(children)+"_smoker").value = "no";
		if(children==6) {
			document.getElementById("returnFormDependentButtonsAddChild").style.display = "";
		}
		children--;
		returnUserValidationReset();
	}

	
	/* Build the field mapper */
	this.mapFields = function() {
		var fieldMapper = new Array();
		fieldMapper["first_name"]="firstName";
		fieldMapper["last_name"]="lastName";
		fieldMapper["address_1_zip"]="zip";
		fieldMapper["lead_id"]="how_hear";	
		for(var i=1; i<=8; i++){
			var prefix="";
			switch (i){
				case 1:
					prefix="applicant";	
					break;
				case 2:
					prefix="spouse";
					break;
				default:
					prefix="dependent"+(i*1-2);
			}		
			fieldMapper["insured_"+i+"_gender"]= prefix+"_gender";
			fieldMapper["insured_"+i+"_dobMM"]=prefix+"_dobMM";
			fieldMapper["insured_"+i+"_dobDD"]=prefix+"_dobDD";
			fieldMapper["insured_"+i+"_dobYYYY"]=prefix+"_dobYYYY"
			fieldMapper["insured_"+i+"_smoker"]=prefix+"_smoker";
			fieldMapper["insured_"+i+"_student"]=prefix+"_student";
		}
		return fieldMapper;
	}
	/* Add iframes over the select elements in IE 6*/
	this.addSelectElemOverlay = function(toggle) {
		if(this.browser) {
			var selectElems = document.getElementsByTagName("select");
			for(var i=0; i<selectElems.length; i++) {
				var iframeElem = document.createElement("iframe");
				iframeElem.className = "selectElemOverlay";
				iframeElem.style.width = selectElems[i].offsetWidth + "px";
				iframeElem.style.height = selectElems[i].offsetHeight +  "px";
				iframeElem.style.left = this.getAbsolutePosition(selectElems[i]).x;
				iframeElem.style.top = this.getAbsolutePosition(selectElems[i]).y;
				document.body.appendChild(iframeElem);
			}
		}	
	};
	/* Enable close links on the form */
	this.enableCloseLinks = function(anchorElems) {
		for (var i=0; i<anchorElems.length; i++) {
			if(anchorElems[i].className == "overlayClose") {
				anchorElems[i].onclick = this.removeOverlay;
			}
		}
	};
	/* Remove the iframe overlays for the select elements*/
	function removeSelectElemOverlay() {
		var iframeElems = document.getElementsByTagName("iframe");
		for(var i=0; i<iframeElems.length; i++) {
			if(iframeElems[i].className == "selectElemOverlay") {
				iframeElems[i].className = "";
				iframeElems[i].style.display = "none";
			}
		}
	}
	/* Determine the absolute position for an element on the page*/
	this.getAbsolutePosition = function(element) {
		var r = { x: element.offsetLeft, y: element.offsetTop };
		if (element.offsetParent) {
			var tmp = this.getAbsolutePosition(element.offsetParent);
			r.x += tmp.x;
			r.y += tmp.y;
		}
		return r;
	};
	/* Determine the height needed for the overlay on the page */
	this.adjustHeightOverlay = function() {
		return document.body.scrollHeight > document.body.offsetHeight ? (document.body.scrollHeight +30) + "px" : (document.body.offsetHeight + 30) + "px";
	};
	/ * Check for older versions of Internet Explorer */
	function checkForInternetExplorer () {
		if(navigator.appVersion.indexOf("MSIE")!=-1) {
			return  parseFloat(navigator.appVersion.split("MSIE")[1])>=6 ? true : false;
		}
		else {
			return  false;
		}
	};
	return true;
}
if(GHI_LEAD==true) {		
	window.onload = returnOverlay;	
}
