//
//	Contact Form Validation
//

// verify the minimum information is entered
function validate_contact() {
	var success=true						// default to valid form
	var errormsg = 'You need to enter the following: '

	if (document.form.name.value <= '') {
		errormsg += '\r - Enter your name'
		success = false
		}

	if (!isEmailValid(document.form.email.value)) {
		errormsg += '\r - Enter a valid email address'
		success = false
		}

	if (document.form.phone.value <= '') {
		errormsg += '\r - Enter a phone number'
		success = false
		}
		
	if (!success) alert(errormsg);
	return success;
	}

// Validate Email Address
// 
// Email address must be of form a@b.c -- in other words:
// * there must be at least one character before the @
// * there must be at least one character before and after the .
// * the characters @ and . are both required
// * for Regular Expressions see: http://developer.netscape.com/library/documentation/communicator/jsguide/regexp.htm
//
var reEmail = /^.+\@.+\..+$/

function isEmailValid (s) {
	isNotEmpty = ((s == null) || (s.length == 0)) ? false : true
	if (isNotEmpty) return reEmail.test(s);
    else return false;
	}

