
function FormField(name, description, type, additional_params){
	
	this.name = name;
	this.description = description;
	this.type = type;	
	this.additional_params = additional_params; // multi-use
	this.isValid = function(f){
			
				switch(this.type){
					case "text" :
					return (f.elements[this.name].value != "");
					break;
					
					case "number" :
					var number_regex = /^[0-9]+$/;
					return ( number_regex.test(f.elements[this.name].value));
					break;
					
					case "characters" :
					var number_regex = /^[A-Za-z]+$/;
					return ( number_regex.test(f.elements[this.name].value));
					break;
					
					case "email" :
					var email_regex = /^([a-z0-9_-]+\.)*[a-z0-9_-]+@([a-z0-9_-]+\.)+[a-z]{2,3}$/i;
					return (email_regex.test(f.elements[this.name].value));
					break;
					
					case "radio" :
				return ((document.preForm.preQualityIndices[0].checked == true ) || (document.preForm.preQualityIndices[1].checked == true));
				break;
				
				case "confirm" :
 				return ( (f.elements[this.name].value != "") && (f.elements[this.additional_params].value == f.elements[this.name].value) );
				break;
					
					default : return false;
				};
		};
	
}




