  jQuery(document).ready(function(){
	function replaceURLWithHTMLLinks(text) {
		 var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i;
		 return text.replace(exp,"<a href='$1'>$1</a>"); 
	}
	jQuery.ajax({
			url: "http://api.twitter.com/1/users/show.json?screen_name=MichelePivetti",
			type: 'GET',
			dataType: 'jsonp',
			timeout: 1000,
			error: function(){ jQuery("div#twitter").html(":#"); },
			success: function(json){
				var img = json.profile_image_url;
				var t = replaceURLWithHTMLLinks(json.status.text);
				var img = json.profile_image_url;
				var d = json.status.created_at;
				var giorno = {"Mon":"Lun", "Tue":"Mar", "Wed":"Mer","Thu":"Gio", "Fri":"Ven", "Sat":"Sab","Sun":"Dom"};
				var mese = {"Jan":"Gen", "Feb":"Feb", "Mar":"Mar","Apr":"Apr", "May":"Mag", "Jun":"Giu","Jul":"Lug", "Aug":"Ago", "Sep":"Set","Oct":"Ott", "Nov":"Nov", "Dec":"Dic"};
				n = d.substring(0, 3);
				o = d.substring(7, 11);
				m = d.substring(4, 7);
				p = d.substring(11, 16);
				z = d.substring(26, 30);
				jQuery("div#twitter").append('<img src="'+img+'" /><div class="tweet">'+
												'<div class="tw-top"></div>'+
												'<p class="tweet-text">'+t+'&nbsp;<span>'+giorno[n]+','+o+' '+mese[m]+' '+z+' - '+p+'</span></p>'+'<div class="tw-bottom"></div>'+
												'<div class="clear"></div>'+
											'</div>'
											);
			}	
		});
});
