
function checkForm()
{
	var survey = document.surveyForm;

	var user_input = "";
	errorMsg="";
	
/************************************************************************
*	QUESTION 1
*************************************************************************/	
	radioItem = survey.Q1;
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 1");
	} 
	
/************************************************************************
*	QUESTION 2
*************************************************************************/		
	user_input="";
	radioItem = survey.Q2;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 2");
	} 
	else if(user_input=="No, I did not enjoy using the program" && survey.Q2Reason.value.trim()=="")
	{
		addError("Question 2: No, I did not use the program. Please tell us why.");
	}
/************************************************************************
*	QUESTION 3
*************************************************************************/		
	user_input="";
	radioItem = survey.Q3;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 3");
	} 
	else if(user_input=="No, they did not work well together" && survey.Q3Reason.value.trim()=="")
	{
		addError("Question 3: No, they did not work well together. Please explain.");
	}
/************************************************************************
*	QUESTION 4
*************************************************************************/		
	user_input="";
	radioItem = survey.Q4;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 4");
	} 
	else if(user_input=="Yes, I have seen a change in my students' attitudes toward senior citizens" && survey.Q4Yes.value.trim()=="")
	{
		addError("Question 4: Yes, I have seen a change in my students' attitudes toward senior citizens.");
	}	
	else if(user_input=="No, I have not seen a change in my students' attitudes toward senior citizens" && survey.Q4No.value.trim()=="")
	{
		addError("Question 4: No, I have not seen a change in my students' attitudes toward senior citizens");
	}	
	
/************************************************************************
*	QUESTION 5
*************************************************************************/		
	user_input="";
	radioItem = survey.Q5;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 5");
	} 
	else if(user_input=="Not at all useful. " && survey.Q5Reason.value.trim()=="")
	{
		addError("Question 5: Not at all useful. Please explain.");
	}
	
/************************************************************************
*	QUESTION 6
*************************************************************************/		
	user_input="";
	if (survey.Q6A.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q6B.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q6C.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q6D.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q6E.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q6F.checked)
	{
		user_input = "checked";
	}

	if (user_input=="")
	{
		addError("Question 6");
	} 

/************************************************************************
*	QUESTION 7
*************************************************************************/		
	user_input="";
	if (survey.Q7A.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q7B.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q7C.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q7D.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q7E.checked)
	{
		user_input = "checked";
	}
	else if (survey.Q7F.checked)
	{
		user_input = "checked";
	}

	if (user_input=="")
	{
		addError("Question 7");
	} 
			
/************************************************************************
*	QUESTION 8
*************************************************************************/		
	user_input="";
	radioItem = survey.Q8;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 8");
	} 
	else if(user_input=="Yes" && survey.Q8Reason.value.trim()=="")
	{
		addError("Question 8: Yes. Please explain.");
	}		
	
/************************************************************************
*	QUESTION 9
*************************************************************************/		
	user_input="";
	radioItem = survey.Q9;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 9");
	} 
	else if(user_input=="No" && survey.Q9Reason.value.trim()=="")
	{
		addError("Question 9: No. How many were able to attend?");
	}
	
/************************************************************************
*	QUESTION 10
*************************************************************************/		
	user_input="";
	radioItem = survey.Q10;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 10");
	} 
	else if(user_input=="Yes, we received recognition" && survey.Q10Reason.value.trim()=="")
	{
		addError("Question 10: Yes, we received recognition. Please tell us about it.");
	}		
	
/************************************************************************
*	QUESTION 11
*************************************************************************/		
	user_input="";
	radioItem = survey.Q11;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 11");
	} 
	
/************************************************************************
*	QUESTION 12
*************************************************************************/		
	user_input="";
	radioItem = survey.Q12;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 12");
	} 
	else if(user_input=="No" && survey.Q12Reason.value.trim()=="")
	{
		addError("Question 12: No");
	}
	
/************************************************************************
*	QUESTION 13
*************************************************************************/		
	user_input="";
	radioItem = survey.Q13;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 13");
	} 
	else if(user_input=="No" && survey.Q13Reason.value.trim()=="")
	{
		addError("Question 13: No");
	}
	
/************************************************************************
*	QUESTION 14
*************************************************************************/		
	user_input="";
	radioItem = survey.Q14;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 14");
	} 
	else if(user_input=="Yes" && survey.Q14Reason.value.trim()=="")
	{
		addError("Question 14: Yes");
	}		

/************************************************************************
*	QUESTION 15
*************************************************************************/		
	user_input="";
	radioItem = survey.Q15;
	
	for (i=0;i<radioItem.length;i++)
	{
		if (radioItem[i].checked)
		{
			user_input = radioItem[i].value;
		}
	}
	if (user_input=="")
	{
		addError("Question 15");
	} 
			
/************************************************************************
*	QUESTION 16
*************************************************************************/
	user_input = survey.Q16.value.trim();
	if (user_input=="")
	{
		addError("Question 16");
	} 
		
/************************************************************************
*	QUESTION 17
*************************************************************************/
	user_input = survey.Q17Name.value.trim();
	if (user_input=="")
	{
		addError("Question 17: Please tell us your name");
	} 	
	
	user_input = survey.Q17School.value.trim();
	if (user_input=="")
	{
		addError("Question 17: Please tell us your name of the school");
	} 	
	
	user_input = survey.Q17City.value.trim();
	if (user_input=="")
	{
		addError("Question 17: City");
	} 	
	
	user_input = survey.Q17State.value.trim();
	if (user_input=="")
	{
		addError("Question 17: State");
	} 	
		
		
	if(errorMsg!="")
	{
		writeError(errorMsg,"ErrorMsg");
		document.location="#error";
	}
	else
	{
		survey.action="processTeacher.asp";
		survey.submit();
	}	
	
}


function checkRadioOther(radioBut, butValue)
{
	for (i=0;i<radioBut.length;i++)
	{
		if (radioBut[i].value==butValue)
		{
			radioBut[i].checked = true;
		}
	}
}
function checkBoxOther(checkBox,tField)
{
	if(tField.value.trim()!="")
	{
		checkBox.checked = true;
	}
}
