// JavaScript Document
/*****************************************************************
This file perform the following task:
1. check all required field are filled - first check
2. check value submitted are in the correct format - second check
******************************************************************/
function validate(form)
{
	var myfields = new Array(form.f_SitCabinNumber, form.f_MonthOfStay, form.f_StayIn, form.f_Camping_01, form.f_Camping_02, form.f_Camping_03, form.f_Camping_04, form.f_Cabins_01, form.f_Cabins_02, form.f_Cabins_03, form.f_Cabins_04, form.f_General_01, form.f_General_02, form.f_General_03, form.f_General_04, form.f_General_05, form.f_General_06, form.f_General_07, form.f_Title, form.f_FullName, form.f_Email)
	var mynames = new Array("Site/Cabin Number","Month of Stay","What accommodation did you stay in","The standard of the facilities available in the park","The cleanliness of the amenities","The standard of grounds maintenance","The standard of building maintenance","Maintenance in the Cabins","The cleanliness of the Cabins","The quality of furnishings in the Cabins","The standard of building maintenance","The attitude, friendliness and quality of service provided by the office staff","The attitude, friendliness & quality of service provided by the grounds staff","The organised activities available","The facilities available in the Park","The amount of tourist information available","The likelihood that you would recommend the park","How would you rate this holiday in comparison to previous holidays","Title","Full Name","Email")
	
	var errorFound01=false;
	var msg01="Please fill in or select a value for the following fields :\n\n";
	
	for (var i=0; i < myfields.length; i++)
	{
		
			if (myfields[i].value == "")
			{
				errorFound01=true;
				msg01=msg01 + mynames[i] + "\n";
			}
		
	}
	
	if(errorFound01)
	{
		alert(msg01);
		return false;
	}
	else
	{
		var errorFound02=false;
		var msg02="The following errors occurred:\n\n";
		
		
		if(errorFound02){
			alert(msg02);
			return false;
		}
		else
		{
			return true;
		}
		
	}//end of the second check
} //end of the first check
