var shareBoxAutoCompleter = Class.create(withImgAndGroupsAutoCompleter, {
	initialize: function($super, config) {
		config.beforeResultClick = function(val, addinfo) {
			var type = addinfo[1];
			if (type == 32) {// teams
				val = '[t]\'' + val + '\'';
			}
			if (type == 0) {// player
				val = '[p]\'' + val + '\'';
			}
			if (type == 49) {// leages
				val = '[l]\'' + val + '\'';
			}
			return val;
		}
		$super(config);
	},
	
	// переопределяю родительскую функцию
	// тут другой случай, всем @ рулит
	onResultClick: function(val, addInfo) {
		val = this.config.beforeResultClick.call(this, val, addInfo);
		with (this.config.targetInput) {
			var v = getValue(), nv = '', p = '';
			// найдем последнюю @
			var lastIndex = v.lastIndexOf('@');
			if (lastIndex >= 0) {
				v = v.substring(0, lastIndex + 1);
			}
			setValue(v + val).focus();
		}
		this.hideResults();
		this.config.afterResultClick.call(this, val, addInfo);
	}
});
