
	var searchfield = document.getElementById("search");
	var inactiveColor = "#808080";
	var activeColor = "#000000";
	var startvalue = "";

	if(searchfield) {

		var s = getURLParam("search");

		if(s != "") {
			startvalue = "";
			searchfield.value = s;
			searchfield.style.color = activeColor;
		}
		else {
			startvalue = searchfield.value;
			searchfield.style.color = inactiveColor;
		}

		searchfield.onfocus = function() {
			if(searchfield.value == startvalue) {
				searchfield.value = "";
				searchfield.style.color = activeColor;
			}
		}
		searchfield.onblur = function() {
			if(searchfield.value == "") {
				searchfield.value = startvalue;
				searchfield.style.color = inactiveColor;
			}
		}
	}

	function checkSearchField(f) {
		searchfield.focus();
		if((searchfield.value == '') || (searchfield.value == startvalue)) {
			return false;
		}
		return true;
	}

	function getURLParam(strParamName) {
		var strReturn = "";
		var strHref = (window.location.href);
		if(strHref.indexOf("?") > -1) {
			var strQueryString = strHref.substr(strHref.indexOf("?") + 1);
			var aQueryString = strQueryString.split("&");
			for(var iParam = 0; iParam < aQueryString.length; iParam++) {
				if(aQueryString[iParam].indexOf(strParamName + "=") > -1 ) {
					var aParam = aQueryString[iParam].split("=");
					strReturn = aParam[1];
					break;
				}
			}
		}

		if(strReturn.length > 0) {
			return cyrUnescape(strReturn);
		}
		else {
			return "";
		}

	}


function hex2dec(dec) {
	var hexChars = "0123456789ABCDEF";
	return hexChars.indexOf(dec.substr(0, 1)) * 16 + hexChars.indexOf(dec.substr(1, 1));
}

function cyrUnescape(x) {
	x = x.replace(/\+/g, " ", -1);
	var rtrans = [];
	for (var i = 0x410; i <= 0x44F; i++) rtrans[i - 0x350] = i; // À-ßà-ÿ
	rtrans[0xA8] = 0x401; // ¨
	rtrans[0xB8] = 0x451; // ¸
	rtrans[0xB2] = 0x406, // ²
	rtrans[0xB3] = 0x456; // ³
	rtrans[0xAF] = 0x407; // ¯
	rtrans[0xBF] = 0x457; // ¿
	rtrans[0xAA] = 0x404; // ª
	rtrans[0xBA] = 0x454; // º
	rtrans[0xA5] = 0x403; // Ã
	rtrans[0xB4] = 0x453; // ã
	var t = "";
	var hexPos = 0;
	for(i = 0; i < x.length; i++) {
		var n = x.substr(i, 1);
		if(n == "%") hexPos = 1;
		else {
			if(hexPos > 0) {
				if(hexPos == 1) hexPos++;
				else {
					n = ("" + x.substr(i - 1, 1) + n);
					hexPos = hex2dec(n);
					t += (typeof rtrans[hexPos] != 'undefined') ? String.fromCharCode(rtrans[hexPos]) : unescape('%' + n);
					hexPos = 0;
				}
			}
			else {
				t += unescape(n);
			}
		}
	}
	return t;
}
