var xmlHttp;

function suggest(input) {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="index.php?akcia=suggest&query="+input;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById("suggestions").style.display = 'inline';
		document.getElementById("suggestions").innerHTML=xmlHttp.responseText ;
	}
}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function fill_input(text) {
	document.getElementById("login_input").value=text;
	hide_suggestions();
}

function hide_suggestions() {
	document.getElementById("suggestions").style.display = 'none';
}

function wait_hide() {
	window.setTimeout('hide_suggestions()', 1000);
}
