// Validate input to email form

function validate(document){

	if ( document.name.value == "" ) {
		alert( "Please make sure the Name is filled in." );
		document.name.focus();
		return false;
	} 
	
	if ( document.email.value == "" ) {
		alert( "Please make sure the Email Address is filled in." );
		document.email.focus();
		return false;
	} 

	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (document.email.value.match(illegalChars)) {
   		alert( "The Email Address contains illegal characters.");
		document.email.focus();
		return false;
	}

	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(document.email.value))) {
		alert( "Please make sure the email address is valid." );
		document.email.focus();
		return false;
	}

	if ( document.subject.value == "" ) {
		alert( "Please make sure the Subject field is filled in." );
		document.subject.focus();
		return false;
	} 
	
	if ( document.message.value == "" ) {
		alert( "Please make sure the Message field is filled in." );
		document.message.focus();
		return false;
	} 
	
	// All is well. Proceed...
	return true;
}
