/*
* Author:      Marco Kuiper (http://www.marcofolio.net/)
*/
//google.load("jquery", "1.3.1");
$(document).ready(function(){
	// Safely inject CSS3 and give the search results a shadow
	var cssObj = { 'box-shadow' : '#888 5px 10px 10px', // Added when CSS3 is standard
		'-webkit-box-shadow' : '#888 5px 10px 10px', // Safari
		'-moz-box-shadow' : '#888 5px 10px 10px'}; // Firefox 3.5+
	$("#suggestions").css(cssObj);
	
	// Fade out the suggestions box when not active
	 $("input").blur(function(){
	 	$('#suggestions').fadeOut();
	 });

 $('#inputString').keyup(function() {
	 var inputString = $(this).val();
	if(inputString.length == 0) {
		$('#suggestions').fadeOut(); // Hide the suggestions box
	} else {
		$.post("rpc.php", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
																	 //alert(data);
			$('#suggestions').fadeIn(); // Show the suggestions box
			$('#suggestions').html(data); // Fill the suggestions box
		});
	}
});
 
 $('#suggestions').click(function(e) {
                     e.stopPropagation();
                    });
                    $(document).click(function() {
                        $('#suggestions').fadeOut("medium");
                    });

// onclick inputbox clear



 $('#inputString').focus(function(){
  if(this.value=='auteur / illustrateur / mot du titre')
  {
	 
  this.value='';
   //$('#test').val(function(){fadeOut()});
  
  }
 });
 
 $('#inputString').blur(function(){
  if(this.value=='')
  {
	 
  this.value='auteur / illustrateur / mot du titre';
   //$('#test').val(function(){fadeOut()});
  
  }
 });

});

/*
//chargement progressif des vignettes
			$(function () {
				$('.pe_index_img').hide();//cache les images de la page
			});
		
			var i = 0;//initialisation
			var int=0;//Internet Explorer Fix
			$(window).bind("load", function() {
				var int = setInterval("doThis(i)",50);
			});
		
			function doThis() {
				var images = $('.pe_index_img').length;
				if (i >= images) {
					clearInterval(int);
				}
				$('.pe_index_img:hidden').eq(0).fadeIn(75);
				i++;
			}*/
