// This function will validate some fields from a contact form.
function validate_form()
{
	valid = true;

    if(document.form1.name.value == "") // Check that the user has entered a name.
    {
    	alert("Please enter your name."); // Message
        valid = false; // Stop the form processing
    }
    else
    {
    	if(!isValidEmail(document.form1.email.value))
		{
			alert("Please enter a correct email address.");
			valid = false;
        }
	}
	return valid; // Everything is fine.
}
// This function will check that the user has entered a valid email
// address.
function isValidEmail(str) 
{
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}