function Noticias(nome, div, array, link_modelo)
{
	this.nome = nome;
	this.div = document.getElementById(div);
	this.array = array;
	this.delay = 5000;
	this.noticia = 0;
	this.id = 0;
	this.link_modelo = !link_modelo? "" : link_modelo;
	this.timeout = null;

	if(!div||array.length==0) return;
	else this.atualiza();
}

Noticias.prototype.link = function() { with (this)
{
	return self.location = id==null? "" : link_modelo.replace("{id}", id);
}};

Noticias.prototype.proxima = function() { with (this)
{
	noticia++;
	if(noticia==array.length) noticia = 0;
	atualiza();	
}};

Noticias.prototype.anterior = function() { with (this)
{
	noticia--;
	if(noticia<0) noticia = array.length-1;
	atualiza();	
}};

Noticias.prototype.pausa = function() { with (this)
{
	clearTimeout(timeout);
}};


Noticias.prototype.atualiza = function() { with (this)
{
	clearTimeout(timeout);
	
	id = array[noticia][0];
	
 	div.innerHTML = (id==null? '<p>' : "<p class='azul' align='left' style='cursor: pointer;' onclick='" + nome + ".link()' onmouseover='" + nome + ".pausa()' onmouseout='" + nome + ".atualiza()'>")+
					"<span class=\"data\">" + array[noticia][1] + "</span><BR>"+
					"" + array[noticia][2] + "</p>";
					 
	timeout = setTimeout(nome + ".proxima()", delay);
}};