// JavaScript Document
function validEmail(Email) {
	invalidChars = " /:;";
	
	//cannot be empty, cannot have default value
	if (Email == "" || Email == "you@somewhere.com") {
		return false;
	}
	//cannot contain any invalid characters
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (Email.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	atPos = Email.indexOf("@",1);
	//must contain one "@" symbol
	if (atPos == -1) {
		return false;
	}
	//and only one "@" symbol
	if (Email.indexOf("@",atPos+1) != -1) {
		return false;
	}
	periodPos = Email.indexOf(".",atPos);
	//and at least one "." after the "@"
	if (periodPos == -1) {
		return false;
	}
	//must be at least 2 characters after the "."
	if (periodPos+3 > Email.length) {
		return false;
	}
	//email is OK
	return true;
}
function submitIt(form01) {
	//name field cannot be empty
	if (form01.FullName.value == "") {
		alert("Please enter your name");
		form01.FullName.focus();
		form01.FullName.select();
		return false;
	}
	//email must be OK
	if (!validEmail(form01.Email.value)) {
		alert("Please enter your e-mail address");
		form01.Email.focus();
		form01.Email.select();
		return false;
	}
	//message field cannot be empty
	if (form01.Message.value == "") {
		alert("Please enter your message");
		form01.Message.focus();
		form01.Message.select();
		return false;
	}
	//OK so return true
	return true;
}
