//2007-02-05, ET : Altered so it can tell encrypted field values 
//2007-03-05, ET : create 2 sep functions - as only testing anti-spam change (which sends through email, confirmemail & text) on sites3, not howis or jobs at the moment - when they go over can remove first one and alter sites3 again. 
	
		
		function validateformspam(Email,ConfirmEmail,Text) {		
		
		 for (var i = 0; i<document.form.elements.length; i++){
			if(i == Email){
				var Email = document.form.elements[i].value;
				}
			else if(i == ConfirmEmail){
				var ConfirmEmail = document.form.elements[i].value;
				}
			else if (i == Text){
				var Text = document.form.elements[i].value;
				}
			
			}
			
		// If the user HAS NOT entered an email address

		// Check to see if the value entered in the email field matches the value in the confirm email field
		if (Email != ConfirmEmail) {
			alert("The email addresses entered do not match");
			return false;
		} else {
			// check to see if the email addresses entered are of a valid format
			if(Email.match(/^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$/i)) { 
				/* If the email address has been entered, the email addresses match and are 
				   of a valid format, Check to see if a comment has been entered*/
				if(Text == "" || Text == "enter your feedback") {
					alert("Please enter a comment");
					return false;
				} else {
					return true;
				}
			} else if (Email == '') {
				alert("Please enter your E-mail address.");
				return false;
			} else {
				alert("Invalid E-mail address format");
				return false;
			}
		}
//	} else {
		/* If the email address has been entered, the email addresses match and are 
		of a valid format, Check to see if a comment has been entered*/
		if(Text == "" || Text == "enter your feedback") {
			alert("Please enter a comment");
			return false;
		} else {
			return true;
		}
//	}
}

function validateform() {
	// If the user HAS NOT entered an email address
//	if(form.Email.value != "" && form.Email.value != "enter e-mail address") { 
		// Check to see if the value entered in the email field matches the value in the confirm email field
		if (form.Email.value != form.ConfirmEmail.value) {
			alert("The email addresses entered do not match");
			return false;
		} else {
			// check to see if the email addresses entered are of a valid format
			if(form.Email.value.match(/^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$/i)) { 
				/* If the email address has been entered, the email addresses match and are 
				   of a valid format, Check to see if a comment has been entered*/
				if(form.Text.value == "" || form.Text.value == "enter your feedback") {
					alert("Please enter a comment");
					return false;
				} else {
					return true;
				}
			} else if (form.Email.value == '') {
				alert("Please enter your E-mail address.");
				return false;
			} else {
				alert("Invalid E-mail address format");
				return false;
			}
		}
//	} else {
		/* If the email address has been entered, the email addresses match and are 
		of a valid format, Check to see if a comment has been entered*/
		if(form.Text.value == "" || form.Text.value == "enter your feedback") {
			alert("Please enter a comment");
			return false;
		} else {
			return true;
		}
//	}
}

