// JavaScript Document
function carousselPub(elsIni,clsIni,cronoIni){
			this.els=elsIni;
			this.cls=clsIni;
			this.crono=cronoIni;
			this.current=-1;
			this.timerID=null;
			
	
			this.rotation=function()	{	
			var actif=false;
			if (this.current==(this.els.length-1)) this.current=-1;
			
			 for (var x = 0 ; x < this.els.length; x ++){
				
                       var el = Ext.get(this.els[x]);
					  
                          if (el) { 
						 
                             if (el.hasClass(this.cls)) {
                                var Box=el.getBox(); 
							
								el.removeClass(this.cls);
								
								// if (x==(this.els.length-1)) x=0;
								 
                                   }else if (x>this.current && actif==false){
									
									el.addClass(this.cls);
									if (Box) el.setBox(Box);
									el.fadeIn();
								
									this.current=x;
									actif=true;
                                  }    
                              }
             }
			if (this.els.length>1) autoplay(this);
			}
			
			autoplay=function(obj){
				if (obj.timerID) obj.timerID = null;
				obj.timerID=setTimeout(function() { obj.rotation(); }, (obj.crono*1000)*60);	
			}
		
 }    
