var diapo3 = {
    nbSlide : 0,
    nbCurrent : 1,
    elemCurrent : null,
    elem : null,
    timer : null,
    
    // fonction d'initialisation
    init : function(elem){
        
        //calcul du nb de slide
        this.nbSlide = elem.find(".slide3").length;
        this.elem=elem;
        
        //initialisation du diapo
        elem.find(".slide3").hide();
        elem.find(".slide3:first").show();
        this.elemCurrent = elem.find(".slide3:first");
        
        //initialisation du timer
        this.timer = window.setInterval("diapo3.next()",5000);
    },
    
    //fonction de dˇroulement automatique du diapo
    next : function(){
        this.nbCurrent++;
        if(this.nbCurrent>this.nbSlide){this.nbCurrent=1}
        this.gotoSlide(this.nbCurrent);
    },
    
    //fonction d'affichage des slides
    gotoSlide : function(num){
        this.elemCurrent.fadeOut();
        this.elem.find("#c"+num).fadeIn();
        this.nbCurrent = num;
        this.elemCurrent = this.elem.find("#c"+num);
        
    }
    
    
}

$(function(){
    diapo3.init($("#diaporama3"));
});
