﻿window.addEvent('load', addSearchText);
function addSearchText()
{
    var searchFiled =$(document.body).getElement('.searchTxt');
    initField(searchFiled);
    searchFiled.addEvent('keydown',function(event){
   
    if(event.key=="enter" )
    { 
        if(searchFiled.value.length<2) return;
          location.href ="search.aspx?q=" + escape(searchFiled.value); 
        }
    })
 
    // Specify an onSelect method and alternate option colors
    var your_select = new MavSelectBox({
	    elem: $('lang_select'),
        'onSelect': function(_elem) {
                   location.href=_elem;
					}

    });

    
    
}
function initField(field) {
	if (field) { 
			if ((field.type == "text" ) && (field.value != null)) {	
			field.graytext = field.value;
			field.onfocus = function () {
				if (this.value==this.graytext){
					this.value="";
				} else {
					this.select();
				}
			}
			field.onblur = function () {
				if (this.value=="") {
				this.value=this.graytext;
				}
			}
		}
	}
}

function goLang()
{

	location.href = $('lang_select').value

}
