function validateField() { return true; }
function validateForm() { return true; }
var validateTest=new Array(); //set values in calling page
var validateMessage=new Array(); //set values in calling page

validRegExp=new RegExp("\d");
if (validRegExp.test("3")==true && validRegExp.test("z")==false) {

function validateField(thisField) {
var valid;
var alertMessage="'"+thisField.name+"' is not filled out.";
	if (validateTest[thisField.name] == null) return true;
	switch (typeof validateTest[thisField.name]) {
		case "string":
			validRegExp.compile(validateTest[thisField.name]);
			valid = validRegExp.test(thisField.value);
		break;

		default:
		valid = true; //if we don't know how to test, trust the user
		}
	if (valid) return true;
	if (typeof validateMessage[thisField.name] == "string") alertMessage=validateMessage[thisField.name];
	thisField.focus();
	if (thisField.type.indexOf("test,textarea,password,fileupload")) thisField.select();
	alert(alertMessage);
	return false;
	}

function validateForm(thisForm,beStrict) {
	var fieldsAreValid=true; 
	for (i=0 ; i < thisForm.elements.length ; i++) {
		if (validateTest[thisForm.elements[i].name] != null) {
			if (validateField(thisForm.elements[i]) == false) fieldsAreValid=false;
			}
		} // for each field
	//if (fieldsAreValid == false && beStrict != true) return confirm("You have not filled out all the required fields. Is it okay to submit your question anyway, or do you want to cancel?");
	//else 
return fieldsAreValid;
	}
} 
