function cookie(x) {
	if (document.cookie == "")
		document.getElementById("cookie").innerHTML = "<div id='error'><div><div>" + x + "</div></div></div>";
}

function s() {
	var s = document.getElementById("s");
	var result = true;
	if(s.value == "" || s.value.length < 3) {
		slowShow("#warning",1500);
		result = false;
	}
	return result;
}

function loadPage() {
	var i = this.selectedIndex;
	if (i > 0) {
		var url = this.options[i].value;
		window.location.href = url;
	}
}

function slowShow(x,y) {
	$(x).hide();
	$(x).hide(function(){$(x).fadeIn(y); return false;});
}

function slowHide(x,y) {
	$(x).hide(y);
}

function page(x,y) {
	var body = document.getElementById("body");
	var div2 = document.createElement("div");
	var div1 = document.createElement("div");
	div2.setAttribute("id","pageBackground");
	div1.setAttribute("id","pageContent");
	document.getElementById("pageContent").innerHTML = '<iframe src="' + x +'" frameborder="0" scrolling="no" width="480" height="300"></iframe><a href="#" onclick="return noPage()">' + y + '</a>';
	document.getElementById("pageBackground").setAttribute("onclick","return noPage()");
	body.appendChild(div2);
	body.appendChild(div1);
	slowShow("#pageBackground",500);
	slowShow("#pageContent",1000);

}

function noPage() {
	slowHide("#pageBackground",100);
	slowHide("#pageContent",500);
}

$(document).ready(function(){

	if (document.getElementById("s") != undefined) {
//		document.getElementById("s").setAttribute('autocomplete','off');
		document.getElementById("a").onclick = s;
		document.getElementById("s").focus();
		slowShow("#s",1000);
	}
	
	if (
		document.getElementById("nav_about") != undefined &&
		document.getElementById("nav_contacts") != undefined
		) {
//		document.getElementById("nav_about").style.display = 'block';
//		document.getElementById("nav_contacts").style.display = 'block';
		document.getElementById("nav_about").setAttribute("href","#");
		document.getElementById("nav_contacts").setAttribute("href","#");
	}
	
	if (document.getElementById("headline") != undefined) {
		slowShow("#headline",3000);
	}
	
	if (document.getElementById("flag") != undefined) {
		document.getElementById("lang").style.display = 'block';
		document.getElementById("flag").onchange = loadPage;
	}

});
