/* SlideShowSTCASIMIR */
var STCASIMIR ={
  nbSlide : 0,
  nbCurrent : 1,
  elemCurrent : null,
  elem : null,
  
  init : function(elem){
    this.nbSlide = elem.find(".slide").length;
    this.elem=elem;
    elem.find(".slide").hide();
    elem.find(".slide:first").show();
    this.elemCurrent = elem.find(".slide:first");
    
    STCASIMIR.play();
  },
  gotoSlide : function(num){
    if(num==this.nbCurrent){return false;}
    this.elemCurrent.fadeOut();
    this.elem.find("#slide"+num).fadeIn();
    this.nbCurrent = num;
    this.elemCurrent = this.elem.find("#slide"+num);
  },
  next : function() {
    var num = this.nbCurrent+1;
    if(num >this.nbSlide){
      num=1;
    }
    this.gotoSlide(num);
    return false;
  },
  stop : function() {
    window.clearInterval(STCASIMIR.timer);
  },
  play : function() {
    this.timer = window.setInterval("STCASIMIR.next()", 6000);
  }
}

$(function(){
  STCASIMIR.init($("#slide"));
});
