function Rotativo(args) {	
	var me = this;
	var aux = 0;
	var timerIntv = false;
	var timerOut = false;
	this.index = 0;
	this.instNome = args.instanceName;	
	this.conts = [];
	this.intervalo = args.intervalo;
	
	this.init = function(){
		$(args.conteudos).each(function(i){
			me.conts[i] = $(this);	
		}).css('display','none');		
		if(args.fade){$(args.conteudos).css("position","absolute");}
		me.qntd = me.conts.length;
		me.conts[me.index].css('display','block');
		if(args.marcadores){me.changeMarcador();}
		if(me.intervalo){me.initTimer();}
		if(me.onInit) me.onInit();
	}
	this.initTimer = function(){	
		timerIntv = setInterval(function(){
			me.proximo();		
		}, me.intervalo);	
	}
	this.stopTimer = function(){		
		clearInterval(timerIntv);
	}
	this.changeMarcador = function(){		
		$(args.marcadores).each(function(i){
			$(this).attr("class",$(this).attr("class").replace(" active",""));
			if(i == me.index){
				$(this).attr("class",$(this).attr("class")+" active");
			}
		});
	}
	this.proximo = function(){
		if(me.index < me.qntd-1){
			me.index++;
		}else{
			me.index = 0;
		}	
		me.setIndex(me.index);
	}
	this.anterior = function(){
		if(me.index > 0){
			me.index--;
		}else{
			me.index = me.qntd-1;
		}		
		me.setIndex(me.index);	
	}
	this.setIndex = function(indx){
		if(indx != aux){
			me.index = indx;
			if(args.fade){
				me.conts[me.index].fadeIn(150);							
				me.conts[aux].fadeOut(300);
			}else{
				me.conts[aux].fadeOut(300, function() {
					me.conts[me.index].fadeIn(150);				
			    });
			}		
			aux = me.index;
			if(args.marcadores){me.changeMarcador();}	
			if(me.intervalo){
				me.stopTimer();
				if(timerOut)
				clearInterval(timerOut);
				timerOut = setTimeout(me.initTimer,2000);
			};
			if(me.onChange)	me.onChange();
		}
	}	
	if(args.btn_anterior) $(args.btn_anterior).click(me.anterior);
	if(args.btn_proximo) $(args.btn_proximo).click(me.proximo);
}



