
//Function to find value in a list of ZIP codes
//crw 2008.01.04
function findValueInList(strTargetObjectID, strSelObjName, strMsgControlName, strOKMsg, strNotOKMsg )
{
//strTargetObjectID: optional string containing name of the object with .value property containing target value
//strSelObjName: string containing name of <select /> object containing list of acceptable values
//strMsgControlName: string containing id of <input /> control used to show warning or OK
//strOKMsg: string containing text to show if value found
//strNotOKMsg: string containign text to show if value not found
	if (strTargetObjectID == '')	
	{
		return false;
	}
	else
	{
	var targetValueObject = getObjectAnyBrowser(strTargetObjectID);
	if (targetValueObject == null)
		return false;
	}

	if (strMsgControlName != '')
	{
	alert ('hi');
		var myControl = getObjectAnyBrowser(strMsgControlName);  //get message control
		if (myControl != null)
		{
			myControl.style.color ='black';	
			myControl.value= "checking..."
		}
	}
	
	var valueList = getObjectAnyBrowser(strSelObjName); //get select list control
	if (valueList != null)
	{
		for (i=0 ; i<valueList.options.length ; i++)
		{
			if (targetValueObject.value == valueList.options[i].text) 
			{ 
				if (myControl != null)
				{
					myControl.value = strOKMsg;			
				}
				return true; 
			}
		}
	}
	if (myControl != null)
	{
		myControl.style.color ='red';
		myControl.value = targetValueObject.value + strNotOKMsg;
		targetValueObject.focus();
	}
	return false;
}

//Function to copy a selected value from a select list to a target object with .value property
//crw 2008.01.04
function copySelectedValueToUserField(selectlistobject, strTargetName, strMsgControlName, strMsg)
{
//selectlistobject: select list with selected value to be copied
//strTargetName: string containing name of control with .value property to receive selected value
//strMsgControlName: string containing name of input control used for message to user
//strMsg: string containing message for user
	document.getElementById(strTargetName).value = selectlistobject.value;
	myControl = document.getElementById(strMsgControlName);
	myControl.style.color='black';
	myControl.value = strMsg;
}

