// STOP LOOKING AT MY NAKED CODE, PERV!

function twitter(t)
{
/* It's not like I don't like MS and IE team, I just wish them terrific death in horrible pain.
It took me over half an hour to find this bug - have they ever heard of RFC 2822 ..? */

if($.browser.msie) adddate = Date.parse(t[0].created_at.replace("\+0000","UTC\+0000"));
else adddate = Date.parse(t[0].created_at);
nowdate = new Date().getTime();
diff = parseInt((nowdate-adddate)/1000);
 
if(diff < 60) text = "Mniej niż minutę temu";
else if(diff < 120) text = "Minutę temu";
else if(diff < 180) text = "Dwie minuty temu";
else if(diff < 240) text = "Trzy minuty temu";
else if(diff < 300) text = "Cztery minuty temu";
else if(diff < 3600) text = parseInt(diff/60).toString() + " minut temu";
else if(diff < 7200) text = "Godzinę temu";
else if(diff < 10800) text = "Dwie godziny";
else if(diff < 14400) text = "Trzy godziny";
else if(diff < 18000) text = "Cztery godziny";
else if(diff < 86400) text = parseInt(diff/3600).toString() + " godzin temu";
else if(diff < 172800) text = "Wczoraj";
else text = parseInt(diff/86400).toString() + " dni temu";
 
$('#twitter').html('<a href="http://twitter.com/' + twitteruser + '/statuses/' + t[0].id + '">Twitter</a>' + t[0].text + ' <span>' + text + '</span></a></li>');

$('#tload').remove();
}


$(function() {

// Last.fm
	$('#about').after('<div id="lastfm" class="us"><div class="loading" id="lfload">ładowanie...</div>');
	$.getScript('http://stuff.nerdblog.pl/lastfm.php');

// Twitter

twitteruser = 'd4rkypl';
twitterid = '10940082';
 
$('#about').after('<div id="twitter" class="us"><div class="loading" id="tload">ładowanie...</div></div>');
$.getScript('http://www.twitter.com/statuses/user_timeline/' + twitterid+'.json?callback=twitter&count=1');


}); 


