$(function() {
    $('.pics').each(function() {
    	var $nav = $('<div class="nav"></div>').insertAfter(this);
    	$('<div class="caption">&nbsp;</div>').insertAfter($nav);
    	
    	$(this).cycle({
	        fx:     'fade', 
    speed:  450, 
    timeout: 0,
    next:   '.next, .pics',
    prev:   '.prev',
    pause: 1,
    after:   onAfter
    	});
	$(".menu").fadeTo("slow", 0.3);
  $(".menu").hover(function(event){
    $(this).stop().fadeTo("slow", 1);
  },
  function(){
    $(this).stop().fadeTo("slow", 0.3);
    });
   $(".fleche").css('opacity','0');
  $(".fleche").fadeTo(2000, 0.4);
  $(".fleche").hover(function(event){
    $(this).stop().fadeTo("fast", 1);
    },
    function(){
      $(this).stop().fadeTo("slow", 0.4);
    });
});  

	
	function onAfter(curr,next,opts) { 
 
  var caption = (opts.currSlide + 1) + ' / ' + opts.slideCount;
	$('.caption').html(caption);
 }
});


