// 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_Title, form.f_FullName, form.f_Email)

	var mynames = new Array("Site/Cabin Number","Month of Stay","What accommodation did you stay in","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

