// JavaScript Document
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

function cancelEvalSubmit(){
if(document.theRegForm.Cancel.value == "Cancel")
	{
	location.href="index.htm";
	}
}

//question 7: grab the chosen section from the state drop-down
function checkApproval(State){
if(State == "North Carolina"){
//alert("nc chosen");
document.getElementById("countyDiv").style.display = "block";

}
else{
	//alert("not NC, so no show the county below")
    document.getElementById("countyDiv").style.display = "none";
	}
}


function checkUpdateForm()
{	
	var type_info = "";
	var fFld = document.theRegForm;
	var orgTest=/[^A-Z\-\/\'\s]/i; //allowed A-Z, dash, quotation, whitespace
	var flexibleTextTest=/[^A-Z\-\/\'\s\,\;\:\(\)]/i; //use for text boxes listing items and free form boxes
	var textNumberTest=/[^a-zA-Z0-9\.\-\/\'\s\,\;\:\(\)]/i; //use for text boxes listing items and free form boxes
	var freeFormText=/[^a-zA-Z0-9\s\.\-\/&'",;:\(\)\?!%\$]/i;
	var impactCountTest=/[^\b\d+\b]/; 
	var dateTest=/(^\b\d{2}\/\d{2}\/\d{4}\b$)|(^\b\d{2}\/\d{4}\b$)/;
	var endDateTest=/[^a-zA-Z0-9\/]/;
	var webaddyTest=/^(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,4}(\/\S*)?$/;
	//^(http|https|ftp)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\'\/\\\+&amp;%\$#\=~])*$/;
	//^https?:\/\/([a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+)+(\/*[A-Za-z0-9\/\-_&:?\+=\/\/.%]*)*/;
	//var webaddyTest=/(^http(s?)\:\/\/w{0,3}(\d?)(\w+?)(\.?)(\w{2,40}\d(\-{0,1}))(\.(\b\w{2,3}\b)$)/; //how to allow any character except a 4th consecutive 'w'
	var phoneTest=/\d{3}-\d{3}-\d{4}/;
	var emailTest=/[a-zA-Z0-9\._-]+@[a-zA-Z0-9-]+\.[a-zA-Z]+/;

	var orgCheck = "no";
	var otherFld = document.theRegForm.orgOther
	
	for(var loop = 0; loop < fFld.Event_Type.length; loop++)
	{
		if(fFld.Event_Type[loop].checked == true)
		{
		orgCheck = "yes";
		//alert(fFld.Organization_Type[9].checked);

			if(fFld.Event_Type[9].checked == true && fFld.Event_Other.value.length < 2)
				{
				alert("For question 1 re: the type of event, you checked \"OTHER\";\nplease enter your event type in the text box to the right of the checkbox.");
				fFld.Event_Other.style.backgroundColor="#ffcc99";
				fFld.Event_Other.focus();
				return false;
				}
				else
				{
				fFld.Event_Other.style.backgroundColor="ffffff";
				}

		}
	}

	if (orgCheck == "no")
	{
	fFld.flagEventError.style.backgroundColor="#ffcc99"; //flag the question prompt if there is no response, no checkbox selected
	fFld.flagEventError.value = "CHECK AT LEAST ONE!"
	//fFld.flagTargetError.fontcolor("navy");
	fFld.flagEventError.focus();
	type_info += "Question 1: Check at least one \"Event Type\" checkbox.\n";
	}
	if (orgCheck == "yes")
	{
	fFld.flagEventError.style.backgroundColor="#e9f9f4";
	fFld.flagEventError.value = "";
	}


//Question 1: second part/section

//basic validation on number fields
if(fFld.Home_Assessments_Count.value.length > 0)
	{
	if(impactCountTest.test(fFld.Home_Assessments_Count.value)) 
	{
	alert("Question 1: Please enter the number of Home Assessments conducted.");
	fFld.Home_Assessments_Count.style.backgroundColor="ffcc99";
	fFld.Home_Assessments_Count.focus();
	return false;
	}
		else
		{
		fFld.Home_Assessments_Count.style.backgroundColor="ffffff";
		}
	}
if(fFld.Health_Fair_Count.value.length > 0)
	{
	if(impactCountTest.test(fFld.Health_Fair_Count.value)) 
	{
	alert("Question 1: Please enter the number of Health Fair Displays done.");
	fFld.Health_Fair_Count.style.backgroundColor="ffcc99";
	fFld.Health_Fair_Count.focus();
	return false;
	}
		else
		{
		fFld.Health_Fair_Count.style.backgroundColor="ffffff";
		}
	}
if(fFld.School_Assessments_Count.value.length > 0)
	{
	if(impactCountTest.test(fFld.School_Assessments_Count.value)) 
	{
	alert("Question 1: Please enter the number of School Assessments conducted.");
	fFld.School_Assessments_Count.style.backgroundColor="ffcc99";
	fFld.School_Assessments_Count.focus();
	return false;
	}
		else
		{
		fFld.School_Assessments_Count.style.backgroundColor="ffffff";
		}
	}

//loop through the checkboxes and
	//var activityCheck = "no";
	//for(var activeLoop = 0; activeLoop < fFld.Established_Activity.length; activeLoop++)
		//{
		if(fFld.Established_Activity[2].checked == true && fFld.Home_Assessments_Count.value.length < 1)
			{
				alert("For question 1 re: the type of established activity, you checked \"Home Assessments\";\nplease enter the number of Home Assessments you conducted in the input box to the far right.");
				fFld.Home_Assessments_Count.style.backgroundColor="#ffcc99";
				fFld.Home_Assessments_Count.focus();
				return false;
			}
				else
				{
				fFld.Home_Assessments_Count.style.backgroundColor="ffffff";
				}
		
		if(fFld.Established_Activity[2].checked == false && fFld.Home_Assessments_Count.value.length > 0)
			{
				alert("For question 1 re: the type of established activity, you entered a number of Home Assessments but did not select the checkbox; please select the checkbox or delete the number.");
				fFld.Home_Assessments_Count.style.backgroundColor="#ffcc99";
				fFld.Home_Assessments_Count.focus();
				return false;
			}
				else
				{
				fFld.Home_Assessments_Count.style.backgroundColor="ffffff";
				}
				
		if(fFld.Established_Activity[3].checked == true && fFld.Health_Fair_Count.value.length < 1)
			{
				alert("For question 1 re: the type of established activity, you checked \"Health Fair Display\";\nplease enter the number of Health Fair Displays you conducted in the input box to the far right.");
				fFld.Health_Fair_Count.style.backgroundColor="#ffcc99";
				fFld.Health_Fair_Count.focus();
				return false;
			}
				else
				{
				fFld.Health_Fair_Count.style.backgroundColor="ffffff";
				}
				
		if(fFld.Established_Activity[3].checked == false && fFld.Health_Fair_Count.value.length > 0)
			{
				alert("For question 1 re: the type of established activity, you entered a number of Health Fairs but did not select the checkbox; please select the checkbox or delete the number.");
				fFld.Health_Fair_Count.style.backgroundColor="#ffcc99";
				fFld.Health_Fair_Count.focus();
				
				return false;
			}
				else
				{
				fFld.Health_Fair_Count.style.backgroundColor="ffffff";
				}

		if(fFld.Established_Activity[4].checked == true && fFld.School_Assessments_Count.value.length < 1)
			{
				alert("For question 1 re: the type of established activity, you checked \"School Assessments\";\nplease enter the number of School Assessments you conducted in the input box to the far right.");
				fFld.School_Assessments_Count.style.backgroundColor="#ffcc99";
				fFld.School_Assessments_Count.focus();
				return false;
			}
				else
				{
				fFld.School_Assessments_Count.style.backgroundColor="ffffff";
				}
				
				if(fFld.Established_Activity[4].checked == false && fFld.School_Assessments_Count.value.length > 0)
			{
				alert("For question 1 re: the type of established activity, you entered a number of School Assessments but did not select the checkbox; please select the checkbox or delete the number.");
				fFld.School_Assessments_Count.style.backgroundColor="#ffcc99";
				fFld.School_Assessments_Count.focus();
				return false;
			}
				else
				{
				fFld.School_Assessments_Count.style.backgroundColor="ffffff";
				}

	//}

//Question 2: Description of Project
	if(fFld.Project_Description.value == "" || fFld.Project_Description.value.length < 0)
	{
	type_info += "Question 2: Please enter a brief project description of less than 250 characters.\n";
	fFld.Project_Description.style.backgroundColor="ffcc99";
	fFld.Project_Description.focus();
	}
	else
	{
	fFld.Project_Description.style.backgroundColor="ffffff";
	}

	if(fFld.Project_Description.value.length > 0)
	{
		if(freeFormText.test(fFld.Project_Description.value))
		{
				type_info += "Question 2: Please provide a brief description of the activity. Basic punctuation is allowed but some characters, such as ^ or *, are not accepted in this field.\n";
				fFld.Project_Description.style.backgroundColor="ffcc99";
				fFld.Project_Description.focus();
		}
		else
		{
		fFld.Project_Description.style.backgroundColor="ffffff";
		}
	}


//Question 3
	var targetAudiencesCheck = "no";
	for(var loop = 0; loop < fFld.Target_Audiences.length; loop++)
	{
	if(fFld.Target_Audiences[loop].checked == true) //are any checkboxes selected?
		{
		targetAudiencesCheck = "yes";

		//alert(fFld.Organization_Type[9].checked);

				if(fFld.Target_Audiences[7].checked == true) //if target audience is by race then which race?
				{
				//alert("nombre sept est prend");
				var subLoopCheck = "no"
				for(var subloop = 0; subloop < fFld.Target_Audiences_Race.length; subloop++) //has a race been selected from the subgroup?
					{
					if(fFld.Target_Audiences_Race[subloop].checked == true)
						{
						//alert("sub number selected");
						subLoopCheck = "yes";
						}
					}
				if(subLoopCheck == "yes") //if racial subgroup item selected then if other checkbox selected is text description also provided?
					{
						if(fFld.Target_Audiences_Race[4].checked == true && fFld.Target_Audiences_Race_Desc.value.length < 1)
						{
						alert("Question 3: You selected \"Racial / Ethnic Groups\" subgroup \"Other\"; please enter text in the box at right.");
						fFld.Target_Audiences_Race_Desc.style.backgroundColor="#ffcc99";
						fFld.Target_Audiences_Race_Desc.focus();
						return false;
						}
						else
						{
						fFld.Target_Audiences_Race_Desc.style.backgroundColor="ffffff";
						}
					}
				if(subLoopCheck == "no") //if subgroup not selected then alert and stop processing
					{
				alert("Question 3: You selected \"Racial / Ethnic Groups\", so please select one of the racial / ethnic groups from the sublist.\n");
				fFld.flagRacialEthnic.style.backgroundColor="#ffcc99";
				fFld.flagRacialEthnic.value="Check at least one in the sublist.";
				fFld.flagRacialEthnic.focus();
				return false;
					}
				else
				{
				fFld.flagRacialEthnic.style.backgroundColor="#e9f9f4";
				fFld.flagRacialEthnic.value="";
				}
				
				if(fFld.Target_Audiences_Race[4].checked == false && fFld.Target_Audiences_Race_Desc.value.length > 0)
					{
				alert("Question 3: You entered text in the text box for checkboxes \"Racial / Ethnic Groups\" and subitem \"Other\" but the \"Other\" checkbox is not selected; please select the checkbox or delete the entry in the text box.");
				fFld.Target_Audiences_Race_Desc.style.backgroundColor="#ffcc99";
				fFld.Target_Audiences_Race_Desc.focus();
				return false;
					}
				}

			if(fFld.Target_Audiences[8].checked == true && fFld.Target_Audiences_Desc.value.length < 1) //If Other is checked and text is not entered then alert
				{
				alert("Question 3: You selected \"Other Target Audiences\", so please enter the audience in the text box at right.");
				fFld.Target_Audiences_Desc.style.backgroundColor="#ffcc99";
				fFld.Target_Audiences_Desc.focus();
				return false;
				}
				else
				{
				fFld.Target_Audiences_Desc.style.backgroundColor="ffffff";
				}
		}

	}
	
		if(fFld.Target_Audiences[8].checked == false && fFld.Target_Audiences_Desc.value.length > 0) //If other is not checked and text is entered then alert and stop processing
		{
		//for(var subloop = 8; subloop < fFld.Target_Audiences[14]; loop++)

		alert("Question 3: You entered text in the text box for \"Other Target Audiences\" but the checkbox is not selected; please select the checkbox or delete the entry in the text box.");
		document.theRegForm.Target_Audiences_Desc.style.backgroundColor="#ffcc99";
		document.theRegForm.Target_Audiences_Desc.focus();
		return false;
		}

	if (targetAudiencesCheck == "no")
	{
	fFld.flagTargetError.style.backgroundColor="#ffcc99"; //flag the question prompt if there is no response, no checkbox selected
	fFld.flagTargetError.value = "CHECK AT LEAST ONE!"
	//fFld.flagTargetError.fontcolor("navy");
	fFld.flagTargetError.focus();
	type_info += "Question 3: Check at least one \"Target Audience\" checkbox. If the checkbox is the parent item in a list/sublist, select both the parent and all applicable child items.\n";
	}
	if (targetAudiencesCheck == "yes")
	{
	fFld.flagTargetError.style.backgroundColor="#e9f9f4";
	fFld.flagTargetError.value = "";
	}


//Question 4: is a radio button selected?
	var contEdRadio = "no";
	for(var loop = 0; loop < fFld.Cont_Ed.length; loop++)
	{
		if(fFld.Cont_Ed[loop].checked == true)
		{
		contEdRadio = "yes";
		fFld.radioError.style.backgroundColor="#e9f9f4"; //make sure flag field style is set to default if a radio button selected
		fFld.radioError.value = "";
		}
	}
	if (contEdRadio == "no")
	{
	type_info += "Question 4: Select a radio button indicating whether or not professionals received continuing education credits.\n";
	fFld.radioError.style.backgroundColor="#ffcc99"; //flag the question prompt for user attention if no radio button selected
	fFld.radioError.value = "SELECT \"Yes\" or \"No\"!"
	}
	
	
 //if a radio button is selected, either yes or no, then determine which one and if checkboxes are selected
	if(contEdRadio == "yes")
		{
			if(fFld.Cont_Ed[0].checked == true) // is the yes radio button selected? 
			{
			//contEdRadio = "yes";
			//alert("the Yes radio button was selected");
					var ceCredits = "no";
					for(var loopCred = 0; loopCred < fFld.CE_Credits.length; loopCred++) //if yes radio button selected, is at least one checkbox also selected?
					{
						if(fFld.CE_Credits[loopCred].checked == true)
						{
						ceCredits = "yes";
						fFld.flagCreditError.style.backgroundColor="#e9f9f4"; //reset the attention flag field if a checkbox is selected
						fFld.flagCreditError.value = ""; 
						}
					}
					//alert(ceCredits);
					if(ceCredits == "no") //if yes radio button selected but no checkboxes selected then var still no so alert user to select applicable checkbox 
					{
					fFld.flagCreditError.style.backgroundColor="#ffcc99"; //flag the question prompt if there is no response, no checkbox selected
					fFld.flagCreditError.value = "CHECK AT LEAST ONE!"
					//fFld.flagTargetError.fontcolor("navy");
					fFld.flagCreditError.focus();
					type_info += "Question 4: You checked the \"Yes\" radio button; please select applicable checkbox\(es\) in the list below the button to indicate the type of professionals that received credits.\n";
					}

			//if the other checkbox is selected and no text is entered then alert and stop processing
			if(fFld.CE_Credits[6].checked == true && fFld.CE_Credits_Desc.value.length < 1)
				{
				alert("For question 4 you checked \"OTHER\";\nplease enter the type\(s\) of professionals that received credits.");
				fFld.CE_Credits_Desc.style.backgroundColor="#ffcc99";
				fFld.CE_Credits_Desc.focus();
				return false;
				}
				else
				{
				fFld.CE_Credits_Desc.style.backgroundColor="ffffff";
				}
			//if the other checkbox is not selected and text is entered then alert and stop processing
			if(fFld.CE_Credits[6].checked == false && fFld.CE_Credits_Desc.value.length > 0)
				{
				alert("For question 4 you entered text in the box next to the \"OTHER\" checkbox;\nplease select the checkbox or delete the entry in the text box.");
				fFld.CE_Credits_Desc.style.backgroundColor="#ffcc99";
				fFld.CE_Credits_Desc.focus();
				return false;
				}
				else
				{
				fFld.CE_Credits_Desc.style.backgroundColor="ffffff";
				}			
			}

//if the no radio button is checked then there shouldn't be any checkboxes selected or text entered below
			if(fFld.Cont_Ed[1].checked == true) //is the no radio button selected? if so, no checkboxes should be selected; if checkboxes are selected then stop processing and alert
			{
			//contEdRadio = "yes";
			//alert("The no radio button was selected");
			//if no radio button is selected the text box used to flag the question for user attention should be invisible and blank
			fFld.flagCreditError.style.backgroundColor="#e9f9f4"; 
			fFld.flagCreditError.value = "";

					for(var loopCred = 0; loopCred < fFld.CE_Credits.length; loopCred++) //if so, are checkboxes also selected?
					{
						if(fFld.CE_Credits[loopCred].checked == true)
							{
							alert("Question 4: The \"No\" radio button was selected so you do not need to select any checkbox\(es\); deselect the checkbox\(es\) or select the \"Yes\" radio button.");
			fFld.flagCreditError.style.backgroundColor="#ffcc99";
			fFld.flagCreditError.value = "Deselect";
			fFld.flagCreditError.focus();
							return false;
							}
					}
			if(fFld.CE_Credits_Desc.value.length > 0) //is the no radio button selected? then there shouldn't be any text in the other box; if so, then stop processing and alert
				{
				alert("Question 4: You selected the \"No\" radio button; you should not enter any text in the \"Other\" text box; delete the text.")
				document.theRegForm.CE_Credits_Desc.style.backgroundColor="#ffcc99";
				document.theRegForm.CE_Credits_Desc.focus();
				return false;
				}
				else
				{
				fFld.CE_Credits_Desc.style.backgroundColor="ffffff";
				}
			}		
		}
		

//Question 5
	if(impactCountTest.test(fFld.Impact_Count.value) || fFld.Impact_Count.value.length < 1)
	{
	type_info += "Question 5: Enter a number up to 4 digits, without a comma or spaces, indicating the number of people impacted or estimated attendance.\n";
	fFld.Impact_Count.style.backgroundColor="ffcc99";
	fFld.Impact_Count.focus();
	}
		else
		{
		fFld.Impact_Count.style.backgroundColor="ffffff";
		}

//Question 6
	if(fFld.Sponsoring_Org.value.length > 100 || textNumberTest.test(fFld.Sponsoring_Org.value) || fFld.Sponsoring_Org.value == "")
	{
	type_info += "Question 6: The sponsoring organization name should be 100 characters or less and contain only text, numbers, and basic punctuation, such as a comma, colon, semi-colon, or parentheses.\n";
    fFld.Sponsoring_Org.style.backgroundColor="ffcc99";
	fFld.Sponsoring_Org.focus();
	}
		else
		{
		fFld.Sponsoring_Org.style.backgroundColor="ffffff";
		}
	
		if(fFld.Partnering_Org.value.length > 100 || textNumberTest.test(fFld.Partnering_Org.value) || fFld.Partnering_Org.value == "")
	{
	type_info += "Question 6: The partnering organization name should be 100 characters or less and contain only text, numbers, and basic punctuation, such as a comma, colon, semi-colon, or parentheses.\n";
    document.theRegForm.Partnering_Org.style.backgroundColor="ffcc99";
	document.theRegForm.Partnering_Org.focus();
	}
		else
		{
		fFld.Partnering_Org.style.backgroundColor="ffffff";
		}

	
	if(!(dateTest.test(fFld.Event_Date.value)) || fFld.Event_Date.value == "")
	{
	type_info += "Question 6: Enter the event date in mm\/dd\/yyyy or mm\/yyyy format.\n";
	fFld.Event_Date.style.backgroundColor="ffcc99";
	fFld.Event_Date.focus();
	}
		else
		{
		fFld.Event_Date.style.backgroundColor="ffffff";
		}

	if(fFld.Event_Date.value != "" && fFld.Event_Date_End.value != "")
	{
	if(endDateTest.test(fFld.Event_Date_End.value) || fFld.Event_Date_End.value.length > 10)
	{
	type_info += "Question 6: Enter the event end date in mm\/dd\/yyyy or mm\/yyyy format, or a short text description, such as \"present\".\n";
	fFld.Event_Date_End.style.backgroundColor="ffcc99";
	fFld.Event_Date_End.focus();
	}
		else
		{
		fFld.Event_Date_End.style.backgroundColor="ffffff";
		}
	}

//Question 7
	if(fFld.Location_City.value.length > 50 || orgTest.test(fFld.Location_City.value) || fFld.Location_City.value == "")
	{
	type_info += "Question 7: Please enter a town / city name of the event less than 50 characters with no numbers or special characters.\n";
    fFld.Location_City.style.backgroundColor="ffcc99";
	fFld.Location_City.focus();
	}
		else
		{
		fFld.Location_City.style.backgroundColor="ffffff";
		}
	
	if(fFld.State.value == "")
	{
	type_info += "Question 7: Please select a state from the drop-down menu.\n";
    fFld.State.style.backgroundColor="ffcc99";
	fFld.State.focus();
	}
		else
		{
		fFld.State.style.backgroundColor="ffffff";
		}
	
	if(fFld.State.value == "North Carolina" && fFld.County.value == ""){
		type_info += "Question 7: You selected North Carolina; please select a county.\n";
		fFld.County.style.backgroundColor="ffcc99";
		fFld.County.focus();
		}
		else
		{
		fFld.County.style.backgroundColor="ffffff";
		}

//Question 8:
	if(fFld.Contacts.value.length > 100 || flexibleTextTest.test(fFld.Contacts.value) || fFld.Contacts.value == "")
	{
	type_info += "Question 8: Enter a contact name. The contact name should be 100 characters or less and should contain only letters, a dash, or apostrophe.\n";
    fFld.Contacts.style.backgroundColor="ffcc99";
	fFld.Contacts.focus();
	}
		else
		{
		fFld.Contacts.style.backgroundColor="ffffff";
		}

	if(!(webaddyTest.test(fFld.Web_Site.value)) || fFld.Web_Site.value == "" || fFld.Web_Site.value.length > 100)
	{
	type_info += "Question 8: The organization's web site address, such as http://www.google.com.\n";
	fFld.Web_Site.style.backgroundColor="ffcc99";
	fFld.Web_Site.focus();
	}
		else
		{
		fFld.Web_Site.style.backgroundColor="ffffff";
		}

//Question 9
if(fFld.Funding_Source_Description.value.length > 0){
	if(freeFormText.test(fFld.Funding_Source_Description.value)){

	type_info += "Question 9: Please provide a brief description of the activity. Basic punctuation is allowed but some special characters, such as ^ or *, are not accepted in this field.\n";
	fFld.Funding_Source_Description.style.backgroundColor="ffcc99";
	fFld.Funding_Source_Description.focus();
	}
	else
	{
	fFld.Funding_Source_Description.style.backgroundColor="ffffff";
}
}

//Question 10
if(fFld.Phone.value.length > 0){
	if(!(phoneTest.test(fFld.Phone.value))){
	type_info += "Question 10: Please enter your 10-digit phone number in ###-###-#### format.\n";
	fFld.Phone.style.backgroundColor="ffcc99";
	fFld.Phone.focus();
		}
		else
		{
		fFld.Phone.style.backgroundColor="ffffff";
		}
}

if(fFld.Mailing_Address.value.length > 0){
	if(freeFormText.test(fFld.Mailing_Address.value)){
	type_info += "Question 10: Please enter your mailing address. Some characters, such as ^ and *, are not accepted in this field.\n";
	fFld.Mailing_Address.style.backgroundColor="ffcc99";
	fFld.Mailing_Address.focus();
		}
		else
		{
		fFld.Mailing_Address.style.backgroundColor="ffffff";
		}
}

if(fFld.Email.value.length > 0)
{
var MailAddress=document.theRegForm.Email.value;
var empStringArray=MailAddress.split("@"); // one email address
	//alert(empStringArray.length);
	if(!(emailTest.test(fFld.Email.value)) || empStringArray.length > 2)
	{
	type_info += "Question 10: Please enter a valid email address.\n";
	fFld.Email.style.backgroundColor="ffcc99";
	fFld.Email.focus();
	}
	else
	{
	fFld.Email.style.backgroundColor="ffffff";
	}
}

//Question 11
if(fFld.AANC_Email_List.value.length > 0)
{
var AANCMailAddress=document.theRegForm.AANC_Email_List.value;
var empStringArrayAANC=AANCMailAddress.split("@"); //one email address
	//alert(empStringArrayAANC.length);
	if(!(emailTest.test(fFld.AANC_Email_List.value)) || empStringArrayAANC.length > 2)
	{
	type_info += "Question 11: Please enter a valid email address.\n";
	fFld.AANC_Email_List.style.backgroundColor="ffcc99";
	fFld.AANC_Email_List.focus();
	}
	else
	{
	fFld.AANC_Email_List.style.backgroundColor="ffffff";
	}
}

//10, 11 - compare email addresses if both provided
if(fFld.Email.value.length > 0 && fFld.AANC_Email_List.value.length > 0)
	{
		if(fFld.Email.value != fFld.AANC_Email_List.value)
			{
			type_info += "Questions 10 & 11: You entered email addresses in response to questions 10 and 11 which do not match. Please use the same valid email address.\n";
			fFld.AANC_Email_List.style.backgroundColor="ffcc99";
			fFld.Email.style.backgroundColor="ffcc99";
			fFld.AANC_Email_List.focus();
			}
		else
			{
			fFld.AANC_Email_List.style.backgroundColor="fff";
			fFld.Email.style.backgroundColor="fff";
			}
	}


//reCAPTCHA

	if(fFld.recaptcha_response_field.value == "")
	{
	type_info += "To submit, please enter a response to the reCAPTCHA challenge question.\n";
	fFld.recaptcha_response_field.style.backgroundColor="ffcc99";
	}
	else
	{
	fFld.recaptcha_response_field.style.backgroundColor="ffffff";
	}
	if (type_info == "")
	{
	return true;
	}
	else
	{		
		type_info = "Please answer the following questions and resubmit:\n" + type_info;
		alert (type_info);	
		return false;
	}
}
