/*Universal Golf Validation Script for signup form */
function validate(the_form)
{
	if(the_form.name.value=="")
	{
		alert('Please enter your name!');
		the_form.name.focus();
		return false;
	}
	if(the_form.age.value=="")
	{
		alert('Please enter your age.');
		the_form.age.focus();
		return false;
	}
	if(!valid_email(the_form.email.value))
	{
		alert('Please enter a valid email address.');
		the_form.email.focus();
		return false;
	}	
	return true;
}

function valid_email(addr) 
{
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	
	if ( !regex.test(addr) ) 
	{
		return false;
	}
	return true;
}