window.onload = function() {
	formular = document.getElementById('searchform')

	formular.onsubmit = function () {
		if (this.query.value === "" || this.query.value === "Vyhledávání…") {
			alert("Prosím zadejte výraz, který chcete vyhledat.");
			this.query.focus();
			return false;
		}
		return true;
	}

	formular.query.onfocus = function () {
		if (this.value === "Vyhledávání…") {
			this.value = "";
		}
	}

	formular.query.onblur = function () {
		if (this.value === "") {
			this.value = "Vyhledávání…";
		}
	}
}

function build_mejl(tld, domena, jmeno, kde, text) {
	var zavinac = '\u0040';
	var tecka = '\u002E';
	var mailto = '\u006D\u0061\u0069\u006C\u0074\u006F\u003A';
	if (text === undefined) {
		text = "\u003c"+jmeno+zavinac+domena+tecka+tld+"\u003e";
	}
	var odkaz = document.createElement("a");
	odkaz.setAttribute("href", mailto+jmeno+zavinac+domena+tecka+tld);
	var textnode = document.createTextNode(text);
	var foo = document.getElementById(kde);
	foo.removeChild(foo.firstChild);
	foo.appendChild(odkaz).appendChild(textnode);
}
