// Suche

function ajax_suche(){
  $("#ajax_suche").animate({
      height: 'hide',
			opacity: 'hide'
		}, 'slow');
  $("#ajax_suche_load").animate({
      height: 'show',
			opacity: 'show'
		}, 'fast');
  window.setTimeout('ajax_suche_2()', 500);
  return false;
}
function ajax_suche_2(){
  jQuery.post('ajax_suche.php', 'q='+escape(document.getElementById('suchquery').value), ajax_suche_3, 'json');
}
function ajax_suche_3(data, textStatus){
  if(data.resultList == "Keine Bücher gefunden.")
    document.getElementById('ajax_suche').innerHTML = 'Keine Bücher gefunden.';
  else
    document.getElementById('ajax_suche').innerHTML = data.resultList+'<br />Insgesamt '+data.resultNum+' Ergebnisse (<a href="'+data.allLink+'">Alle zeigen</a>)';
  window.setTimeout('ajax_suche_4()', 500);
}
function ajax_suche_4(){
  $("#ajax_suche_load").animate({
      height: 'hide',
			opacity: 'hide'
		}, 'fast');
  $("#ajax_suche").animate({
      height: 'show',
			opacity: 'show'
		}, 'slow');
}
