///////////////////////////////////////////////////////////////////////////////////

///////////////// 			INITIALISATION

///////////////////////////////////////////////////////////////////////////////////


var id_jeu1 = "gauche1"; // on initialise les variables aux div définies dans index.phtml
var id_jeu2 = "gauche2";
var id_jeu3 = "milieu";
var id_jeu4 = "droite2";
var id_jeu5 = "droite1";


$( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing");	// animation au chargement de la page
creerdiv();
creerd();
reduce_pes();

///////////////////////////////////////////////////////////////////////////////////

///////////////// 			 AU SURVOL

///////////////////////////////////////////////////////////////////////////////////

$( "#pes2011" ).mouseover(function(){ 
	if(id_jeu1 == "milieu") {
		$("#filtre3").css("opacity", 1); 
	}
	else { $( "#pe" ).css("opacity", 1);  }
});
	
$( "#pes2012" ).mouseover(function(){ 
	if(id_jeu1 == "milieu") {
		$("#filtre4").css("opacity", 1); 
	}
});

$( "#fifa11" ).mouseover(function(){ 
	if(id_jeu3 == "milieu") {
		$("#filtre").css("opacity", 1); 
	}
	else { $( "#fif" ).css("opacity", 1);  }
});
	
$( "#fifa12" ).mouseover(function(){ 
	if(id_jeu3 == "milieu") {
		$("#filtre2").css("opacity", 1); 
	}
});
				// si elle est au centre, on change l'opacité à 0.9

$( "#jeu3" ).mouseover(function(){		
	if(id_jeu3 == "milieu") {	}	

	else { $( "#fif" ).animate({ opacity: 0.8}, 100, "swing");	}	
});

$( "#jeu1" ).mouseover(function(){		
	if(id_jeu1 == "milieu") {	}	

	else { $( "#pe" ).animate({ opacity: 0.8}, 100, "swing");	}	
});

$( "#jeu2" ).mouseover(function(){		
	if(id_jeu2 == "milieu") {	$( "#starc" ).animate({ opacity: 0.9}, 100, "swing");	}	
	else { $( "#starc" ).animate({ opacity: 0.8}, 100, "swing");	}	
});

$( "#jeu4" ).mouseover(function(){		
	if(id_jeu4 == "milieu") {	$( "#hal" ).animate({ opacity: 0.9}, 100, "swing");	}	
	else { $( "#hal" ).animate({ opacity: 0.8}, 100, "swing");	}	
});

$( "#jeu5" ).mouseover(function(){	
	if(id_jeu5 == "track") {	$( "#starc" ).animate({ opacity: 0.9}, 100, "swing");	}	
	else { $( "#track" ).animate({ opacity: 0.8}, 100, "swing");	}	
});

 // quand je sors d'une image, je remets opacité à 1
 $( "#fifa11" ).mouseout(function(){ $( "#filtre" ).animate({ opacity: 0},100);  });
  $( "#fifa12" ).mouseout(function(){ $( "#filtre2" ).animate({ opacity: 0},100);  });
   $( "#pes2011" ).mouseout(function(){ $( "#filtre3" ).animate({ opacity: 0},100);  });
  $( "#pes2012" ).mouseout(function(){ $( "#filtre4" ).animate({ opacity: 0},100);  });
   $( "#jeu3" ).mouseout(function(){ $( "#fif" ).animate({ opacity: 1},100); });
 $( "#jeu1" ).mouseout(function(){ $( "#pe" ).animate({ opacity: 1},100); });
$( "#jeu2" ).mouseout(function(){ $( "#starc" ).animate({ opacity: 1},100); });
$( "#jeu4" ).mouseout(function(){ $( "#hal" ).animate({ opacity: 1},100); });
$( "#jeu5" ).mouseout(function(){ $( "#track" ).animate({ opacity: 1},100); });





///////////////////////////////////////////////////////////////////////////////////

///////////////// 			 MOUVEMENT

///////////////////////////////////////////////////////////////////////////////////

$( "#jeu2" ).click(function(){
	


	
$( "#cliqueici" ).animate({opacity: 0}, 100,function() { $( "#cliqueici" ).animate( {"top": "+=10px" }); });
$( "#cliqueici img" ).attr("src", "media/images/game/bandeau.png");
affiche_starcraft();
hide_all_except_one($('#stats_starcraft'));
reduce_fifa();
reduce_pes();
	
	if(id_jeu2 == "gauche1") {
	
	

		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
	
  		$( "#jeu1" ).animate( {"left": "-=702px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									("#jeu1").attr("class", "c_gauche2"); }  );  
  		$( "#jeu2" ).animate( {"left": "+=202px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu2").attr("class", "c_milieu"); }  );  
  		$( "#jeu3" ).animate( {"left": "+=342px", "top": "+=0px", "height" : "92px", "width" : "141px"}, 1000, function() { $( "#jeu3" ).attr("class", "c_droite2"); }  );  
  		$( "#languette" ).animate( {"left": "-=227px" } );  
  		$( "#jeu4" ).animate( {"left": "+=342px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $									("#jeu4").attr("class", "c_droite1"); }  );
  		$( "#jeu5" ).animate( {"left": "-=702px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $ ( "#jeu5" ).attr("class", "c_gauche1"); }  );
		$( "#cliqueici" ).animate( {"left": "-=227px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );
	    
		id_jeu1 = "gauche2";
	    id_jeu2 = "milieu";
	    id_jeu3 = "droite2";
	    id_jeu4 = "droite1";
	    id_jeu5 = "gauche1";
 		

 		
 		return true;

	}	
	
	if(id_jeu2 == "gauche2") {

		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		
 		$( "#jeu1" ).animate( {"left": "+=101px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $								("#jeu1").attr("class", "c_gauche2"); }  );  
		$( "#jeu2" ).animate( {"left": "+=101px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu2").attr("class", "c_milieu"); }  );  
  		$( "#jeu3" ).animate( {"left": "+=241px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu3" ).attr("class", "c_droite2"); }  );  
  		$( "#languette" ).animate( {"left": "-=32px" } );
  		$( "#jeu4" ).animate( {"left": "+=101px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $								("#jeu4").attr("class", "c_droite1"); }  );
  		$( "#jeu5" ).animate( {"left": "-=803px"}, 1000, function() { $( "#jeu5" ).attr("class", "c_gauche1"); }  );
		$( "#cliqueici" ).animate( {"left": "-=32px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );
  
	    id_jeu1 = "gauche2";
	    id_jeu2 = "milieu";
	    id_jeu3 = "droite2";
	    id_jeu4 = "droite1";
	    id_jeu5 = "gauche1";
 	
 		return true;

	}

	if(id_jeu2 == "milieu") {	location.href = "/home?game=5" ; }

	if(id_jeu2 == "droite2") {

		$ ( "#jeu3" ).attr("class", "c_droite2");	
		$ ( "#jeu4" ).attr("class", "c_droite1");
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );

		
 		$( "#jeu1" ).animate( {"left": "-=133px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $								("#jeu1").attr("class", "c_gauche2"); }  );  
		$( "#jeu2" ).animate( {"left": "-=273px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu2").attr("class", "c_milieu"); }  );  
  		$( "#jeu3" ).animate( {"left": "-=133px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu3" ).attr("class", "c_droite2"); }  );  
  		$( "#languette" ).animate( {"left": "-=32px" } );
  		$( "#jeu4" ).animate( {"left": "+=771px"}, 1000, function() { $	("#jeu4").attr("class", "c_droite1"); }  );
  		$( "#jeu5" ).animate( {"left": "-=133px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $									( "#jeu5" ).attr("class", "c_gauche1"); }  );
		$( "#cliqueici" ).animate( {"left": "-=32px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );  
	   
	   id_jeu1 = "gauche2";
	    id_jeu2 = "milieu";
	    id_jeu3 = "droite2";
	    id_jeu4 = "droite1";
	    id_jeu5 = "gauche1";
 	
 		return true;

	}

	if(id_jeu2 == "droite1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		$ ( "#jeu2" ).attr("class", "c_milieu");
		$ ( "#jeu3" ).attr("class", "c_droite2");
		$ ( "#jeu4" ).attr("class", "c_droite1");
		$ ( "#jeu1" ).attr("class", "c_gauche2");
		$ ( "#jeu5" ).attr("class", "c_gauche1");
		
 		$( "#jeu1" ).animate( {"left": "-=569px", "height" : "92px", "width" : "141px"}, 1000, function() { $("#jeu1").attr("class", "c_gauche2"); }  );  
		$( "#jeu2" ).animate( {"left": "-=569px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $("#jeu2").attr("class", "c_milieu"); }  );  
  		$( "#jeu3" ).animate( {"left": "+=475px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $( "#jeu3" ).attr("class", "c_droite2"); }  ); 
		$( "#jeu4" ).animate( {"left": "+=475px", "top": "+=8px", "height" : "71px", "width" : "109px"} , 1000, function() { $( "#jeu4" ).attr("class", "c_droite1"); }  ); 
  		$( "#jeu5" ).animate( {"left": "-=429px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $("#jeu5").attr("class", "c_gauche1"); }  );
 		$( "#languette" ).animate( {"left": "-=227px" } );
 		$( "#cliqueici" ).animate( {"left": "-=227px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );
 
	    id_jeu1 = "gauche2";
	    id_jeu2 = "milieu";
	    id_jeu3 = "droite2";
	    id_jeu4 = "droite1";
	    id_jeu5 = "gauche1";
 	
 		return true;

	}
 
  
});

/////////////////////////////////////////////////

$( "#jeu1" ).click(function(){
	
$( "#cliqueici" ).animate({opacity: 0}, 100,function() { $( "#cliqueici" ).animate( {"top": "+=10px" }); });
$( "#cliqueici img" ).attr("src", "media/images/game/bandeau.png");	
affiche_pes();
hide_all_except_one($('#stats_pes'));
reduce_fifa();
taille_pes();
	
	if(id_jeu1 == "gauche1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		
		$( "#jeu1" ).animate( {"left": "+=234px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu1").attr("class", "c_milieu"); }  );  
  		$( "#jeu2" ).animate( {"left": "+=374px"}, 1000, function() { $	( "#jeu2" ).attr("class", "c_droite2"); }  );  
  		$( "#jeu3" ).animate( {"left": "+=374px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $								("#jeu3").attr("class", "c_droite1"); }  );
  		$( "#jeu4" ).animate( {"left": "-=670px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $ ( "#jeu4" ).attr("class", "c_gauche1"); }  );
  		$( "#jeu5" ).animate( {"left": "-=670px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									("#jeu5").attr("class", "c_gauche2"); }  );  
		$( "#cliqueici" ).animate( {"left": "+=0px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );	  
	   
		id_jeu1 = "milieu";
	    id_jeu2 = "droite2";
	    id_jeu3 = "droite1";
	    id_jeu4 = "gauche1";
	    id_jeu5 = "gauche2";
 		creerd();
 		return true;

	}	
	
	if(id_jeu1 == "gauche2") {
	

		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
 		
		$( "#jeu1" ).animate( {"left": "+=133px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $("#jeu1").attr("class", "c_milieu"); }  );  
  		$( "#jeu2" ).animate( {"left": "+=273px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $( "#jeu2" ).attr("class", "c_droite2"); }  );  
  		$( "#jeu3" ).animate( {"left": "+=133px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $("#jeu3").attr("class", "c_droite1"); }  );
  		$( "#jeu4" ).animate( {"left": "-=771px"}, 1000, function() { $( "#jeu4" ).attr("class", "c_gauche1"); }  );
	    $( "#jeu5" ).animate( {"left": "+=133px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $("#jeu5").attr("class", "c_gauche2"); }  );  
		$( "#languette" ).animate( {"left": "+=32px" } );
		$( "#cliqueici" ).animate( {"left": "+=32px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );
		
		id_jeu1 = "milieu";
	    id_jeu2 = "droite2";
	    id_jeu3 = "droite1";
	    id_jeu4 = "gauche1";
	    id_jeu5 = "gauche2";
 	
 		return true;

	}

	if(id_jeu1 == "droite2") {
		
		$ ( "#jeu2" ).attr("class", "c_droite2");
		$ ( "#jeu3" ).attr("class", "c_droite1");
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );

		$( "#jeu1" ).animate( {"left": "-=436px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu1").attr("class", "c_milieu"); }  );  
  		$( "#jeu2" ).animate( {"left": "-=296px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu2" ).attr("class", "c_droite2"); }  );  
		$( "#jeu3" ).animate( {"left": "+=608px"}, 1000, function() { $	("#jeu3").attr("class", "c_droite1"); }  );
  		$( "#jeu4" ).animate( {"left": "-=296px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $									( "#jeu4" ).attr("class", "c_gauche1"); }  );
  		$( "#jeu5" ).animate( {"left": "-=296px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $								("#jeu5").attr("class", "c_gauche2"); }  );  
  		$( "#languette" ).animate( {"left": "-=195px" } );
		$( "#cliqueici" ).animate( {"left": "-=195px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );	   
	
		id_jeu1 = "milieu";
	    id_jeu2 = "droite2";
	    id_jeu3 = "droite1";
	    id_jeu4 = "gauche1";
 		id_jeu5 = "gauche2";
 		
 		return true;

	}

	if(id_jeu1 == "droite1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		$ ( "#jeu1" ).attr("class", "c_milieu");
		$ ( "#jeu2" ).attr("class", "c_droite2");
		$ ( "#jeu3" ).attr("class", "c_droite1");
		$ ( "#jeu5" ).attr("class", "c_gauche2");
		$ ( "#jeu4" ).attr("class", "c_gauche1");

		$( "#jeu1" ).animate( {"left": "-=569px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $  ("#jeu1").attr("class", "c_milieu"); }  );  
  		$( "#jeu2" ).animate( {"left": "+=475px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $	( "#jeu2" ).attr("class", "c_droite2"); }  );  		
		$( "#jeu3" ).animate( {"left": "+=475px", "top": "+=8px", "height" : "71px", "width" : "109px"} , 1000, function() { $ 	( "#jeu3" ).attr("class", "c_droite1"); }  ); 
  		$( "#jeu4" ).animate( {"left": "-=429px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $	("#jeu4").attr("class", "c_gauche1"); }  );
 		$( "#jeu5" ).animate( {"left": "-=569px", "height" : "92px", "width" : "141px"}, 1000, function() { $	("#jeu5").attr("class", "c_gauche2"); }  );  
 		$( "#languette" ).animate( {"left": "-=195px" } );
		$( "#cliqueici" ).animate( {"left": "-=195px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );

	    id_jeu5 = "gauche2";
	    id_jeu1 = "milieu";
	    id_jeu2 = "droite2";
	    id_jeu3 = "droite1";
	    id_jeu4 = "gauche1";
 	
 		return true;

	}
  
});


//////////////////////////////////////


$( "#jeu4" ).click(function(){
	
	
$( "#cliqueici" ).animate({opacity: 0}, 100,function() { $( "#cliqueici" ).animate( {"top": "+=10px" }); });
$( "#cliqueici img" ).attr("src", "media/images/game/bandeau.png");	

affiche_halo();  // on affiche les infos halo dans le how it works
hide_all_except_one($('#stats_halo'));	// on affiche que les infos de halo dans les languettes 
reduce_fifa();	
reduce_pes();
	
	if(id_jeu4 == "gauche1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );		
  		
  		$( "#jeu1" ).animate( {"left": "+=569px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $								("#jeu1").attr("class", "c_droite1"); }  );
  		$( "#jeu2" ).animate( {"left": "-=475px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $
  			( "#jeu2" ).attr("class", "c_gauche1"); }  );
  		$( "#jeu3" ).animate( {"left": "-=475px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									("#jeu3").attr("class", "c_gauche2"); }  );  
  		$( "#jeu4" ).animate( {"left": "+=429px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu4").attr("class", "c_milieu"); }  );  
  		$( "#jeu5" ).animate( {"left": "+=569px"}, 1000, function() { $( "#jeu5" ).attr("class", "c_droite2"); }  );  
  		$( "#languette" ).animate( {"left": "+=195px" } );  
		$( "#cliqueici" ).animate( {"left": "+=195px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );  

	    id_jeu1 = "droite1";
	    id_jeu2 = "gauche1";
	    id_jeu3 = "gauche2";
	    id_jeu4 = "milieu";
	    id_jeu5 = "droite2";
 	
 		return true;

	}	
	
	if(id_jeu4 == "gauche2") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		
 		$( "#jeu3" ).animate( {"left": "+=133px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $								("#jeu3").attr("class", "c_gauche2"); }  );  
		$( "#jeu4" ).animate( {"left": "+=133px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu4").attr("class", "c_milieu"); }  );  
  		$( "#jeu5" ).animate( {"left": "+=273px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu5" ).attr("class", "c_droite2"); }  );  
  		$( "#jeu1" ).animate( {"left": "+=133px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $								("#jeu1").attr("class", "c_droite1"); }  );
  		$( "#jeu2" ).animate( {"left": "-=771px"}, 1000, function() { $( "#jeu2" ).attr("class", "c_gauche1"); }  );
		$( "#cliqueici" ).animate( {"left": "+=0px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );	 
	  
		id_jeu1 = "droite1";
	    id_jeu2 = "gauche1";  
	    id_jeu3 = "gauche2";
	    id_jeu4 = "milieu";
	    id_jeu5 = "droite2";
	     	
 		return true;

	}

	if(id_jeu4 == "milieu") {	location.href = "/home?game=6" ; }

	if(id_jeu4 == "droite2") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		$ ( "#jeu1" ).attr("class", "c_droite1");
		$ ( "#jeu5" ).attr("class", "c_droite2");

		$( "#jeu1" ).animate( {"left": "+=803px" } , 1000, function() { $ ( "#jeu1" ).attr("class", "c_droite1"); }  ); 
  		$( "#jeu2" ).animate( {"left": "-=101px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $("#jeu2").attr("class", "c_gauche1"); }  );
 		$( "#jeu3" ).animate( {"left": "-=101px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $("#jeu3").attr("class", "c_gauche2"); }  );  
		$( "#jeu4" ).animate( {"left": "-=241px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $("#jeu4").attr("class", "c_milieu"); }  );  
  		$( "#jeu5" ).animate( {"left": "-=101px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $( "#jeu5" ).attr("class", "c_droite2"); }  );  
 		$( "#languette" ).animate( {"left": "+=195px" } ); 
		$( "#cliqueici" ).animate( {"left": "+=195px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );		
	   
	   id_jeu1 = "droite1";
	    id_jeu2 = "gauche1";
	    id_jeu3 = "gauche2";
	    id_jeu4 = "milieu";
	    id_jeu5 = "droite2";
 	
 		return true;

	}

	if(id_jeu4 == "droite1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		$ ( "#jeu4" ).attr("class", "c_milieu");
		$ ( "#jeu5" ).attr("class", "c_droite2");
		$ ( "#jeu1" ).attr("class", "c_droite1");
		$ ( "#jeu3" ).attr("class", "c_gauche2");
		$ ( "#jeu2" ).attr("class", "c_gauche1");
		
		$( "#jeu1" ).animate( {"left": "+=702px", "top": "+=8px", "height" : "71px", "width" : "109px"} , 1000, function() { $ 										( "#jeu1" ).attr("class", "c_droite1"); }  ); 
  		$( "#jeu2" ).animate( {"left": "-=202px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $										("#jeu2").attr("class", "c_gauche1"); }  );
 		$( "#jeu3" ).animate( {"left": "-=342px", "height" : "92px", "width" : "141px"}, 1000, function() { $														("#jeu3").attr("class", "c_gauche2"); }  );  
 		$( "#languette" ).animate( {"left": "+=227px" } );
		$( "#jeu4" ).animate( {"left": "-=342px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $									("#jeu4").attr("class", "c_milieu"); }  );  
  		$( "#jeu5" ).animate( {"left": "+=702px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu5" ).attr("class", "c_droite2"); }  );  
		$( "#cliqueici" ).animate( {"left": "+=227px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );  		
  		
	    id_jeu1 = "droite1";
	    id_jeu2 = "gauche1";
	    id_jeu3 = "gauche2";
	    id_jeu4 = "milieu";
	    id_jeu5 = "droite2";
 	
 		return true;

	}

});


///////////////////////////////



$( "#jeu3" ).click(function(){
	
$( "#cliqueici" ).animate({opacity: 0}, 100,function() { $( "#cliqueici" ).animate( {"top": "+=10px" }); });	

$( "#cliqueici img" ).attr("src", "media/images/game/bandeau.png");
affiche_fifa();  // on affiche les infos fifa dans le how it works
hide_all_except_one($('#stats_fifa'));	// on affiche que les infos de fifa dans les languettes 
taille_fifa();
reduce_pes();

	if(id_jeu3 == "gauche1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
	  	$( "#jeu1" ).animate( {"left": "-=670px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $  ( "#jeu1" ).attr("class", "c_gauche1"); }  );
  		$( "#jeu2" ).animate( {"left": "-=670px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									("#jeu2").attr("class", "c_gauche2"); }  );  
  		$( "#jeu3" ).animate( {"left": "+=234px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu3").attr("class", "c_milieu"); }  );  
  		$( "#jeu4" ).animate( {"left": "+=374px", "top": "+=0px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu4" ).attr("class", "c_droite2"); }  );  
  		$( "#languette" ).animate( {"left": "-=195px" } );  
  		$( "#jeu5" ).animate( {"left": "+=374px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $									("#jeu5").attr("class", "c_droite1"); }  );
		$( "#cliqueici" ).animate( {"left": "-=195" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );
  		
 	    id_jeu1 = "gauche1"; 
	    id_jeu2 = "gauche2";
	    id_jeu3 = "milieu";
	    id_jeu4 = "droite2";
	    id_jeu5 = "droite1";
 	
 		return true;

	}	
	
	if(id_jeu3 == "gauche2") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
 	
 		$( "#jeu2" ).animate( {"left": "+=101px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $								("#jeu2").attr("class", "c_gauche2"); }  );  
		$( "#jeu3" ).animate( {"left": "+=101px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu3").attr("class", "c_milieu"); }  );  
  		$( "#jeu4" ).animate( {"left": "+=241px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu4" ).attr("class", "c_droite2"); }  );  
  		$( "#languette" ).animate( {"left": "-=195px" } );
  		$( "#jeu5" ).animate( {"left": "+=101px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $								("#jeu5").attr("class", "c_droite1"); }  );
  		$( "#jeu1" ).animate( {"left": "-=803px"}, 1000, function() { $( "#jeu1" ).attr("class", "c_gauche1"); }  );
		$( "#cliqueici" ).animate( {"left": "-=195px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );
  
 	    id_jeu1 = "gauche1"; 
	    id_jeu2 = "gauche2";
	    id_jeu3 = "milieu";
	    id_jeu4 = "droite2";
	    id_jeu5 = "droite1";
 	
 		return true;

	}



	if(id_jeu3 == "droite2") {
	
		$ ( "#jeu4" ).attr("class", "c_droite2");
		$ ( "#jeu5" ).attr("class", "c_droite1");
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );

		
 		$( "#jeu2" ).animate( {"left": "-=101px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $								("#jeu2").attr("class", "c_gauche2"); }  );  
		$( "#jeu3" ).animate( {"left": "-=241px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu3").attr("class", "c_milieu"); }  );  
  		$( "#jeu4" ).animate( {"left": "-=101px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu4" ).attr("class", "c_droite2"); }  );  
  		$( "#languette" ).animate( {"left": "+=32px" } );
  		$( "#jeu5" ).animate( {"left": "+=803px"}, 1000, function() { $	("#jeu5").attr("class", "c_droite1"); }  );
  		$( "#jeu1" ).animate( {"left": "-=101px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $									( "#jeu1" ).attr("class", "c_gauche1"); }  );
		$( "#cliqueici" ).animate( {"left": "+=32px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );  
 	  
		id_jeu1 = "gauche1"; 
	    id_jeu2 = "gauche2";
	    id_jeu3 = "milieu";
	    id_jeu4 = "droite2";
	    id_jeu5 = "droite1";
 	
 		return true;

	}

	if(id_jeu3 == "droite1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		$ ( "#jeu3" ).attr("class", "c_milieu");
		$ ( "#jeu4" ).attr("class", "c_droite2");
		$ ( "#jeu5" ).attr("class", "c_droite1");
		$ ( "#jeu2" ).attr("class", "c_gauche2");
		$ ( "#jeu1" ).attr("class", "c_gauche1");
		
		$( "#jeu5" ).animate( {"left": "+=670px", "top": "+=8px", "height" : "71px", "width" : "109px"} , 1000, function() { $ 										( "#jeu5" ).attr("class", "c_droite1"); }  ); 
  		$( "#jeu1" ).animate( {"left": "-=234px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $										("#jeu1").attr("class", "c_gauche1"); }  );
 		$( "#jeu2" ).animate( {"left": "-=374px", "height" : "92px", "width" : "141px"}, 1000, function() { $														("#jeu2").attr("class", "c_gauche2"); }  ); 	
		$( "#jeu3" ).animate( {"left": "-=374px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $									("#jeu3").attr("class", "c_milieu"); }  );  
  		$( "#jeu4" ).animate( {"left": "+=670px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu4" ).attr("class", "c_droite2"); }  ); 
		$( "#cliqueici" ).animate( {"left": "+=0px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );	 
 	
		id_jeu1 = "gauche1"; 
	    id_jeu2 = "gauche2";
	    id_jeu3 = "milieu";
	    id_jeu4 = "droite2";
	    id_jeu5 = "droite1";
 	
 		return true;

	}
  
});

/////////////////////////////////////////////////////////


$( "#jeu5" ).click(function(){
	
$( "#cliqueici" ).animate({opacity: 0}, 100,function() { $( "#cliqueici" ).animate( {"top": "+=10px" }); });	
affiche_trackmania();
hide_all_except_one($('#stats_trackmania'));	// on affiche que les infos de halo dans les languettes 
$('#accroche').hide(200);
reduce_fifa();
reduce_pes();

	if(id_jeu5 == "gauche1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );		
  		

  		$( "#jeu1" ).animate( {"left": "+=569px", "top": "+=0px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu1" ).attr("class", "c_droite2"); }  );  
  		$( "#jeu2" ).animate( {"left": "+=569px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $								("#jeu2").attr("class", "c_droite1"); }  );
  		$( "#jeu3" ).animate( {"left": "-=475px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $
  			( "#jeu3" ).attr("class", "c_gauche1"); }  );
  		$( "#jeu4" ).animate( {"left": "-=475px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									("#jeu4").attr("class", "c_gauche2"); }  );  
  		$( "#jeu5" ).animate( {"left": "+=429px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu5").attr("class", "c_milieu"); }  ); 
  		$( "#languette" ).animate( {"left": "+=227px" } );  
		$( "#cliqueici" ).animate( {"left": "+=227px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );  
	 
		id_jeu1 = "droite2";
	    id_jeu2 = "droite1";
	    id_jeu3 = "gauche1";
	    id_jeu4 = "gauche2";
	    id_jeu5 = "milieu";
	    
 		return true;

	}	
	
	if(id_jeu5 == "gauche2") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		
  		$( "#jeu1" ).animate( {"left": "+=436px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $( "#jeu1" ).attr("class", "c_droite2"); }  );  
  		$( "#jeu2" ).animate( {"left": "+=296px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $("#jeu2").attr("class", "c_droite1"); }  );
  		$( "#jeu3" ).animate( {"left": "-=608px"}, 1000, function() { $( "#jeu3" ).attr("class", "c_gauche1"); }  );
 		$( "#jeu4" ).animate( {"left": "+=296px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $("#jeu4").attr("class", "c_gauche2"); }  );  
		$( "#jeu5" ).animate( {"left": "+=296px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $("#jeu5").attr("class", "c_milieu"); }  );  
		$( "#languette" ).animate( {"left": "+=195px" } );  
		$( "#cliqueici" ).animate( {"left": "+=195px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );
  		
		id_jeu1 = "droite2";
	    id_jeu2 = "droite1";
	    id_jeu3 = "gauche1";
	    id_jeu4 = "gauche2";
	    id_jeu5 = "milieu";
	     	
 		return true;

	}

	if(id_jeu5 == "milieu") {  
		
		$( "#cliqueici" ).animate( { opacity: 0, top: "10px" },400, "swing", function () {
			$( "#cliqueici img" ).attr("src", "media/images/game/bandeau2.png");
			$( "#cliqueici" ).animate( { opacity: 1, top: "-10px" },400, "swing");
			
			 } );
		
		 }

	if(id_jeu5 == "droite2") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		$ ( "#jeu2" ).attr("class", "c_droite1");
		$ ( "#jeu1" ).attr("class", "c_droite2");

		$( "#jeu2" ).animate( {"left": "+=771px" } , 1000, function() { $ ( "#jeu2" ).attr("class", "c_droite1"); }  ); 
  		$( "#jeu3" ).animate( {"left": "-=133px", "top": "+=8px", "height" : "71px", "width" : "109px"}, 1000, function() { $								("#jeu3").attr("class", "c_gauche1"); }  );
 		$( "#jeu4" ).animate( {"left": "-=133px", "top": "+=92px", "height" : "92px", "width" : "141px"}, 1000, function() { $								("#jeu4").attr("class", "c_gauche2"); }  );  
		$( "#jeu5" ).animate( {"left": "-=273px", "top": "-=92px", "height" : "198px", "width" : "304px"},  1000, function() { $								("#jeu5").attr("class", "c_milieu"); }  );  
  		$( "#jeu1" ).animate( {"left": "-=133px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $									( "#jeu1" ).attr("class", "c_droite2"); }  );  
		$( "#cliqueici" ).animate( {"left": "+=0px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );	
		
  		id_jeu1 = "droite2";
	    id_jeu2 = "droite1";
	    id_jeu3 = "gauche1";
	    id_jeu4 = "gauche2";
	    id_jeu5 = "milieu";
 	
 		return true;

	}

	if(id_jeu5 == "droite1") {
	
		$( "#indiv" ).hide(500, function() { $( "#indiv" ).show(500); } );
		$( "#tournoi" ).hide(500, function() { $( "#tournoi" ).show(500); } );
		$ ( "#jeu5" ).attr("class", "c_milieu");
		$ ( "#jeu1" ).attr("class", "c_droite2");
		$ ( "#jeu2" ).attr("class", "c_droite1");
		$ ( "#jeu4" ).attr("class", "c_gauche2");
		$ ( "#jeu3" ).attr("class", "c_gauche1");
  		
		$( "#jeu1" ).animate( {"left": "+=670px", "top": "-=8px", "height" : "92px", "width" : "141px"}, 1000, function() { $( "#jeu1" ).attr("class", "c_droite2"); }  ); 
		$( "#jeu2" ).animate( {"left": "+=670px", "top": "+=8px", "height" : "71px", "width" : "109px"} , 1000, function() { $( "#jeu2" ).attr("class", "c_droite1"); }  ); 
  		$( "#jeu3" ).animate( {"left": "-=234px", "top": "+=100px", "height" : "71px", "width" : "109px"}, 1000, function() { $("#jeu3").attr("class", "c_gauche1"); }  );
 		$( "#jeu4" ).animate( {"left": "-=374px"}, 1000, function() { $("#jeu4").attr("class", "c_gauche2"); }  );  
		$( "#jeu5" ).animate( {"left": "-=374px", "top": "-=100px", "height" : "198px", "width" : "304px"},  1000, function() { $("#jeu5").attr("class", "c_milieu"); }  );  
  		$( "#languette" ).animate( {"left": "+=195px" } );
		$( "#cliqueici" ).animate( {"left": "+=195px" },200, function() { $( "#cliqueici" ).animate({ opacity: 1, top: "-10px" },400, "swing"); } );	
  	
		id_jeu1 = "droite2";
	    id_jeu2 = "droite1";
	    id_jeu3 = "gauche1";
	    id_jeu4 = "gauche2";
	    id_jeu5 = "milieu";
 	
 		return true;

	}
  
});


function affiche_halo() {
$('#left_text_1').text("Qui veut jouer à Halo pour 5€ ?");
$('#info_console').text("Sur votre Xbox360");
$('#top_text_2').text("Le match se joue sur votre console");
$('#top_text_2').css("text-align","center");

$('#affichage_lieu').attr("src","media/images/background/console.png");
$('#affichage_lieu').attr("class","xbox");
}

function affiche_pes() {
$('#left_text_1').text("Qui veut jouer à PES pour 5€ ?");
$('#info_console').text("Sur votre PS3 ou Xbox360");
$('#top_text_2').text("Le match se joue sur votre console");
$('#top_text_2').css("text-align","center");

$('#affichage_lieu').attr("src","media/images/background/console.png");
$('#affichage_lieu').attr("class","xbox");
}

function affiche_trackmania() {
$('#left_text_1').text("Qui veut jouer à TM pour 5€ ?");
$('#info_console').text("Sur nos serveurs TM en ligne");

$('#top_text_2').text("La course se déroule sur nos serveurs TM");
$('#top_text_2').css("text-align","center");

$('#affichage_lieu').attr("src","media/images/background/logo-trackmania2.png");
$('#affichage_lieu').attr("class","tm");
}

function affiche_fifa() {
$('#left_text_1').text("Qui veut jouer à FIFA pour 5€ ?");
$('#info_console').text("Sur votre PS3 ou Xbox360");
$('#top_text_2').text("Le match se joue sur votre console");
$('#top_text_2').css("text-align","center");

$('#affichage_lieu').attr("src","media/images/background/console.png");
$('#affichage_lieu').attr("class","xbox");
}

function affiche_starcraft() {
$('#left_text_1').text("Qui veut jouer à SC II pour 5€ ?");
$('#info_console').text("Sur le réseau battle.net");

$('#top_text_2').text("Le match se joue sur battle.net");
$('#top_text_2').css("text-align","center");
$('#affichage_lieu').attr("src","media/images/background/logo-battlenet.png");
$('#affichage_lieu').attr("class","battlenet");
}


function hide_all_except_one(thegame) {
	
$('#stats_fifa').hide(200); // par défaut on cache tous les informations
$('#stats_pes').hide(200);
$('#stats_starcraft').hide(200);
$('#stats_halo').hide(200);
$('#stats_trackmania').hide(200);

$(thegame).show(400);

}

function creerdiv(){
		$("#jeu3").prepend("<div id='fifa11'><!--[if !IE]><!--><img id='filtre' src='media/images/background/filtre.png'><!--><![endif]--></div><div id='fifa12'><!--[if !IE]><!--><img id='filtre2' class='filtre22' src='media/images/background/filtre.png'><!--><![endif]--></div>");
}

	
function creerd(){
		$("#jeu1").prepend("<div id='pes2011'><!--[if !IE]><!--><img id='filtre3' src='media/images/background/filtre.png'><!--><![endif]--></div><div id='pes2012'><!--[if !IE]><!--><img id='filtre4' src='media/images/background/filtre.png'><!--><![endif]--></div>");

}

function reduce_fifa(){
	$("#fifa11").css("height", 0);
	$("#fifa11").css("width", 0);
	$("#fifa12").css("height", 0);
	$("#fifa12").css("width", 0);
	$("#fifa12").css("margin-left", 1200);	
}

function reduce_pes(){
	$("#pes2011").css("height", 0);
	$("#pes2011").css("width", 0);
	$("#pes2012").css("height", 0);
	$("#pes2012").css("width", 0);
	$("#pes2012").css("margin-left", 0);	
}

function taille_fifa(){
	$("#fifa11").css("height", 200);
	$("#fifa11").css("width", 150);
	$("#fifa12").css("height", 200);
	$("#fifa12").css("width", 150);
	$("#fifa12").css("margin-left", 150);	
	}
	
function taille_pes(){
	$("#pes2011").css("height", 200);
	$("#pes2011").css("width", 150);
	$("#pes2012").css("height", 200);
	$("#pes2012").css("width", 150);
	$("#pes2012").css("margin-left", 150);	
	}

$("#fifa11").click(function(){
	location.href = "/home?game=3"	
	}
);

$("#fifa12").click(function(){
	location.href = "/home?game=7"	
	}
);

$("#pes2011").click(function(){
	location.href = "/home?game=4"	
	}
);

$("#pes2012").click(function(){
	location.href = "/home?game=8"	
	}
);


//fin de la déclaration de la fonction globale servant à attendre que tous les éléments sont chargés

