    YandexSuggestAutocompleter = Class.create();
    Object.extend(Object.extend(YandexSuggestAutocompleter.prototype, Autocompleter.Local.prototype), {
        cache: {},
		selectEntry: function() {
			//if (event.keyCode != Event.KEY_TAB) {
				this.active = false;
				if (this.getEntry(this.index).innerHTML.indexOf('nav_link')==-1) {
					if ((this.index+1)<this.entryCount) { this.updateElement(this.getCurrentEntry()); }
					document.forms['ya'].submit();
				}
				else { window.open (document.getElementById('nav_link').getAttribute('href'),"nav_link"); }
			//}
		},
        getUpdatedChoices: function() {
            var tok = this.getToken().toLowerCase();
            if (this.cache[tok]) return this.apply( tok, this.cache[tok] );
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = 'http://suggest.yandex.ru/suggest-ya.cgi?ct=text/html&v=2&part=' + encodeURIComponent(tok);
            document.body.appendChild(script);    
        },
        apply: function( tok, list ) {
            if ((list.length) && (tok.length<2)) return this.updateChoices( '<ul></ul>' );
            if (!this.cache[tok]) this.cache[tok] = list;
            var values = [];
            for (var i=0; i<list.length; i+=1) {
                var v = list[i] + '';
				if (v!='undefined') {
					if (v.indexOf('nav') != -1) {  values.push('<a href="http://'+list[i][2]+'" target="_blank" id="nav_link">'+list[i][2]+"</a> &mdash; "+list[i][1]+'</a>'); }
					else { values.push('<b>'+v.slice(0, tok.length)+'</b>'+v.slice(tok.length)); }
				}
            }
			if (values != "") {
				this.updateChoices( '<ul><li>' + values.join('</li><li>') + '</li><ul>' );
				this.index=this.entryCount;
				this.render();
			}
			else {
				this.hide();
			}
        }
    });
    
	var suggest = {};
    
    Event.observe(window, 'load', function(event) {
        suggest = new YandexSuggestAutocompleter( "searchBoxYandex", "searchBoxYandexSuggestions", null, { 
            minChars: 1, frequency: 0.1, autosubmit: true
        } );
    }, 'false');
