function verify(form) {
//Check to see that all required fields are filled in
var themessage = "Please complete the following fields: ";
if (!doesExist(form.Name.value)) {
themessage = themessage + " -  Name";
}
if (!doesExist(form.Email.value)) {
themessage = themessage + " -  Email address";
}
if (!doesExist(form.Subject.value)) {
themessage = themessage + " -  Subject";
}
if (!doesExist(form.Info.value)) {
themessage = themessage + " -  Message";
}

//alert if fields are empty and cancel form submit
if (themessage == "Please complete the following fields: ") {

	//Everything OK so far, check for a valid email address
	checkEmail(form);
	if (emailok == false) {
	themessage = "Invalid E-mail Address! Please re-enter";
	alert(themessage);
	return false;
	}
}
else {
alert(themessage);
return false;
   }
}

function doesExist(inputValue) {
	var aCharExists=0
	if (inputValue) {
		for (var i=0; i<inputValue.length; i++) {
			if (inputValue.charAt(i) != " ") {			
				aCharExists = 1
			}
		}
	}
	if (!aCharExists) {
		return false			
	}
	else {
		return true
	}
}

function checkEmail(form) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.Email.value)){
emailok=true;
}
else {
emailok=false;
}
}

function goSubmit() {    if (verify(document.form)) { document.form.submit(); }}
