// email

function checkEmail (strng, label) {
	var error="";
	if (strng == "") {
		 error = "Please enter your " + label + ".\n";
	}
	
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(strng))) { 
		 error = "Please enter a valid " + label + ".\n";
	}
	else {
//test email for illegal characters
		 var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) {
				error = "Your " + label + " contains illegal characters.\n";
		 }
	}
	return error;		
}

function checkTextField (strng, label) {
	var error = "";
	if (strng == "") {
		 error = "Please enter a " + label + ".\n";
	}

	var illegalChars = /[^a-zA-Z0-9 ]/; // allow letters, numbers
	if (illegalChars.test(strng)) {
		error = "The " + label + " contains illegal characters.\n";
	} 
	return error;
}
function checkTextFieldNonReq (strng, label) {
	var error = "";
	var illegalChars = /[^a-zA-Z0-9 ]/; // allow letters, numbers
	if (strng != "") {
		if (illegalChars.test(strng)) {
			error = "The " + label + " contains illegal characters.\n";
		} 
	}
	return error;
}
function checkMenuSelection (strng, label) {
	var error = "";
	if (strng.length == 0) {
		 error = "Please choose a " + label + "\n";
	}
	return error;	  
}
