

var eyeshot_autocomplete = function(){};

eyeshot_autocomplete.prototype.bind = function(input,area,url){
	$(input).autocomplete(url, {
		max: 12, //列表里的条目数
		minChars: 1, //自动完成激活之前填入的最小字符
		width: 200, //提示的宽度，溢出隐藏
		scrollHeight: 300, //提示的高度，溢出显示滚动条
		matchContains: true, //包含匹配，就是data参数里的数据，是否只要包含文本框里的数据就显示
		autoFill: false, //自动填充
		dataType: 'json',
		multipleSeparator: ' ',
		
		formatItem: function(row, i, max) {
			var result = '';
			if(row.chinese == ''){
				result = row.english;
			}else{
				result = row.chinese + '(' + row.english + ')';
			}
			$(area).hide();
			return result;
		},
		formatMatch: function(row, i, max) {
		
		return row.english;
		},
		formatResult: function(row) {
			return row.chinese;
		}
		}).result(function(event, row, formatted) {
			$(area).hide();
		});
};





