var actus = new Array();
var currentActu = 0;

function updateActu()
{
	// We loop through each news
	if (currentActu > (actus.length - 1))
		currentActu = 0;

	$('#news p a.actu').fadeOut('normal', function() {  
		// '<strong>' + actus[currentActu].date + ':</strong>&nbsp;&nbsp;' +
		$(this).html(actus[currentActu].title);
		$(this).attr('href', actus[currentActu].link);
		$(this).attr('title', actus[currentActu].title);
		currentActu++;
		$(this).fadeIn();
	});
	setTimeout("updateActu();", 5000);
}

// get RSS news from Warpdesign.fr blog
function getWarpdesignRSS()
{
	$.post('/warpRSS.php', {}, function(data)
	{
		actus = data;
		updateActu();
	}, "json");
}

function getWarpdesignTwitter()
{
	$.post('/warpTwitter.php', {}, function(data)
	{
		actus = data;
		updateActu();
	}, "json");
}

$(document).ready(function()
{
	getWarpdesignTwitter();
	//getWarpdesignRSS();
});