/**
 * @author jorge.silveira
 */
jQuery.noConflict();
	jQuery(document).ready(function(){
	function findValue(li) {
		if( li == null ) return alert("No match!");
		// if coming from an AJAX call, let's use the CityId as the value
		
	}

	function selectItem(li) {
		location.href='counter.php?site='+li.extra[1];
	}

	function formatItem(row) {
		return row[0];
	}

	function lookupAjax(){
		var oSuggest = jQuery("#textfield")[0].autocompleter;
		oSuggest.findValue();
		return false;
	}
	
	jQuery("#textfield").autocomplete(
			"/web/suggest.php", {
				delay:500,
				minChars:5,
				matchSubset:1,
				matchContains:1,
				cacheLength:20,
				onItemSelect:selectItem,
				onFindValue:findValue,
				formatItem:formatItem,
				autoFill:false
		});	

});
