var t=setInterval("passaBanner()",8000);
var cont = 1;

var totalBanner = 1;

var atual = "sl_1";

var anterior = "";

$(document).ready(function() {
  flyto(cont);
});

function setTotal (total) {
	totalBanner = total;
}

function flyto (id){
	cont = id;
	
	anterior = atual;
	atual = "sl_"+id;
	
	clearInterval(t);
	
	t=setInterval("passaBanner()",5000);
	
	$("#"+anterior).fadeOut("slow");
	$("#"+atual).fadeIn("slow");
	
	$(".sel").removeClass("sel");
	$("#btn_"+id).addClass("sel");
};

function passaBanner () {
	
	cont ++;
	
	if (cont >= totalBanner+1){
		cont = 1;
	}
	
	flyto(cont);

};
