// defino el usuario
var TWITTER_USERNAME = 'CAARAUTOARAGON';
$(function(){
	// caja contenedora
	var where = $("#social-nets div.tweet");
	// pido el feed del usuario
	$.getJSON('http://twitter.com/status/user_timeline/'+TWITTER_USERNAME+'.json?count=10&callback=?', function(data){
		// defino mi funcion de actualizar
		var updateBox = function(tweet){
			// oculto rapido
			where.fadeOut(200, function(){
				// cambio el texto y animo mostrarlo
				where.html("&#8220;"+tweet+"&#8221;").fadeIn(200);
			});
		};
		
		var currentTweet = 0;
		var updateTime = setInterval(function(){
			// actualizo la caja
			updateBox(data[currentTweet].text); 
			// paso al siguiente tweet en el array
			currentTweet++; 
			// si no existe el tweet
			if(currentTweet >= data.length){ 
				// vuelvo al primero
				currentTweet = 0;
			}
		}, 6000); // cada 6 segundos
		
	});
});
