// JavaScript Document




jQuery(document).ready(function()
{
//Stockage des visuels 						   
var tabImage = new Array();
tabImage[0] = "/images/fd_site_1.jpg";
tabImage[1] = "/images/fd_site_2.jpg";
tabImage[2] = "/images/fd_site_3.jpg";

var nbVisuel = tabImage.length;

//Prechargement
var visuel1 = new Image();
visuel1.src="/images/fd_site_1.jpg";
var visuel2 = new Image();
visuel2.src="/images/fd_site_2.jpg";
var visuel3 = new Image();
visuel3.src="/images/fd_site_3.jpg";

//Visuels de départ
var index = 0;
var diapoActif = 1; //diapo visible : 1 ou 0

jQuery("#diapo_1").attr("src",tabImage[0]);
jQuery("#diapo_0").attr("src",tabImage[1]);
						   
var enAction = false;
  
   jQuery("#btn_prec").click(function(){
		//clearTimeout(diapoAuto);			
		if(enAction==false)
			{						 
							 
				index--;
				if(index==-1){index=nbVisuel-1;}	
				
				fondu();
			}
		});
   
   jQuery("#btn_suiv").click(function()
		{
			//clearTimeout(diapoAuto);
			if(enAction==false)
			{
					
				index++;
				if(index==nbVisuel){index=0;}	
			
				fondu();
			}
		}
		);
   
   
   
   
   
   function fondu()
   {
	    if(enAction==false)
		{
			enAction = true;	
			if(diapoActif==1)
				{
					jQuery("#diapo_0").attr("src",tabImage[index]);
					jQuery("#diapo_1").fadeOut("slow", function() {
						//alert("relance1");
						enAction = false;
						
						/*if(!diapoAuto && enAction==false)
							{
							relanceDiapoAuto()
							}*/
					  });
					diapoActif=0;
				}
				else
					{
						jQuery("#diapo_1").attr("src",tabImage[index]);
						jQuery("#diapo_1").fadeIn("slow", function() {
							//alert("relance2");
							enAction = false;
							/*if(!diapoAuto && enAction==false)
							{
								//relanceDiapoAuto()
							}*/
						  });
	
						diapoActif=1;
					}  
		}
   }
   
      

   
 }
 );

