/*A ADAPTER*/

/*dossiers_photos = new Array('rehabilitation','rehabilitation2','amenagement');
 rehabilitation = new Array('001.jpg','003.jpg','004.jpg');
 rehabilitation2 = new Array('211.jpg','213.jpg','215.jpg','216.jpg','217.jpg','218.jpg','219.jpg','230.jpg','231.jpg','232.jpg','234.jpg') ;
 amenagement = new Array('232.jpg','234.jpg')*/ 
$(document).ready(function(){
	//$("#texte").css({overflow: "visible"});
	//$("body").css({overflow: "auto"});
	//photos = <?php echo $chaine ;?>;
	var photos = eval(dossiers_photos[0]);
	
	var dossier = dossiers_photos[0];
	
	//alert(dossier);
	indice = 0;
	html_base = '';
	html_diapo = '<p class="diapo"></p><div id="suivant"><a href="#" title="Photo suivante"><img src="img/suivant.gif"></a></div><div id="precedent"><a href="#" title="Photo précédente"><img src="img/precedent.gif"></a></div>';

/*Passer d'une image à l'autre*/	
	function change(dossier,indice){

		$("p.diapo").html('<img src="img/atelier/'+dossier+'/'+photos[indice]+'">');
		if(indice == 0){
			$("#precedent").hide();
		}
		else {$("#precedent").show();}
		if(indice == (photos.length-1)){
			$("#suivant").hide();
		}
		else {$("#suivant").show();}		
	}/**/

function voir_centre(){		
/*Déclencher les diaporamas*/		
	$("#menu_photo a").click(function(){
		photos = eval(dossiers_photos[$(this).attr('title')]);
			//alert($(this).attr('title'));
		dossier = dossiers_photos[$(this).attr('title')];
		//alert(dossier);
		indice = 0;
		
		//$("#exemples").hide();
		$("#grandes").html(html_diapo).show();///////////////////////////////////////////////////////
	
		change(dossier,indice);/////////////////////////////////////////////////
	
			$("#suivant a").click(function(){
				indice ++;
				change(dossier,indice);
				return false;
			});
			$("#precedent a").click(function(){
				indice --;
				change(dossier,indice);
				return false;
			});			
			
		return false;
	});
/*voir les exemples (4 photos)
	$("#navig_D a.a_exemple").click(function(){
		$("#diaporama").hide();
		$("#exemples").show();
		$("#exemples > div").hide();
		$("#ex_"+$(this).attr('title')).show();
	});*/
}


/*class actif*/
function class_actif(){		
	$("#navig_D a").click(function(){
		$("#navig_D a").removeClass("actif");
		$(this).addClass("actif");
	});
}
	
	
class_actif();
voir_centre();


/*anim de départ*/

//Remettre ????????????????????????????????????????????????????????????????????
//$("#menu_photo a").bind("click",function(){
	//$("#navig_D p.ph_seule").css({display:'none'}).remove();
	/*$("#navig_D").animate({left: 740,width: '170px', top: 45},1000,function(){
		$("#navig_D").css({overflow: "auto", height: '550px'});
		$("#navig_D p:visible a img").animate({width: '100px'},1000);//:visible sinon p.ph_seule réapparait
		$("#navig_D p:visible").animate({width: '100px'},1000);
		$("#navig_D p:visible").css({ height: 'auto'});		
		$("#navig_D").animate({width: '140px'},1000);
		$("#navig_D span").css({display: "inLine"});
		$("#texte").addClass("diapo");*/

		
		$("#navig_D a").unbind("click");//ne pas refaire
		//puis affichage partie centrale
		voir_centre();
		
		/*class actif*/		
		class_actif();
		
	//});
	

//});
	
	
	
	
});
