// JavaScript Document

var x = 0;
var prox = 1;
var pai;
var filhos;
var qtd;
var idobj;


var xb = 0;
var proxb = 1;
var paib;
var filhosb;
var qtdb;
var idobjb;

function fout(id){

$("#"+id).fadeOut('slow', function() {
	    
		
	});
	
}

function fin(id){
	
	$("#"+id).fadeIn('slow', function() {
		    
			
		});
		
	}

function troca_noticias(idpai){

	pai = document.getElementById(idpai);
	filhos = pai.getElementsByTagName("fieldset");
	qtd = filhos.length;
	
	if(qtd > 0 ){
	
	atual = $(filhos[x]).attr("id");
	next = $(filhos[prox]).attr("id");
		
	fout(""+ atual+"");
	setTimeout("fin('"+  next +"');",500);
	
	x = x+1;
	prox = x + 1;
	
	if(x == (qtd-1)){
		
		prox = 0;

	}
	if (x == qtd){
		
		x = 0;
		prox = 1;
	}
	
	}
	
}


function troca_noticiasb(idpaib){

	paib = document.getElementById(idpaib);
	filhosb = paib.getElementsByTagName("fieldset");
	qtdb = filhosb.length;
	
	if(qtdb > 0 ){
	
	atualb = $(filhosb[xb]).attr("id");
	nextb = $(filhosb[proxb]).attr("id");
		
	fout(""+ atualb+"");
	setTimeout("fin('"+  nextb +"');",500);
	
	xb = xb+1;
	proxb = xb + 1;
	
	if(xb == (qtdb-1)){
		
		proxb = 0;

	}
	if (xb == qtdb){
		
		xb = 0;
		proxb = 1;
	}
	}
	
}


