// SearchValidation.js

//////////////////////////////////////////////////////////
// This function will prevent submission of the specified
// form if the value of the specified field is null or whitespace.
// 
// If submission is prevented, the specified error will be 
// displayed in a messagebox.
//////////////////////////////////////////////////////////
function doSubmit(form, fieldName, errorMessage) {
	var fieldValue = form.elements[fieldName].value;
	var trimmed = fieldValue.replace(/^\s+|\s+$/g, '') ;
	if (trimmed=="") {
		alert(errorMessage);
		return false;
	} else {
		return true;
	}	
}
