function validateCF() {	//get values of required fields	var nameEntered = document.contactForm.name.value;	var emailEntered = document.contactForm.email.value;	var commentsEntered = document.contactForm.comments.value;		//conditional statements	var emptyName = (nameEntered == '');	var emptyEmail = (emailEntered == '');	var emptyComments = (commentsEntered == '');		//create nested array pairing required fields with 'empty' condition statements	var reqFields = new Array;	reqFields[0] = ['NAME', emptyName];	reqFields[1] = ['EMAIL', emptyEmail];	reqFields[2] = ['COMMENTS', emptyComments];	//if a required field is missing	if (emptyName || emptyEmail || emptyComments) {		//create warning string		var warnString = "Please complete the following required field(s):";		var errorCount = 0;				function genErrorList(indexVal) {			if (reqFields[indexVal][1]) {				if (errorCount > 0) {					warnString += ','				}				warnString += " " + reqFields[indexVal][0];				errorCount += 1;			}		}				for (i=0; i < reqFields.length; i++) {			genErrorList(i);		}				//replace last instance of ',' with ' and'		warnString = warnString.replace(/^(.*),(.*)$/, "$1 and$2"); 												//output alert		alert(warnString);									} else {//if all required fields are filled out		//email validation expression		var emailExp = "^([a-zA-Z0-9._-]+)@([a-zA-Z0-9-])+(\.[a-zA-Z0-9-]+)+$";		//check if email is valid				if (!emailEntered.match(emailExp)) {			alert ("Your email does not appear to be in a valid format. Please check and try again."); 			} else {//process form			document.contactForm.submit();		}		}}function clearCF() {	document.contactForm.reset();}