$(document).ready(function(){
	document.getElementById("seitensuche").setAttribute('autocomplete', 'off');		
	
	$("#seitensuche").blur(function(){
	  $("#livesearch").css("display","block");
	  //$("#livesearch").css("border","10px solid #FF0000");
    }).focusout(function(){
      //$("#livesearch").css("border","10px solid #0000FF");
	  $("#livesearch").fadeOut('slow', function() {
    		$("#livesearch").css("display","none");
	  		$("#livesearch").html();
	 		$("#livesearch").css("border","1px");
		  });
    });
});

function livesearch($q,$menue,$lang,$show_max,$scroll_top) {
	
	/*/
	// Fade out the suggestions box when not active
	$("#seitensuche").blur(function(){
									
		if($q.length=='0'){ 
	 	$("#livesearch").fadeOut('slow', function() {
    		$("#livesearch").css("display","none");
	  		$("#livesearch").html();
	 		$("#livesearch").css("border","1px");
		  });
		}
		
	  	
	 });
	/*/
	
	if($q.length=='0'){ 
	  	$("#livesearch").fadeOut('slow', function() {
    		$("#livesearch").css("display","none");
	  		$("#livesearch").html();
	 		$("#livesearch").css("border","1px");
		  });
	  return
 	}
	
	if($q>'0'){
		
		$.get("/jscripts/livesearch.php", { q: $q, menue: $menue, lang: $lang, show_max: $show_max },
		
		  function(data){
		  $("#livesearch").css("display","block");
		  $("#livesearch").html(data);
		  $("#livesearch").css("border","1px solid #dadada");
		 // $("#livesearch_content").fadeIn();
		  $("#livesearch_content").animate({'opacity':1});
		  $('#livesearch_content').scrollTop($scroll_top);
		  }
		
		);
		};
		
}
