	//Variables:
	var twid = 0;
	var json;
	var qtd_twittes = 0;
	var id = 0;
	var regexlink = /http:\/\/[a-z|0-9|A-Z|\-|\_|.|\/]*/;
	//Constants:
	const TRANSITION_TWITTES_TIMER = 7000;

	//Get twittes via ajax
	$.getJSON('http://twitter.com/status/user_timeline/anavaz_imagem.json?count=20&callback=?', function( data ) {
		//Rescue data of the json object
		json = data;
		qtd_twittes = json.length;
	})
	.success(function() { })
	.error(function() { })
	.complete(function() {
		//Call 'sets_twittes'
		sets_twittes(twid);
		init_timer();
		//Add events
			//Mouse Over and Mouse Out
			$('div#tweets a#left_arrow').mouseover(function(){ $(document).stopTime('timer_twittes'); }).mouseout(function(){ init_timer() });
			$('div#tweets a#right_arrow').mouseover(function(){ $(document).stopTime('timer_twittes'); }).mouseout(function(){ init_timer() });

			//Mouse Click
			$('div#tweets a#left_arrow').click(function(){
				twid = ( twid == 0 ) ? ( qtd_twittes - 1 ) : --twid;
				//Call 'sets_twittes'
				sets_twittes(twid);
			});

			$('div#tweets a#right_arrow').click(function(){
				twid = ( twid == ( qtd_twittes - 1 ) ) ? 0 : ++twid;
				//Call 'sets_twittes'
				sets_twittes(twid);
			});
	});

	//Functions:
		//Sets actually twitte
		function sets_twittes( twid ) {
			//Variables:
			var content = json[twid].text;
			var array_links = content.match(regexlink);
			//Actions:
			if (array_links) {
				for( var i = 0; i < array_links.length; i++ ) {
					content = content.replace(array_links[i],"<a href='" + array_links[i] + "' target='_blank'>" + array_links[i]+ "</a>");
				}
			}
			$('div#tweets p').html(content);
		}

		function init_timer() {
			$(document).everyTime( TRANSITION_TWITTES_TIMER , 'timer_twittes', function() {
				//Sets twid
				twid = ( twid == (qtd_twittes-1) ) ? 0 : ++twid;
				//Call 'sets_twittes'
				sets_twittes(twid);
			});
		}
