(function($){

	$.fn.tweetsdigest = function(options) {
		var defaults = { limit: 10, username: "jebox", time: false };
		var options = $.extend(defaults,options);
		return this.each(function(options){
			var act = $(this);
			var api = "http://twitter.com/statuses/user_timeline/";
			var count = "?count=";
			$.getJSON(api+defaults.username+".json"+count+defaults.limit+"&callback=?",act,function(data){
				$.each(data,function(i,item){if(i==0){$(act)
				.prepend('<ul class="tweetsLinks"><li class="tweet_content_'+i+'">')}
				else {$('.tweetsLinks').append('<li class="tweet_content_'+i+'">')}

	$('.tweet_content_'+i+'').hover(
		function () { $(this).prepend('<a class="retweet" target="_blank" href="http://twitter.com/home/?status='+encodeURIComponent(item.text)+'"><img src="http://my.jebox.ru/tweetsdigest/retweet.png"/></a>') },
		function () { $(".tweetsdigest .retweet").remove(); }
	)

.append('<span class="tweet_link_'+i+'">'+item.text.replace(/#(.*?)(\s|$)/g,'#$1 ')
.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,'<a target="_blank" href="$&">$&</a> ')
.replace(/@(.*?)(\s|\(|\)|$)/g,'@<a target="_blank" href="http://twitter.com/$1">$1</a> '));
if(defaults.time==true){$('.tweet_content_'+i).append('<small> '+item.created_at.substr(0,20)+'</small>')}})})})}})(jQuery);