	function initAutoObject(obj)
	{
		// Animation -- Optional
		// Container will expand and collapse vertically
		obj.animVert = true;

		// Container will expand and collapse horizontally
		obj.animHoriz = false;

		// Container animation will take 0.3 seconds to complete
		obj.animSpeed = 0.3;

		// Other
		obj.queryDelay = .1;
		obj.minQueryLength = 1;
		obj.useShadow = false;
		obj.typeAhead = false;
		obj.autoHighlight = false;
		obj.maxResultsDisplayed = 15;
		obj.useIFrame = true;
		
		// Format result (called for each received record, aResultItem is an array of fields received)
		obj.formatResult = function(aResultItem, sQuery) {
			var sResults = "";
			var nMax = aResultItem.length;
			var nIndex;

			return(aResultItem[0]);
		};
	}
	

	// On item select callback (b[2] = item selected)
	function callBack(a, b, c) {
		var query = String(b[2]);
		var queryArray = query.split(",");
		var stateName = queryArray[2];
		
		// alert('callback: a="' + a + '", b="' + b + '", c="' + c + '", query="' + b[2] + '"');
		
		// updateAjaxState();
	}



	// Class definition
	function clsAjaxField(sInstance, sFieldName)
	{	this.sCityDataSet = "";
		this.FieldName = "ToCityName";
		
		// Methods
		this.init = initAutoObject;
		this.updateState = function(stateID) 
			{	if (stateID)
					this.objCitySource.scriptQueryAppend = 's=' + stateID + '&ds=' + this.sCityDataSet;
				else
					this.objCitySource.scriptQueryAppend = 's=0';

				this.objCitySource.flushCache();
			}
		this.initStateLocal = function(formName, stateDropName, cityDropName, initialStateCode, initialCityId) 
			{}
		this.setCityDataSet = function(sDSName)
			{	this.sCityDataSet = sDSName;
			}
		
		
		// Object initialization code
		
		if (sFieldName)
			this.FieldName = sFieldName;
		
		// DS_XHR Parameters:
		//   URL to send data to
		//   Array containing record and field delimiter characters
		this.objCitySource = new YAHOO.util.XHRDataSource("/GeoData/GetCityList.asp"); 
		this.objCitySource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
		this.objCitySource.responseSchema = {
			recordDelim: "\n",
			fieldDelim: "\t"
		};

		// var objCitySource = new YAHOO.widget.DS_XHR("/GeoData/GetCityList.asp", ["\n", "\t"]); 
		// objCitySource.responseType = YAHOO.widget.DS_XHR.prototype.TYPE_FLAT; 
		this.objCitySource.maxCacheEntries = 0; 
		this.objCitySource.queryMatchSubset = false;
		this.objCitySource.scriptQueryAppend = ""; 

	// Setup object used for the default "to city" field (if it exists)	
		if (document.getElementById("AutoCityList" + sInstance))
		{
			var objAutoCity = new YAHOO.widget.AutoComplete(this.FieldName + sInstance, "AutoCityList" + sInstance, this.objCitySource);
			initAutoObject(objAutoCity);
		// Register callback function (called when an autofill option is selected
			objAutoCity.itemSelectEvent.subscribe(callBack);
		}
	
	}



