/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();
/* -------------------------- */
/* SEARCH */
/* -------------------------- */
function autosuggest() {
q = document.getElementById('search-q').value;
// Set te random number to add to URL request
nocache = Math.random();
http.open('get', '/lib/search.php?q='+q+'&nocache = '+nocache);
http.onreadystatechange = autosuggestReply;
http.send(null);
}
function autosuggestReply() {
if(http.readyState == 4){
var response = http.responseText;
e = document.getElementById('results');
if(response!="<ul></ul>"){
e.innerHTML=response;
e.style.display="block";
} else {
e.innerHTML="Nessun risultato...";
e.style.display="block";
setTimeout("deleteNo()",2000);
}
}
}
function clean() {
document.getElementById('search-q').value = "";
}
function writeFind() {
document.getElementById('search-q').value = "Cerca un club..";
}
function deleteNo() {
window.blur();
document.getElementById('search-q').value = "Cerca un'altro club..";
e.style.display="none";
}