function createRequestObject() {
  var ro;
  var browser = navigator.appName;  
  if(browser == "Microsoft Internet Explorer"){
    ro = new ActiveXObject("Microsoft.XMLHTTP");
  }else{
    ro = new XMLHttpRequest();
  }
  return ro;
}
var http = createRequestObject();
function sndReq(action, a, b) {
  http.open('get', 'ajax_quicksearch.php?action=' + encodeURI(action) + '&a=' + encodeURI(a) + '&b=' + b );
  http.onreadystatechange = handleResponse;
  http.setRequestHeader('If-Modified-Since','Sat, 1 Jan 2000 00:00:00 GMT');
  http.send(null);
}

function handleResponse() {
  if(http.readyState == 4){
    var response = http.responseText;
    var update = new Array();
    if(response.indexOf('|' != -1)) {
      update = response.split('|');
			switch(update[0]){
				case "quicksearch":
					if (update[1]){
					
						html = "";
						html+= update[1];
						//html+= "<div class='qszu'><a href='javascript:zu();'>X</a></div>";
						
						document.getElementById('ajax_return_sucherg').innerHTML = html;
						document.getElementById('ajax_return_sucherg').style.display = "block";
					}else{
						
						zu();
					}
				break;				
			}
    }
  }
}
///////////////////////////////////////////////
function sw_ols_quicksearch(suche){
	if (suche.length > 2){
		sndReq('quicksearch', suche);
	}else{
		zu();
	}
}
///////////////////////////////////////////////

function qs_clean(){
	if (document.getElementById('suchfeld').value = "Suche"){
		document.getElementById('suchfeld').value = '';
	}
}

///////////////////////////////////////////////
function zu(){
	document.getElementById('ajax_return_sucherg').style.display = "none";
}
