function checkFields(fieldList) {

/* check that required fields have been completed */ 
/* list len */

var re = /,/gi;
var theList = fieldList.split(",");
var RequiredFieldNumber = theList.length;
//alert(theList[0]);
//alert(theList[1]);
//var fieldList = '"' + fieldList.replace(re, '","') + '"';
//alert(fieldList);
//var fieldArray = new Array(eval(fieldList));
//alert(fieldArray[0]);
formElementLength = document.theForm.length;
	/* create the regular expression to look for the underscore '_' to be replaced with the space ' '*/
	re = /_/gi;
	/*validate for the required fields*/
	for (yy=0;yy <= (RequiredFieldNumber-1); yy++) {
		theField = theList[yy];
		for (xx=0;xx < formElementLength; xx++) {
			if (document.theForm[xx].name == eval('theField')) {
				theFieldSize = document.theForm[xx].value.length;
				if (theFieldSize == 0){
					displayFieldName = document.theForm[xx].name.replace(re, ' ');
					IDposition = displayFieldName.indexOf('ID');
					if (IDposition > 0) {
						displayFieldName = displayFieldName.substr(0, IDposition);
					}
					alert('You must enter your ' + displayFieldName);
					document.theForm[xx].focus();
					return false;
				}	
			}
		}
	}	

}

