// JavaScript Document


function checkform(whichform)
{
	errorMessage = "";
	
	switch(whichform)
	{
	case 'email':

		//Check the Club Field
		club = document.contact.club.value;
		if(club == "NA")
		{
			errorMessage = errorMessage + "You have not selected a Club from the List!\n";
		}

		//Check the Name Field
		fullName = document.contact.fullName.value;
		if(fullName == "")
		{
			errorMessage = errorMessage + "You have not entered your Name!\n";
		}

		//Check the Email Field
		email = document.contact.email.value;
		apos=email.indexOf("@");
		dotpos=email.lastIndexOf(".");
		if (apos<1||dotpos-apos<2)
		{
			errorMessage = errorMessage + "You have not entered a valid Email Address!\n";
		}

	  	//Check the Subject Field
		subject = document.contact.subject.value;
		if(subject == "")
		{
			errorMessage = errorMessage + "You have not entered a Subject for the message!\n";
		}

	  	//Check the Message Field
		subject = document.contact.enquiry.value;
		if(subject == "")
		{
			errorMessage = errorMessage + "You have not entered a Subject for the message!\n";
		}
	  break;
	}	

	//Check if any errors, then process
		
	if(errorMessage == "")
	{
		return true;
	}
	else
	{
		alert(errorMessage);
		return false;
	}

}
