function validateForm(theForm)
{
	if (theForm.surname.value.length == 0) 
	{
		alert("Please enter your surname!");
		theForm.surname.focus();
		return false;
	}

	else if (theForm.firstname.value.length == 0)
	{
		alert("Please enter your first name!");
		theForm.firstname.focus();
		return false;
	}

	else if (theForm.district.selectedIndex == 0)
	{
		alert ("Please select your district!");
		theForm.district.focus();
		return false;
	}

	else if (theForm.district.selectedIndex == 24 &&
			 theForm.organization.value.length == 0)
	{
		alert ("Please specify your organization!");
		theForm.organization.focus();
		return false;
	}

	else if (theForm.position.value.length == 0)
	{
		alert("Please enter your position or title!");
		theForm.position.focus();
		return false;
	}

	else if (theForm.email.value.length == 0)
	{
		alert("Please enter your e-mail address!");
		theForm.email.focus();
		return false;
	}

	else if (ValidateEmail(theForm.email.value) == false)
	{
		alert("Invalid e-mail address!");
		theForm.email.select();
		return false;
	}

	else if (theForm.music_ministry[0].checked == false &&
    		 theForm.music_ministry[1].checked == false)
	{
		alert ("Please specify a music ministry choice!");
		return false;
	}

	else if (theForm.sat_banquet[0].checked == false &&
			 theForm.sat_banquet[1].checked == false)
	{
		alert ("Please specify your banquet attendance!");
		return false;
	}

	else if (theForm.sat_banquet[0].checked == true &&
			 theForm.tickets.value.length == 0)
	{
		alert ("Please specify the number of tickets!");
		return false;
	}
	
	else if (theForm.sat_banquet[0].checked == true &&
			 isNaN(theForm.tickets.value))
	{
		alert ("The number of tickets must be numeric!");
		return false;
	}
	
	return true;
}


function ValidateEmail(myEmail)
{
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;

	// search email text for regular exp matches
	if (myEmail.search(validRegExp) == -1) 
	{
		return false;
	}
	
	return true; 
}
