function timer(){ 

	//fazendo a requisição
	$.get('twitterajax.php', {since_id:lastIdGlobal,textsearch:textSearchGlobal}, function(result){ 
			//aqui dentro trata a requisição
			//alert('result chegou!');
			//$("#rtContainer").html('Result: <br/> <pre>'+ result+'</pre>');
			
			//recebe e converte o json em objeto javascript
			//alert(result);
			var obj = $.evalJSON(result);
						
			// se o lastIdGlobal é maior ou igual ao da requisição eh porque uma outra requisição chegou antes e atualizou ele
			// se isso ocorreu apenas deve-se descartar a o requisição atual porque os tweetes jah foram atualizados na página
			//alert('LastIdGlobal: '+lastIdGlobal+' obj.max_id: '+obj.max_id);
			if(lastIdGlobal < obj.max_id) {
				//alert('LastIdGlobal: '+lastIdGlobal+' obj.max_id: '+obj.max_id);
				lastIdGlobal = obj.max_id;
				//alert('LastIdGlobal: '+lastIdGlobal);
				//alert(obj.results.length);
				for(i=obj.results.length-1; i>=0; i--){
					//$("#rtContainer").html( $("#rtContainer").html() + 'Result: '+ i +'<br />');
					//alert('POST: '+this);
					$("#contentList li:last").remove();
					$("#contentList").prepend('<li class="ContentItem" style="display: none; background-color: yellow;">'+obj.results[i]+'</li>');
					$("#contentList li:first").show(1000, function(){ 
						//alert(this);
						this.style.backgroundColor = 'white';
						//this.css('background-color', 'white');
					});
					//$("#contentList li:first").show('slow');
				}				
			}
		}
	); 
	
}

$(document).ready(function(){
	// chama a função a cada 30 segundos
	$(document).everyTime(10000, timer);
});
