// JavaScript Document
  function createRequestObject() {

       var req;
    
       if(window.XMLHttpRequest){
          // Firefox, Safari, Opera...
          req = new XMLHttpRequest();
       } else if(window.ActiveXObject) {
          // Internet Explorer 5+
          req = new ActiveXObject("Microsoft.XMLHTTP");
       } else {
          // There is an error creating the object,
          // just as an old browser is being used.
          alert('Problem creating the XMLHttpRequest object');
       }
    
       return req;
    
    }
    
    // Make the XMLHttpRequest object
    var http = createRequestObject();
    
    function sendRequest(q) {
    
       // Open PHP script for requests
       //http.open('get',  '/suche/results/?stype=LO&sword='+q);
       if (q.length > 1) {

          xy='stype=L0&locationData=406%3Att_content%3A682&scols=tt_content.header-bodytext-imagecaption&sword=' + q;
          http.open('get',  '/suche/results/?' + xy);	

          //http.open('post',  '/suche/results/?no_cache=1');
          //http.send('sword=' + q);
          http.onreadystatechange = handleResponse;

	//   document.getElementById("submit").src = 'searching.gif';

       http.send(null);
      }    
      else {
	document.getElementById("searchResults").style.visibility = 'hidden';
      }
    }
   

    function clearField(f){
	f.value='';
    }
 
    function handleResponse() {
    
       if (http.readyState == 4 && http.status == 200){
    
          // Text returned FROM the PHP script
          var response = http.responseText;
    
          if (response) {
             // UPDATE ajaxTest content
	     x = document.getElementById("searchResults");
             x.style.visibility = 'visible';
             x.innerHTML = response;
            // document.getElementById("submit").src = 'search.gif';
          }
    
       }
    
    }
