
function validateForm(fields, form) {

	var valid = true;
	var note = "";

	// loop through and check to see if they are blank
	for(var i=0; i<fields.length; i++) {
		
		// define the field/labels
		fieldlbl = $("#" + fields[i]);
		field = eval("document." + form + "." + fields[i]);

		// if it exists, work with it
		if(field != null && fieldlbl != null) {

			if(field.value == "") {
			
				fieldlbl.addClass("red");
				valid = false;
				note = "Please fill out the required fields above.";
			
			} else {
			
				fieldlbl.removeClass("red");
			
			}
		
		} else {
		
			alert("The field or label: " + fields[i] + " was not found.");
		
		}
	
	}
	
	
	
	if(!valid) {
		return note;
	} else {
		return valid;
	}

}
