/*
 * tiempoAnimacion 	: tiempo de la animación de transparencia (en milisegundos)
 */
var tiempoAnimacion = 2000;

/*
 * No tocar debajo de esta línea
 */
 
var XA = new xAnimation(); 
var noticia = getCookie("noticia");

if (noticia == null)
	noticia = 0;

var intervalo = null;
var intervalo2 = null;
var i3 = null;
var i4 = null;
var i5 = null; 

var doc = document.getElementById("ultima_hora");

XA.opacity('ultima_hora', 0, tiempoAnimacion, 3, 1, 'true');
XA.pause();

function siguiente()
{
	clearTimeout(intervalo);
	XA.resume();
	
	intervalo2 = setInterval("detener()", tiempoAnimacion);
	i3 = setInterval("cargaDatos()", tiempoAnimacion / 2);
}

function detener()
{
	XA.pause();
	clearTimeout(intervalo2);
}	

function cargaDatos()
{
	clearTimeout(i3);
	clearTimeout(i5);
	
	if (noticia == numNoticias)
		noticia = 0;
		
	doc.innerHTML = "<a href='noticia.php?n=" + noticias[noticia][0] + "'>" + noticias[noticia][1] + "</a> &mdash; " + noticias[noticia][2];
	noticia++;
	
	document.cookie = 'noticia=' + noticia;
}

function cargaInicial()
{
	XA.resume();
	
	i4 = setInterval("stop()", 2000);
	i5 = setInterval("cargaDatos()", 1000);
	
	setInterval("siguiente()", intervaloNoticias);
}

function stop()
{
	XA.pause();
	clearTimeout(i4);
}

// Inicia
//iniciar();

cargaInicial();
//setInterval("siguiente()", intervaloNoticias);