var diapo1 = {
    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(".slide1").length;
        this.elem=elem;
        
        //initialisation du diapo
        elem.find(".slide1").hide();
        elem.find(".slide1:first").show();
        this.elemCurrent = elem.find(".slide1:first");
        
        //initialisation du timer
        this.timer = window.setInterval("diapo1.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("#a"+num).fadeIn();
        this.nbCurrent = num;
        this.elemCurrent = this.elem.find("#a"+num);
        
    }
    
    
}

$(function(){
    diapo1.init($("#diaporama1"));
});
