YAHOO.widget.AutoComplete.prototype._populateList = function (sQuery, aResults, oSelf) {
	if (aResults === null) {
		oSelf.dataErrorEvent.fire(oSelf, sQuery);
	}
	if (!oSelf._bFocused || !aResults) {
		return;
	}
	var isOpera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
	var contentStyle = oSelf._oContainer._oContent.style;
	contentStyle.width = (!isOpera) ? null : "";
	contentStyle.height = (!isOpera) ? null : "";
	var sCurQuery = decodeURIComponent(sQuery);
	oSelf._sCurQuery = sCurQuery;
	oSelf._bItemSelected = false;
	if (oSelf._maxResultsDisplayed != oSelf.maxResultsDisplayed) {
		oSelf._initList();
	}
	oSelf._initContainerHelpers();
	var aFresults = new Array();
	for (var j = 0; j < aResults.length; j++) {
		var ffResult = oSelf.formatResult(aResults[j], sCurQuery);
		if (ffResult.length > 0) {
			aFresults.push(aResults[j]);
		}
	}
	var nItems = Math.min(aFresults.length, oSelf.maxResultsDisplayed);
	oSelf._nDisplayedItems = nItems;
	if (nItems > 0) {
		var aItems = oSelf._aListItems;
		for (var i = nItems - 1; i >= 0; i--) {
			var oItemi = aItems[i];
			var oResultItemi = aFresults[i];
			oItemi.innerHTML = oSelf.formatResult(oResultItemi, sCurQuery);
			if (oItemi.innerHTML != null && oItemi.innerHTML.length > 0) {
				oItemi.style.display = "list-item";
				oItemi._sResultKey = oResultItemi[0];
				oItemi._oResultData = oResultItemi;
			} else {
				oItemi.innerHTML = null;
				oItemi.style.display = "none";
				oItemi._sResultKey = null;
				oItemi._oResultData = null;
			}
		}
		for (var j = aItems.length - 1; j >= nItems; j--) {
			var oItemj = aItems[j];
			oItemj.innerHTML = null;
			oItemj.style.display = "none";
			oItemj._sResultKey = null;
			oItemj._oResultData = null;
		}
		if (oSelf.autoHighlight) {
			var oFirstItem = aItems[0];
			oSelf._toggleHighlight(oFirstItem, "to");
			oSelf.itemArrowToEvent.fire(oSelf, oFirstItem);
			oSelf._typeAhead(oFirstItem, sQuery);
		} else {
			oSelf._oCurItem = null;
		}
		var ok = oSelf.doBeforeExpandContainer(oSelf._oTextbox, oSelf._oContainer, sQuery, aResults);
		oSelf._toggleContainer(ok);
	} else {
		oSelf._toggleContainer(false);
	}
	oSelf.dataReturnEvent.fire(oSelf, sQuery, aResults);
};
if (typeof LEH == "undefined") {
	var LEH = {};
}
LEH.tickerAutocomplete = function () {
	var oACDS;
	var oAutoComp;
	return {init:function () {
		if (oACDS){	delete oACDS;};
		oACDS = new YAHOO.widget.DS_XHR("/php/controlpanel/mylistings/search_autocomp.ajax", ["matches", "t", "n"]);
		//disable cache
		oACDS.maxCacheEntries = 0;
		
		oAutoComp = new YAHOO.widget.AutoComplete("searchArea", "ysearchcontainer", oACDS);
		oAutoComp.queryDelay = 0.05;
		oAutoComp.animVert = true;
		oAutoComp.maxResultsDisplayed = 10;
		oAutoComp.useShadow = true;
		oAutoComp.allowBrowserAutocomplete = false;
		oAutoComp.typeAhead = false;  
		oAutoComp.formatResult = function (oResultItem, sQuery) {
			
			var oneItem = oResultItem + "";
			if (oResultItem.length != 2) {
				return "";
			}
			if (oneItem.indexOf(",") == 0) {
				return "";
			}
			var oneRow = "<div class='sc'><div class='st'>" + LEH.tickerAutocomplete.boldQString(oResultItem[0], sQuery);
//			if (oResultItem[1] != "")
			oneRow = oneRow + "</div><div class='sr'>"+oResultItem[1]+"&nbsp;&nbsp;&nbsp;</div><div class='clear'></div></div>";
			return oneRow;
		};
		oAutoComp.doBeforeExpandContainer = function (oTextbox, oContainer, sQuery, aResults) {
			var pos = YAHOO.util.Dom.getXY(oTextbox);
			pos[1] += YAHOO.util.Dom.get(oTextbox).offsetHeight;
			YAHOO.util.Dom.setXY(oContainer, pos);
			return true;
		};
	}, boldQString:function (str, squery) {
		var idx = str.toLowerCase().indexOf(squery.toLowerCase());
		if (idx < 0) {
			return str;
		}
		var query = str.substr(idx, squery.length);
		var estr = str.substring(0, idx);
		var elm = estr + "<b>" + query + "</b>" + str.substring(idx + squery.length, str.length);
		return elm;
	}, validateForm:function (callFunction) {
		var txt = document.getElementById("searchArea");
		var tValues = txt.value.split(",");
		tValues.pop();
		callFunction(tValues);
		return false;
	}};
}();


