jQuery.fn.reverse=Array.prototype.reverse;String.prototype.linkify=function()
{return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/g,function(m)
{return m.link(m);});};String.prototype.linkuser=function()
{return this.replace(/[@]+[A-Za-z0-9-_]+/g,function(u)
{var username=u.replace("@","")
return u.link("http://twitter.com/"+username);});};String.prototype.linktag=function()
{return this.replace(/[#]+[A-Za-z0-9-_]+/,function(t)
{var tag=t.replace("#","%23")
return t.link("http://search.twitter.com/search?q="+tag);});};function fetch_tweets(elem)
{elem=$(elem);input=elem.attr('title');lang=elem.attr('lang');if(input!=window.monitter['text-'+input])
{window.monitter['last_id'+input]=0;window.monitter['text-'+input]=input;window.monitter['count-'+input]=12;;}
/* if(window.monitter['count-'+input]>10)
{elem.prepend('<div class="tweet"><img src="http://monitter.com/widget/favicon.gif" align="absmiddle" />Lovetweet by Jaan Orvet and Andreas Carlsson</div>');window.monitter['count-'+input]=0;} */
var url="http://search.twitter.com/search.json?q="+input+"&lang="+lang+"&rpp="+rrp+"&since_id="+window.monitter['last_id'+input]+"&callback=?";$.getJSON(url,function(json)
{$('div.tweet:gt('+window.monitter['limit']+')',elem).each(function(){$(this).fadeOut('slow')});$(json.results).reverse().each(function()
{if($('#tw'+this.id,elem).length==0)
{window.monitter['count-'+input]++;var dates=new Array("1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var thedate=new Date(Date.parse(this.created_at));var theMinute=thedate.getMinutes();if (theMinute<10){theMinute="0"+theMinute};var theHour=thedate.getHours();if (theHour>12){theTime=theHour-12+':'+theMinute+' pm'}else{theTime=theHour+':'+theMinute+' am'};var thedatestr=theTime+' '+monthname[thedate.getMonth()]+' '+dates[(thedate.getDate())-1];var divstr='<div id="tw'+this.id+'" style="display: inline"><div id="wrapper"><img width="48" height="48" src="'+this.profile_image_url+'" ><div class="user small-text-italic"><a href="http://twitter.com/'+this.from_user+'" target="_blank" alt="Link to user">'+this.from_user+'</a>&nbsp;-&nbsp;'+thedatestr+'</div><div id="replace" class="tweet">'+this.text.linkify().linkuser().linktag()+'</div></div></div>';window.monitter['last_id'+input]=this.id;elem.prepend(divstr);$('#tw'+this.id,elem).hide();$('#tw'+this.id+' img',elem).hide();$('#tw'+this.id+' img',elem).fadeIn(4000);$('#tw'+this.id,elem).fadeIn('slow');}});input=escape(input);rrp=1;setTimeout(function(){fetch_tweets(elem)},10000);});return(false);}
$(document).ready(function(){window.monitter={};$('.monitter').each(function(e){rrp=3;fetch_tweets(this);});});

/*
<div id="tw'+this.id+'" style="display: inline; vertical-align: top">
	<div id="wrapper">
		<img width="48" height="48" src="'+this.profile_image_url+'" >
		<div class="user"><a href="http://twitter.com/'+this.from_user+'" target="_blank" alt="Link to user">'+this.from_user+'</a>&nbsp;-&nbsp;'+thedatestr+'
		</div>
		<div id="replace" class="tweet">'+this.text.linkify().linkuser().linktag()+'
		</div>
		<hr>
	</div>
</div>
*/