function lookupWhseByUser()
{
	try
	{	
		// Clear the select box
		
		document.getElementById("WarehouseID").options.length = 0; //yf cb w3c

		if (document.getElementById("txtGlobalUserName").value != "") //yf cb w3c
		{
			initRequest();		
			requestXMLLookup('LOOKUP_WHSE_BY_USER',document.getElementById("txtGlobalUserName").value);			
			sendRequest();
			
			for (var i=0; i<getRecordCount(); i++)
			{ 			
				//After calling sendRequest(), use getFieldValueByName(sLookupKey,sKeyValue) to get the return field value
				var tWhseKey	= getFieldValueByNameIndex('LOOKUP_WHSE_BY_USER', 'whse_key', i);				
				var tWhseID		= getFieldValueByNameIndex('LOOKUP_WHSE_BY_USER', 'whse_id', i);
							
				if (tWhseKey != null)
				{
					// Add the new options to the warehouse dropdownlist							
					var newOpt = document.createElement("OPTION");
					newOpt.text=tWhseID;
					newOpt.value=tWhseKey;				
					document.getElementById("WarehouseID").options.add(newOpt);										
				}				
			}
			
			
		}
	
	}
	catch(e)
	{
		alert("v5login.js::lookupWhseByUser(): " + e);
	}
}
