$(document).ready(function(){

	/* slider */
	$('a#howwork').click(function(){
		
		$('figure#iphone').animate({top:'500px',opacity:0},200,'easeInQuint',function(){
			$('figure#htc-desire').animate({top:'500px',opacity:0},200,'easeInQuint',function(){
			  $('figure#screen').animate({top:'500px',opacity:0},200,'easeInQuint',function(){
			      $('figure#ballon').animate({top:'500px',opacity:0},200,'easeInQuint',function(){
			          $('a#howwork').animate({top:'500px',opacity:0},200,'easeInQuint',function(){
						  $('h1#presentation').animate({top:'500px',opacity:0},200,'easeInQuint',function(){
			                 $('div#slider-how-it-works').animate({left:'0px',opacity:1}, 500 );
		                  });
		                });
		            });
		        });
		    });
		});

	  return false;
	});
	
	/* auto complete pour les villes */
	$("#city").autocomplete({ url: "ville.php", minChars: 2});
	/* protection iframe */
	if (top != self) {
      top.location.href = 'http://www.dribbleur.com/';
    }
	/* detection du pseudo et test */
	$('input#login').keydown(function(event) {
	  if (event.which == '13') {
		 event.preventDefault();
	   }
	 $.ajax({
		type: "POST",
         url: "../php/_pseudo_ok.php",
		 data: "pseudo="+$(this).val(),
         complete: function(msg){
		   $('input#login').addClass(msg.responseText);
		 }
     });
	}).blur(function(){
	 $.ajax({
		type: "POST",
         url: "../php/_pseudo_ok.php",
		 data: "pseudo="+$(this).val(),
         complete: function(msg){
		   $('input#login').addClass(msg.responseText);
		 }
     });		
	});
});
