

function validEmail(theStr) {
	var str = String(theStr).replace(/^\s*/,'');
	var at  = str.search(/@/);
	var dot = str.lastIndexOf('.');
	if (at > 0 && dot > at) 
		return str;
	return false;
}

function subForm() {
	var form = document.theForm;
	var theEls = form.elements;
	var theMail = validEmail(form.Email.value);
	var theErr  = 'Cannot proceed. Please adjust the following entries in the form:\n';
	var msg = '';
		 
		//Is the email address valid?
	if (theMail)
		form.Email.value = theMail;
	else 
		msg += 'The email address you entered does not appear to be valid.\n';

	if (msg != '') {
		theErr += msg;
		alert(theErr);
		return false;
	}
	return true;
}

