	// Checks that a form is completed before allowing it to be submitted.
	function checkRegistration(formObj) {  
		var alert_message = ""; // string to hold error messages

		//----------------------------------------------------------------
		// Check Valid Email - requires javascript function isValidEmail
		if (!isValidEmail(formObj.registerEmail.value)) {
			alert_message = alert_message + "   Valid Email Address\n";
		}

		//----------------------------------------------------------------
		// Pop up alert message and don't submit form if error occured
		if (alert_message) { // if there was error, alert_message will not be empty
			alert ("Your registration is incomplete.\n" +
				   "Please enter a Valid Email Address\n");
			return false;
		} else { // no alert_message, so proceed
			return true;
		}
	}

	function isValidEmail (emailStr) {

		var emailPat=/^(.+)@(.+)$/; // general email format
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"; // don't allow these special characters  ( ) < > @ , ; : \ " . [ ]
		var validChars="\[^\\s" + specialChars + "\]"; // what constitudes valid characters (actually what does not)
		var quotedUser="(\"[^\"]*\")"; // user can be quoted, eg. "jiminy cricket"@disney.com
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; // IP address instead of host, eg joe@[123.234.345.1]
		var atom=validChars + '+'; // atoms are a series of non-special characters
		var word="(" + atom + "|" + quotedUser + ")"; // represents one word in the typical username
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); // describes the structure of the user
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); // describes the structure of a normal domain name (non-IP)

		// Break up user@domain into different pieces that are easy to analyze.
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) {
			return false; // alert("Email address seems incorrect (check @ and .'s)");
		}
		
		var user=matchArray[1];
		var domain=matchArray[2];
		
		// See if "user" is valid 
		if (user.match(userPat)==null) {
			return false; // alert("The username doesn't seem to be valid.");
		}
		
		// if the e-mail address is at an IP address (as opposed to a symbolic
		// host name) make sure the IP address is valid.
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
			// this is an IP address
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					return false; // alert("Destination email IP address is invalid!");
				}
			}
			return true; // no need to checkfurther - code below is for non-IP domain names
		}
		
		// Domain is symbolic name, not an IP
		var domainArray=domain.match(domainPat)
		if (domainArray==null) {
		    return false; // alert("The domain name doesn't seem to be valid.");
		}

		// Now we need to break up the domain to get a count of how many atoms
		// it consists of.
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || 
			domArr[domArr.length-1].length>4) {
			return false; // alert("The address must end in a four-letter domain, or two letter country.");
		}
	
		// Make sure there's a host name preceding the domain.
		if (len<2) {
			return false; // alert("This address is missing a hostname!");
		}
	
		// If we've gotten this far, everything's valid!
		return true;
	}