var timeouts;
function search_guugl() {
    if(timeouts) {
	window.clearTimeout(timeouts);
    }
    timeouts =  window.setTimeout("request()",1000);
}

function request() {
//document.getElementById('quugl_search_results').innerHTML="Suche läuft...";
//copy & thx 2 wikipedia :)
var xmlHttp = false;
// Mozilla, Opera, Safari sowie Internet Explorer 7
if (typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}
if (!xmlHttp) {
    // Internet Explorer 6 und älter
    try {
        xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        try {
            xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(e) {
            xmlHttp  = false;
        }
    }
}

if (xmlHttp) {
    var q = document.getElementById('guugl_ajax_query').value;
    xmlHttp.open('GET', 'guugl_ajax_search.php?q='+escape(q), true);
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4) {
	    displayResults(xmlHttp.responseText);
            //alert(xmlHttp.responseText);
        }
    };
    xmlHttp.send(null);
}
}

function displayResults(str) {
    var output =  document.getElementById('guugl_search_results');
    if(str != "") {
    output.style.display = "";
    output.innerHTML = str;
    } else {
    output.style.display="none";
    }
}