function checkForm(thisform){
	// your form must contain a hidden field called 'required_fields' listing the field names seperated by a comma
	// and a hidden field called 'required_names' listing the nice names of those fields on the same order
	var rfields = thisform.required_fields.value.split(",");
	var rnames = thisform.required_names.value.split(",");
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/; 
	for(i=0;i<rfields.length;i++){
		if(!thisform[rfields[i]].disabled){//only check the field if it is NOT disabled
			thisvalue = thisform[rfields[i]].value;
			if(thisvalue == ""){
				alert("'" + rnames[i] + "' is a required field.");
				return false;
			}else if(rfields[i].indexOf("email")!=-1 && !re.test(thisvalue)){
				alert("The '" + rnames[i] + "' field should be a valid email address.");
				return false;
			}
		}
	}
	return true;
}