(function($){$.fn.fullscreenr=function(options){if(options.height===undefined)alert('Please supply the background image height, default values will now be used. These may be very inaccurate.');if(options.width===undefined)alert('Please supply the background image width, default values will now be used. These may be very inaccurate.');if(options.bgID===undefined)alert('Please supply the background image ID, default #bgimg will now be used.');var defaults={width:1280,height:1024,bgID:'bgimg'};var options=$.extend({},defaults,options);$(document).ready(function(){$(options.bgID).fullscreenrResizer(options);});$(window).bind("resize",function(){$(options.bgID).fullscreenrResizer(options);});return this;};$.fn.fullscreenrResizer=function(options){var ratio=options.height/options.width;var browserwidth=$(window).width();var browserheight=$(window).height();if((browserheight/browserwidth)>ratio){$(this).height(browserheight);$(this).width(browserheight/ratio);}else{$(this).width(browserwidth);$(this).height(browserwidth*ratio);}
$(this).css('left',(browserwidth-$(this).width())/2);$(this).css('top',(browserheight-$(this).height())/2);return this;};})(jQuery);;$(document).ready(function(){$("#content").prepend('<ul id="tweets"></ul>');setInterval("getSearch()",10000);getSearch();jQuery.fn.fullscreenr(FullscreenrOptions);});var FullscreenrOptions={width:1600,height:1067,bgID:'#bgimg'};TwitterCache={};function getSearch(){var url="http://search.twitter.com/search.json?q=&ands=&phrase=fml&ors=sucks+school+class+parking+computer+embarrassed+bored+ugly+spiders+iphone+traffic+internet+kill+mom+dad+parents+tv+laundry+loser+homework&nots=rt+%40&callback=?";$.getJSON(url,function(data){if(data.results){var i=-1,result,HTML='',HTML2='';while((result=data.results[++i])&&!TwitterCache[result.id]){TwitterCache[result.id]=result.from_user;HTML+='<li id="TwitterId'+result.id+'" class="tweet"><div class="left"><a href="http://www.twitter.com/'+result.from_user+'" title="View this ungrateful twat\'s Twitter profile"><img src="'+result['profile_image_url']+'" alt="Profile Image" /></a></div><div class="right"><span><a href="http://www.twitter.com/'+result.from_user+'" title="View this ungrateful twat\'s Twitter profile" class="user">'+result.from_user+'</a>: '+FormatIt(result.text)+'</span><br /><span class="created_at">Posted '+relative_time(result.created_at)+' via '+removeViaLink(result.source)+'</span></div></li>';}
if(HTML!==''){$("ul#tweets").prepend(HTML).find('li:hidden').fadeIn('slow');$("li:gt(29)").remove();}}});}
function FormatIt(text_results){text_results=text_results.replace(/#?(fml)/ig,'fuck my life');return text_results.linkify();}
function removeViaLink(link){link=link.replace(/&lt;(?:.|\s)*?&gt;/g,'');return link;}
String.prototype.linkify=function(){return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/~.=]+/,function(m){return m.link(m);});};function relative_time(tweetTime){var tweetTimeOrig=tweetTime.split(" ");var tweetTime=tweetTimeOrig[4].split(":");var tweetTime=(parseInt(tweetTime[1])*60)+parseInt(tweetTime[2]);var current=Date();var current=current.split(" ");var current=current[4].split(":");var current=(parseInt(current[1])*60)+parseInt(current[2]);var elapsed=(parseInt(current)-parseInt(tweetTime));if(elapsed<60){r='less than a minute ago';}else if(elapsed<120){r='a minute ago';}else if(elapsed<(45*60)){r=(parseInt(elapsed/60)).toString()+' minutes ago';}else if(elapsed<(90*60)){r='an hour ago';}else if(elapsed<(24*60*60)){r=''+(parseInt(elapsed/3600)).toString()+' hours ago';}else if(elapsed<(48*60*60)){r='1 day ago';}else{r='recently';}
return r;}
function twitter_callback(){return true;}
