﻿/**/
$(document).ready(function(){	
	
/*
 *
 * AJAX DOS TWEETS ;)
 *
 */	
	var quantidade = 3;
	var pesquisa = new Array('#joaoribeiro','@bruninhoedavi');
	
	$.ajax({
		type: 'GET',
		url: 'http://search.twitter.com/search.json?q='+encodeURIComponent(pesquisa)+'&amp;rpp='+quantidade+'&amp;include_entities=true&amp;result_type=mixed&callback=?',
		contentType: 'application/json; charset=utf-8',
		dataType: 'jsonp',
		success: function(r) {
			var html = '<ul>';
				for(var i = 0; i < 3; i++){
					html += '<li class="item last'+ i +'"><p>';
					html += r.results[i].text;
					html += '</p></li>';
				}
			html += '</ul>';
			
			$(html).appendTo('#tweets');
			
			twttr.anywhere(function (T){
				T("#box_twitter_post").tweetBox({
					'counter' : false,
					'width'   : 490,
					'height'  : 50,
					'label'   : "",
					'counter' : true,
					'defaultContent' : "@bruninhoedavi #joaoribeiro"
				});
				
				T.hovercards();
			});
		}
	});
	
});
