// Form Validations functions

function checkEntities(fields) {
	
	var numInputs = fields[0];

	for (var i=1; i<=numInputs; i++) {
		
		var field = fields[i];
	
		var re = /^(\w+)(\s*)/;

		if (!re.test(document.F1.elements[field].value)) {
			
			alert('You enterend an invalid character in the '+field+' field. Please remove any symbols from the field and spaces before the first letter.');
			return false;	
		
		}
	}
	
	return true;
}

function checkEmail() {

	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	
	if (!re.test(document.F1.senderEmail.value)) {
	
		alert('The email address you entered does not appear to be valid.  Please enter a valid email.');
		return false;
	
	}else{
		
		return true;
	}
}

function checkEmpty (inputs) {

	var num = inputs[0];
	
	for (var i=1; i<=num; i++) {
		
		var input = inputs[i];

		if (document.F1.elements[input].value == '') {
			
			alert('You did not fill in the '+input+' field. Please enter some information in the field.');
			return false;	
		
		}
	}
	
	return true;
}
	