// given a field name, return the first matching field, if any
function getFieldByName(fieldName) {
//fieldName MUST be specified; formName MAY be specified as optional second parameter
var testing=false;
var fieldName;
var fieldIndex, formIndex;
var theField, theForm;
var values=new Array();
for (formIndex=0;formIndex < document.forms.length; formIndex++) {
theForm=document.forms[formIndex];
//if (testing) alert('getValueByFieldName is examining form named "'+theForm.name+'"');//testing
	if (arguments.length>1 && arguments[1]!=theForm.name) continue;
	for (fieldIndex=0 ; fieldIndex < theForm.elements.length; fieldIndex++) {
	theField=theForm.elements[fieldIndex];
//if (testing) alert('getValueByFieldName is examining field named "'+theField.name+'"');//testing
		if (theField.name != fieldName) continue;
if (testing) alert('getValueByFieldName found a '+theField.type+' field named "'+theField.name+' in a form named "'+theForm.name+'"');//testing
           return theField;
	   }//for element
	}//for form
return false;
}//function
		