﻿var emptyStr = "Я ищу...";

function btnFind_Click() {
	var str = document.getElementById("tbFind").value;
	if ((str.length > 0) && (str != emptyStr))
		document.location.href = "results.aspx?query=" + str;
}

function onEnterFind(obj) {
	var key = (window.Event) ? obj.which : obj.keyCode;
	if (key == 13) {
		btnFind_Click();
		return false;
	}

	return true;
}

function activeSearch(me) {
	if (me.value != emptyStr) {
		me.style.color = "Black";
		me.style.fontStyle = "normal";
	}
	else {
		me.style.color = "Gray";
		me.style.fontStyle = "italic";
	}
}

function setEmptyStr() {
	var control = document.getElementById("tbFind");
	if ((searchQuery == null)||(searchQuery == ""))
		control.value = emptyStr;
	else
	{
		control.value = searchQuery;
		activeSearch(control);
	}
}
