/**
 * Checks to see if the form object entered is empty or not.
 * @param entered Must contain a ".value" attribute.
 * @param alertbox If set, this function will launch an alert() dialog with the text specified.
 * @return false if entered doesn't pass validation, true if entered is valid and is not empty.
 */
function emptyvalidation(entered, alertbox)
{
	with (entered)
	{
		while (value.charAt(0) == ' '){
			value = value.substring(1);
		}
		
		while (value.charAt(value.length - 1) == ' ') {
			value = value.substring(0, value.length - 1);
		}
		
		if (value==null || value==""){
			
			if (alertbox!=""){
				alert(alertbox);
			}
			return false;
		}
		else {
			return true;
		}
	}
	return false;
}
/**
 * Validate an email address of comma separated list of email addresses.
 * 
 * @param thisform
 *            Object to be tested, must have a ".value" property.
 * @return true if all addresses are valid, false otherwise.
 */
function emailvalidation(thisform) {

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var address = thisform.value;
	var email = address.split(',');

	for ( var i = 0; i < email.length; i++) {
		if (reg.test(email[i]) == false) {
			// alert('Invalid Email Address');
			return false;
		} 
	}
	return true;
}