// email
	function checkEmail (strng) {
		var error="";
		if (strng == "") {
			error = "You didn't enter an email address.\n";
		}
		var emailFilter=/^.+@.+\..{2,3}$/;
    	if (!(emailFilter.test(strng))) { 
			error = "Please enter a valid email address.\n";
		} else {
		//test email for illegal characters
		var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
		if (strng.match(illegalChars)) {
			error = "The email address contains illegal characters.\n";
		}
		}
		return error;    
	}
	// non-empty first name
	function isEmptyFN(strng) {
		var error = "";
		if (strng.length == 0) {
			error = "Please fill in your first name.\n"
  		}
		return error;     
	}

	// non-empty last name
	function isEmptyLN(strng) {
		var error = "";
		if (strng.length == 0) {
			error = "Please fill in your last name.\n"
  		}
		return error;     
	}

	// matching email addresses
	function isDifferent(strng1,strng2) {
		var error = ""; 
		if (strng1 != strng2) {
			error = "The email addresses must match.\n";
		}
		return error;
	}    

	function checkWholeForm(theForm) {
		var why = "";
		why += checkEmail(theForm.email.value);
		why += isEmptyFN(theForm.fname.value);
		why += isEmptyLN(theForm.lname.value);
		/* why += isDifferent(theForm.email1.value,theForm.email2.value); */
		if (why != "") {
			alert(why);
			return false;
		}
		return true;
	}
