// JavaScript Document to validate CFF Application for Financial Request

   //function-set field checker for submit button
   //checks to make sure certain fields are completed
   function CheckBox(){
   var addForm = document.cff_program;
   

      <!--Section One Financial Request / COMPLETE-->
   if (addForm.ProgramName.value != "" || addForm.FundingRequest.value != "" || addForm.IndividualsProgramImpacts.value != "" || addForm.ProjectCost.value != "" || addForm.RequestFromUtilities.value != "" || addForm.FundingDescription.value != "" || addForm.OtherFunders.value !="" ){
 addForm.FinancialAssistance.checked=true;
      }

      <!--Section Two Volunteer Request / COMPLETE-->
   if (addForm.StartMonth.value != "" || addForm.StartDay.value != "" || addForm.StartYear.value != "" || addForm.EndMonth.value != "" || addForm.EndDay.value != "" || addForm.EndYear.value != "" || addForm.EventStartTime.value !="" || addForm.EventEndTime.value !="" || addForm.NumberOfVolunteers.value !="" || addForm.ProjectLocation.value !="" || addForm.IndividualsImpacted.value !="" || addForm.ActivityDescription.value !="" || addForm.EnvironmentAndSafetyConcerns.value !="" || addForm.Insurance[0].checked || addForm.Insurance[1].checked || addForm.VolunteerAge[0].checked || addForm.InsuranceComment.value !="" || addForm.EquipmentRequest.value !=""){
 addForm.VolunteerAssistance.checked=true;
      }
  }

   function Checker(){
	CheckBox();
   	var addForm = document.cff_program;
	var sErrorMsg = "";

   	if (addForm.FinancialAssistance.checked ){

			if (addForm.ProgramName.value == ""){
				sErrorMsg += "o Section 2 Program Name\n";
      		}
      		if (addForm.FundingRequest.value == ""){
				sErrorMsg += "o Section 2 Funding Request\n";
      		}
      		if (addForm.IndividualsProgramImpacts.value == ""){
				sErrorMsg += "o Section 2 Individuals Impacted\n";
      		}
      		if (addForm.ProjectCost.value == ""){
				sErrorMsg += "o Section 2 Project Cost\n";
      		}
      		if (addForm.RequestFromUtilities.value == ""){
				sErrorMsg += "o Section 2 Request From Utilities\n";
      		}
			if (addForm.FundingDescription.value == ""){
				sErrorMsg += "o Section 2 Funding description in detail\n";
      		}
      		if (addForm.OtherFunders.value == ""){
				sErrorMsg += "o Section 2 Other Funders\n";
      		}
	}
	
   	if (addForm.VolunteerAssistance.checked ){

			if (addForm.StartMonth.value == ""){
				sErrorMsg += "o Section 3 Start month\n";
      		}
      		if (addForm.StartDay.value == ""){
				sErrorMsg += "o Section 3 Start day\n";
      		}
      		if (addForm.StartYear.value == ""){
				sErrorMsg += "o Section 3 Start year\n";
      		}
      		if (addForm.EndMonth.value == ""){
				sErrorMsg += "o Section 3 End month\n";
      		}
      		if (addForm.EndDay.value == ""){
				sErrorMsg += "o Section 3 End day\n";
      		}
      		if (addForm.EndYear.value == ""){
				sErrorMsg += "o Section 3 End year\n";
      		}
      		if (addForm.EventStartTime.value == ""){
				sErrorMsg += "o Section 3 Start time\n";
      		}
      		if (addForm.EventEndTime.value == ""){
				sErrorMsg += "o Section 3 End time\n";
      		}
      		if (addForm.NumberOfVolunteers.value == ""){
				sErrorMsg += "o Section 3 Number of volunteers needed\n";
      		}
      		if (addForm.ProjectLocation.value == ""){
				sErrorMsg += "o Section 3 Project location\n";
      		}
      		if (addForm.ActivityDescription.value == ""){
				sErrorMsg += "o Section 3 Activity description\n";
      		}
      		if (addForm.EnvironmentAndSafetyConcerns.value == ""){
				sErrorMsg += "o Section 3 Environment and safety concerns\n";
      		}
			if (addForm.IndividualsImpacted.value == ""){
				sErrorMsg += "o Section 3 Number of individuals impacted\n";
      		}
      		if (addForm.EquipmentRequest.value == ""){
				sErrorMsg += "o Section 3 Equipment request\n";
      		}
    		if (!addForm.Insurance[0].checked && !addForm.Insurance[1].checked){
				sErrorMsg += "o Section 3 Insurance Check\n";
			}
			if (!addForm.VolunteerAge[0].checked && !addForm.VolunteerAge[1].checked && !addForm.VolunteerAge[2].checked && !addForm.VolunteerAge[3].checked && !addForm.VolunteerAge[4].checked){
				sErrorMsg += "o Section 3 Volunteer Age Check\n";
			}
			if (addForm.Insurance[0].checked){
      			if (addForm.InsuranceComment.value == ""){
					sErrorMsg += "o Section 3 Insurance Comment\n";
				}
			}

    	}
	if (!sErrorMsg == "") {
		alert ("Please fill in all missing fields for the items you requested:\n\n" + sErrorMsg);
		return false;
	}
	else {
		return true;
	}

   }


