// JavaScript Document
var timer;
function bindAll(){
	$('#nav-list LI').click(function(){
		// kill bouton 
		$("#nav-list LI.active").animate({opacity: 0.5},1000,function(){
	    		$(this).removeClass('active last-active');
	    		});
	    // supbloc
	    	$(this).animate({opacity: 1.0}, 1000,function(){
	    		$(this).addClass('active');
	    		currentId = $('#nav-list LI.active a').text();
	    		$("#slideshow DIV.active").addClass('last-active');
	    		$("#sup-bloc DIV:nth-child("+currentId+"):first").animate({opacity: 1},1000,function(){$(this).addClass('active')});
	    		$("#slideshow DIV:nth-child("+currentId+"):first").css({opacity: 0}).addClass('active').animate({opacity: 1},1000,function(){ $("#slideshow DIV.last-active").removeClass('active last-active');});
	    		
	    		});
	    	clearInterval(timer);
	    	
	    	
	    	$("#sup-bloc DIV.active").animate({opacity: 0}, 1000,function(){$(this).removeClass('active')});
	
	    });
	}
/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
// background image
    var $active = $('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0})
        .addClass('active')
        .animate({opacity: 1}, 1000, function() {
            $active.removeClass('active last-active');
        });
		
		 var $active2 = $('#sup-bloc DIV.active');
// Bloc descriptif
    if ( $active2.length == 0 ) $active2 = $('#sup-bloc DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next2 =  $active2.next().length ? $active2.next()
        : $('#sup-bloc DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active2.addClass('last-active');
	$active2.animate({opacity: 0.0}, 1000);
    $next2.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active2.removeClass('active last-active');
			
        });
		 var $active3 = $('#nav-list LI.active');
	
		 
		 
// PUCE
    if ( $active3.length == 0 ) $active3 = $('#nav-list LI:last');

    // use this to pull the divs in the order they appear in the markup
    var $next3 =  $active3.next().length ? $active3.next()
        : $('#nav-list LI:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active3.addClass('last-active');
	$active3.animate({opacity: 0.5}, 1000);
    $next3.css({opacity: 0.5})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active3.removeClass('active last-active');
			
        });
}



$(function() {
    
});

$(function() {
    //setInterval( "slidePub()", 10000 );
});

