 
<!--
function form_Validator(theForm)
{	
	var alertsay = "";   
	
	if (theForm.cboEnquiry.selectedIndex == "")
	{
	alert("Please specify your enquiry");
	theForm.cboEnquiry.focus();
	return (false);
	}
	
	if (theForm.txtFirstName.value == "")
	{
	alert("You must enter your first name");
	theForm.txtFirstName.focus();
	return (false);
	}
	 
	if (theForm.txtSurname.value == "")
	{
	alert("You must enter your surname");
	theForm.txtSurname.focus();
	return (false);
	}
	
	if (theForm.cboCountry.selectedIndex == "")
	{
	alert("Please specify your country");
	theForm.cboCountry.focus();
	return (false);
	}
	  
	if (theForm.txtSuburb.value == "")
	{
	alert("Please specify your suburb");
	theForm.txtSuburb.focus();
	return (false);
	}
	
	
	if (theForm.txtPostCode.value == "")
	{
	alert("Please specify your post code");
	theForm.txtPostCode.focus();
	return (false);
	}
	
	  
	// check if email field is blank
	if (theForm.txtEmail.value == "")
	{
	alert("Please enter a valid email address");
	theForm.txtEmail.focus();
	return (false);
	}
	
	
	// test if valid email address, must have @ and .
	var checkEmail = "@.";
	var checkStr = theForm.txtEmail.value;
	var EmailValid = false;
	var EmailAt = -1;
	var EmailPeriod = -1;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		if (ch == "@")
			EmailAt = i;
		if (ch == ".") 
			EmailPeriod = i;
	}
		// if both the @ and . were in the string
	if ((EmailAt > -1) && (EmailPeriod > -1) && (EmailAt < EmailPeriod))	EmailValid = true;
	
	if (!EmailValid)
	{
	alert("Your email address must contain an \"@\" and a \".\".");
	theForm.txtEmail.focus();
	return (false);
	}
	
	if (theForm.txtComments.value == "")
	{
	alert("Please enter your comments.");
	theForm.txtComments.focus();
	return (false);
	}

 return (true);
}
 
