// RegEx Array 
// [fieldname, test_regex, error_msg]
var RegExLibArray = new Array();
RegExLibArray[0] = ["email", "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$", "Please check email field!"];
RegExLibArray[1] = ["zip", "(^\\d{5}$)|(^\\d{5}-\\d{4}$)", "Please check zip code field!"];
RegExLibArray[2] = ["sex", "\\b(M|F|m|f|male|female)", "Please check sex field, should be \"M\" or \"F\""];
RegExLibArray[3] = ["homephone", "((\\(\\d{3}\\) ?)|(\\d{3}-))?\\d{3}-\\d{4}", "Please check home phone field"];
//RegExLibArray[4] = ["workphone", "((\\(\\d{3}\\) ?)|(\\d{3}-))?\\d{3}-\\d{4}", "Please check work phone field"];
RegExLibArray[5] = ["weightlbs", "\\d{2,3}", "Please check weight field"];
RegExLibArray[6] = ["heightft", "\\d", "Please check primary height feet field"];
RegExLibArray[7] = ["heightin", "\\d", "Please check primary height inches field"];
RegExLibArray[8] = ["dobmonth", "\\d{2}", "Please check DOB Month field, should be one or two digits"];
RegExLibArray[9] = ["dobday", "\\d{2}", "Please check DOB Day field, should be one or two digits"];
RegExLibArray[10] = ["dobyear", "\\d{4}", "Please check DOB Year field, should be four digits"];
RegExLibArray[11] = ["dobyear", "\\d", "Please check DOB Year field, should be four digits"];
RegExLibArray[12] = ["firstname", "\\D", "Please check firstname field; must be full name."];
RegExLibArray[13] = ["lastname", "\\D", "Please check lastname field; must be full name."];
//RegExLibArray[15] = ["dobyear", "1990", "You are too young to apply for insurance. You must be at least 18 years old."];
//RegExLibArray[16] = ["addr1", "(\d+\s+\w+\s+)", "Please check address field; a valid address is required for a quote. For an rural route address, specify 1 RR XX, etc."];
//17
//18
//19
//20
//21
//22
//RegExLibArray[23] = ["firstname", "(\b(test|testing|tst)?)", "Please check firstname field; must be full and valid name."];
//RegExLibArray[24] = ["lastname", "(\b(test|testing|tst)?)", "Please check firstname field; must be full and valid name."];
//RegExLibArray[25] = ["email", "(\b(test|testing|tst)?)", "Please check email field; must be a valid email address not containing \'test.\'"];

function formRender() 
{
	try {
	formRenderSpouseDetails();
	formRenderChild();
	}
	catch(e) 	{
		alert(e.description);
	}
}

function formRenderSpouseDetails()
{
	try {
		if( document.forms[0].ddlMarital[0].selected ) {
				var sp = document.getElementById('spInfo');
				if (sp) sp.className = 'formhide';
				RegExLibArray[17] = ["ele63", "", ""];
				RegExLibArray[18] = ["ele61", "", ""];
				RegExLibArray[19] = ["ele62", "", ""];
				RegExLibArray[20] = ["ele67", "", ""];
				RegExLibArray[21] = ["ele68", "", ""];
				RegExLibArray[22] = ["ele69", "", ""];
		}
		else {
			var sp = document.getElementById('spInfo'); // hide
			if (sp) sp.className = 'formshow';
			RegExLibArray[17] = ["ele63", "\\d{2,3}", "Please check spouse\'s weight field"];
			RegExLibArray[18] = ["ele61", "\\d", "Please check spouse\'s height feet field"];
			RegExLibArray[19] = ["ele62", "\\d", "Please check spouse\'s height inches field"];
			RegExLibArray[20] = ["ele67", "\\d{2}", "Please check spouse\'s DOB Month field"];
			RegExLibArray[21] = ["ele68", "\\d{2}", "Please check spouse\'s DOB Day field"];
			RegExLibArray[22] = ["ele69", "\\d{4}", "Please check spouse\'s DOB Year field"];
		}
	}
	catch(e) 	{
			alert(e.description);
	}
}

function formRenderChild() //ddlChildren
{
	try {
		if( document.forms[0].ddlChildren[1].selected ) {
				var sp = document.getElementById('child1Info');
				if (sp) sp.className = 'formshow';

				var sp1 = document.getElementById('child2Info'); // hide
				if (sp1) sp1.className = 'formhide';
				
		}
		else if(document.forms[0].ddlChildren[2].selected) {
			var sp = document.getElementById('child1Info'); // hide
			if(sp) sp.className='formshow';
			
			var sp1 = document.getElementById('child2Info'); // hide
			if(sp1) sp1.className='formshow';
		}
		else if (document.forms[0].ddlChildren[0].selected ) {
			var sp = document.getElementById('child1Info'); // hide
			if(sp) sp.className='formhide';
			
			var sp1 = document.getElementById('child2Info'); // hide
			if(sp1) sp1.className='formhide';
		}
	}
	catch(e) 	{
			alert(e.description);
	}

}
var healthInsuranceCompanyList = new Array();
healthInsuranceCompanyList[0] = ["-- Select --"]
healthInsuranceCompanyList[1] = ["American National Insurance Company"]
healthInsuranceCompanyList[2] = ["Aetna"]
healthInsuranceCompanyList[3] = ["Aflac"]
healthInsuranceCompanyList[4] = ["Alliant Health Plans"]
healthInsuranceCompanyList[5] = ["American Family Insurance"]
healthInsuranceCompanyList[6] = ["American Medical Security Life Insurance Company"]
healthInsuranceCompanyList[7] = ["Anthem"]
healthInsuranceCompanyList[8] = ["Assurant"]
healthInsuranceCompanyList[9] = ["Asuris Northwest Health"]
healthInsuranceCompanyList[10] = ["Beech Street"]
healthInsuranceCompanyList[11] = ["Blue Cross and Blue Shield Association"]
healthInsuranceCompanyList[12] = ["Celtic Insurance Co."]
healthInsuranceCompanyList[13] = ["CIGNA"]
healthInsuranceCompanyList[14] = ["CLEAR CHOICE HEALTH PLANS"]
healthInsuranceCompanyList[15] = ["COMMUNITY HEALTH PLAN OF WASHINGTON"]
healthInsuranceCompanyList[16] = ["Community First"]
healthInsuranceCompanyList[17] = ["Continental General"]
healthInsuranceCompanyList[18] = ["Fortis"]
healthInsuranceCompanyList[19] = ["Golden Rule Insurance Company"]
healthInsuranceCompanyList[20] = ["Group Health Inc."]
healthInsuranceCompanyList[21] = ["Group Health Cooperative"]
healthInsuranceCompanyList[22] = ["Harvard Community Health Plan"]
healthInsuranceCompanyList[23] = ["HealthMarkets"]
healthInsuranceCompanyList[24] = ["Health Net of Arizona"]
healthInsuranceCompanyList[25] = ["Health Net of Oregon"]
healthInsuranceCompanyList[26] = ["HealthPartners"]
healthInsuranceCompanyList[27] = ["Health Plan of Nevada"]
healthInsuranceCompanyList[28] = ["Humana Inc."]
healthInsuranceCompanyList[29] = ["Insurance Services of America"]
healthInsuranceCompanyList[30] = ["Intermountain Health Care"]
healthInsuranceCompanyList[31] = ["Kaiser Permanente"]
healthInsuranceCompanyList[32] = ["LifeWise Health Plan of Arizona"]
healthInsuranceCompanyList[33] = ["LifeWise Health Plan of Oregon"]
healthInsuranceCompanyList[34] = ["LifeWise Health Plan of Washington"]
healthInsuranceCompanyList[35] = ["Medica of Minnesota"]
healthInsuranceCompanyList[36] = ["Medical Mutual"]
healthInsuranceCompanyList[37] = ["Oxford Health Plans, Inc."]
healthInsuranceCompanyList[38] = ["Principal Financial Group"]
healthInsuranceCompanyList[39] = ["Shelter Insurance Companies"]
healthInsuranceCompanyList[40] = ["UNICARE"]
healthInsuranceCompanyList[41] = ["UnitedHealthCare (Pacificare)"]
healthInsuranceCompanyList[42] = ["Vista Healthplan of South Florida"]
healthInsuranceCompanyList[43] = ["Wellpoint"]
healthInsuranceCompanyList[44] = ["World Insurance"]
healthInsuranceCompanyList[45] = ["College Health IPA"]
healthInsuranceCompanyList[46] = ["Acordia National"][1] = ["American National Insurance Company"]
healthInsuranceCompanyList[2] = ["Aetna"]
healthInsuranceCompanyList[3] = ["Aflac"]
healthInsuranceCompanyList[4] = ["Alliant Health Plans"]
healthInsuranceCompanyList[5] = ["American Family Insurance"]
healthInsuranceCompanyList[6] = ["American Medical Security Life Insurance Company"]
healthInsuranceCompanyList[7] = ["Anthem"]
healthInsuranceCompanyList[8] = ["Assurant"]
healthInsuranceCompanyList[9] = ["Asuris Northwest Health"]
healthInsuranceCompanyList[10] = ["Beech Street"]
healthInsuranceCompanyList[11] = ["Blue Cross and Blue Shield Association"]
healthInsuranceCompanyList[12] = ["Celtic Insurance Co."]
healthInsuranceCompanyList[13] = ["CIGNA"]
healthInsuranceCompanyList[14] = ["CLEAR CHOICE HEALTH PLANS"]
healthInsuranceCompanyList[15] = ["COMMUNITY HEALTH PLAN OF WASHINGTON"]
healthInsuranceCompanyList[16] = ["Community First"]
healthInsuranceCompanyList[17] = ["Continental General"]
healthInsuranceCompanyList[18] = ["Fortis"]
healthInsuranceCompanyList[19] = ["Golden Rule Insurance Company"]
healthInsuranceCompanyList[20] = ["Group Health Inc."]
healthInsuranceCompanyList[21] = ["Group Health Cooperative"]
healthInsuranceCompanyList[22] = ["Harvard Community Health Plan"]
healthInsuranceCompanyList[23] = ["HealthMarkets"]
healthInsuranceCompanyList[24] = ["Health Net of Arizona"]
healthInsuranceCompanyList[25] = ["Health Net of Oregon"]
healthInsuranceCompanyList[26] = ["HealthPartners"]
healthInsuranceCompanyList[27] = ["Health Plan of Nevada"]
healthInsuranceCompanyList[28] = ["Humana Inc."]
healthInsuranceCompanyList[29] = ["Insurance Services of America"]
healthInsuranceCompanyList[30] = ["Intermountain Health Care"]
healthInsuranceCompanyList[31] = ["Kaiser Permanente"]
healthInsuranceCompanyList[32] = ["LifeWise Health Plan of Arizona"]
healthInsuranceCompanyList[33] = ["LifeWise Health Plan of Oregon"]
healthInsuranceCompanyList[34] = ["LifeWise Health Plan of Washington"]
healthInsuranceCompanyList[35] = ["Medica of Minnesota"]
healthInsuranceCompanyList[36] = ["Medical Mutual"]
healthInsuranceCompanyList[37] = ["Oxford Health Plans, Inc."]
healthInsuranceCompanyList[38] = ["Principal Financial Group"]
healthInsuranceCompanyList[39] = ["Shelter Insurance Companies"]
healthInsuranceCompanyList[40] = ["UNICARE"]
healthInsuranceCompanyList[41] = ["UnitedHealthCare (Pacificare)"]
healthInsuranceCompanyList[42] = ["Vista Healthplan of South Florida"]
healthInsuranceCompanyList[43] = ["Wellpoint"]
healthInsuranceCompanyList[44] = ["World Insurance"]
healthInsuranceCompanyList[45] = ["College Health IPA"]
healthInsuranceCompanyList[46] = ["Acordia National"]

function LoadHealthInsuranceCompanyList() {
    var healthListOption = document.getElementById("HealthCompanyList");
    var count = 0;
    for (idx in healthInsuranceCompanyList) {
        var newOpt = document.createElement("option");
        healthListOption.options.add(newOpt);
        newOpt.text = healthInsuranceCompanyList[idx];
        if (healthInsuranceCompanyList[idx] != "-- Select --")
            newOpt.value = count++;
        else newOpt.value = -1;
    }
}