var diapo = 1;
var repere = 1;



$(document).ready(function(){
	 document.getElementById('lnkbrochure').onclick=function(){this.target="_blank"};
	 document.getElementById('lnkconcession').onclick=function(){this.target="_blank"};
						   
	 $('#spa').each(function() {
     var cc = $(this).attr("class");
	 $(this).html("<img src='images/"+cc+".jpg' />");
     });

						   
		   
	 $(".home #diaporama").everyTime(5000,function() {
		
		if(diapo<4){						  
		$('#diapo'+diapo+' p.pictures').fadeOut('slow');
		$('#diapo'+diapo).removeClass();
		$('#diapo'+(diapo+1)+' p.pictures').fadeIn('slow');
		$('#diapo'+(diapo+1)).addClass('on');
		diapo++;
		}
		else {
		$('#diapo'+diapo+' p.pictures').fadeOut('slow');
		$('#diapo'+diapo).removeClass();
		$('#diapo1 p.pictures').fadeIn('slow');
		$('#diapo1').addClass('on');
		diapo=1;
		}
		
		
     });
     ///
	 $('#fleched1').click(
		function(){
		$('.concepts').hide();
		$('#therm2').show();
		}) ;
	 
	  $('#fleched2').click(
		function(){
		$('.concepts').hide();
		$('#therm3').show();
		}) ;
	  
	   $('#flecheg1').click(
		function(){
		$('.concepts').hide();
		$('#therm1').show();
		}) ;
	 
	  $('#flecheg2').click(
		function(){
		$('.concepts').hide();
		$('#therm2').show();
		}) ;
	  
	 
	 $('#plus').click(
		function () {
		if ($(this).is(".first")==false) {	if(repere==2){
		$("#options_list").animate({"left": "+=165px"}, "slow");
		}
		else{
		$("#options_list").animate({"left": "+=269px"}, "slow");
		}
		repere--;
		$('#moins').removeClass();
		if(repere==1){
		$(this).addClass("first");
		}
		}
		return false;
    	});
	 
	 $('#moins').click(
		function () {
		if ($(this).is(".last")==false) {
		if(repere==1){
		$("#options_list").animate({"left": "-=165px"}, "slow");
		}
		else{
		$("#options_list").animate({"left": "-=269px"}, "slow");
		}
		repere++;
		
		$('#plus').removeClass();
		if(repere==2){
		$(this).addClass("last");
		}
		}
		return false;
    	});
	 
	   $("#option1").hover(
		  function () {
		  $("#option1 span").slideDown();
		  },
		  function () {
		  $("#option1 span").slideUp();
		  }
		);
	   
	   	   $("#option2").hover(
		  function () {
		  $("#option2 span").slideDown();
		  },
		  function () {
		  $("#option2 span").slideUp();
		  }
		);

	   	   $("#option3").hover(
		  function () {
		  $("#option3 span").slideDown();
		  },
		  function () {
		  $("#option3 span").slideUp();
		  }
		);
		   
		   	   	   $("#option4").hover(
		  function () {
		  $("#option4 span").slideDown();
		  },
		  function () {
		  $("#option4 span").slideUp();
		  }
		);
	
	$('p.alter').toggle(function() {
 $(this).next(".legende").show('slow');
		 $(this).html("Fermer");
}, function() {
 $(this).next(".legende").hide('slow');
		 $(this).html("En savoir plus");
});
	
 	$('h3.deroulant').toggle(function() {
         $(this).next(".legende").show('slow');
		}, function() {
 $(this).next(".legende").hide('slow');
	
});



});


