	function lookup(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			// post data to our php processing page and if there is a return greater than zero
			// show the suggestions box
			$.post("smart_search.php", {mysearchString: ""+inputString+""}, function(data){
				//alert(data);
				data=strim(data);
				//alert(data.length)
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} //end
	
	// if user clicks a suggestion, fill the text box.
	function fill(thisValue,obj) {
		$('#s').val(thisValue);
		cur_id=$(obj).attr('id');
		cur_ar=cur_id.split(":");
		prod_id=cur_ar[1];
		prod_type=cur_ar[0];
		if(prod_type=='1')
			window.location.href='food-producer-profile/food-'+prod_id+'.html';
		else if(prod_type=='2')
			window.location.href='wine-producer-profile/wine-'+prod_id+'.html';
		setTimeout("$('#suggestions').hide();", 200);
	}

	function strim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
