var twitstat={jsonp:function(){if(document.all&&document.getElementById("twitstat_badge_call")){document.getElementById("twitstat_badge_call").src=twitstat.updateurl}else{if(document.getElementById("twitstat_badge_call")){var a=document.getElementById("twitstat_badge_call");a.parentNode.removeChild(a)}else{var b=document.createElement("script");if(twitstat.updateurl==""){b.src=twitstat.url}else{b.src=twitstat.updateurl}b.id="twitstat_badge_call";document.body.appendChild(b)}}setTimeout(twitstat.jsonp,6000)},fx:function(a){if(a.style.display=="none"){a.style.filter="alpha(opacity:0)";a.style.opacity=0;a.style.display="block"}if(twitstat.fxopac<100){twitstat.fxopac+=4;var b=twitstat.fxopac/100;a.style.filter="alpha(opacity:"+twitstat.fxopac+")";a.style.opacity=b;setTimeout(function(){twitstat.fx(a)},30)}else{twitstat.fxopac=0}},init:function(a){twitstat.props=a;twitstat.url=twitstat.searchurl+"?rpp="+a.max+"&callback=twitstat.construct&q="+encodeURIComponent(a.keywords);if(typeof document.addEventListener!=="undefined"){document.addEventListener("DOMContentLoaded",twitstat.jsonp,false)}else{if(typeof window.attachEvent!="undefined"){window.attachEvent("onload",twitstat.jsonp)}else{document.write(unescape('%3Cscript src="'+twitstat.url+'" type="text/javascript"%3E%3C/script%3E'))}}},loop:function(c,d){var a=[];for(var b=0;b<c.length;b++){var e='<li style="margin: 5px; font: normal 12px/14px arial, sans-serif; min-height: 54px; height: auto !important; height: 54px;margin-bottom:20px;">';e+='<img src="'+c[b].profile_image_url+'" style="float: left; margin: 0 5px 10px 0; width: 30px; height: 30px;">';e+="<div>";e+='<a href="http://www.twitter.com/'+c[b].from_user+'" style="color: '+twitstat.props.link_color+'">'+c[b].from_user+"</a>: ";e+="<span>"+twitstat.convertUrls(c[b].text)+"</span></div><hr style="+"'margin-top:20px;height: 0;border:0;border-bottom: 1px dotted #666;color:#fff;'"+"/></li>";a[b]=e}return(d&&c.length>0?'<div style="display: none;">'+a.join("")+"</div>":a.join(""))},construct:function(d){var c=document.getElementById(twitstat.props.badge_container),b=twitstat.loop(d.results,false),g=document.createDocumentFragment();c.style.width=twitstat.props.width+"px";twitstat.holder=document.createElement("div");twitstat.updateurl=twitstat.searchurl+d.refresh_url+"&callback=twitstat.update";var a='<ul style="list-style-type: none; overflow: hidden; height: '+(twitstat.props.max*120)+"px; padding: 0; margin: 0; color:"+twitstat.props.content_font_color+"; border: 1px solid "+twitstat.props.border_color+"; background-color: "+twitstat.props.content_background_color+';">',f='<div style="font: normal 14px/16px helvetica, sans-serif; -moz-border-radius-topleft: 2px; -moz-border-radius-topright: 2px; -webkit-border-top-left-radius: 2px; -webkit-border-top-right-radius: 2px; color: '+twitstat.props.header_font_color+"; background-color: "+twitstat.props.header_background+'; margin: 0; padding: 4px 4px 2px;">'+twitstat.props.title+"</div>",e='<div style="font: normal 11px/12px helvetica, sans-serif; color: '+twitstat.props.header_font_color+"; -moz-border-radius-bottomright: 2px; -moz-border-radius-bottomleft: 2px; -webkit-border-bottom-left-radius: 2px; -webkit-border-bottom-right-radius: 2px;background-color: "+twitstat.props.header_background+'; margin: 0; padding: 4px; text-align: right;">Powered by <a href="http://twitstat.us/" title="TwitStat.us" style="color: #c6c6c6">TwitStat.us</a></div>';twitstat.holder.innerHTML="<div>"+f+a+b+"</ul>"+e+"</div>";g.appendChild(twitstat.holder.firstChild);c.appendChild(g);twitstat.list=c.getElementsByTagName("UL")[0];return false},update:function(b){if(b.results.length>0){twitstat.updateurl=twitstat.updateurl=twitstat.searchurl+b.refresh_url+"&callback=twitstat.update";var a=twitstat.loop(b.results,true);frag=document.createDocumentFragment();twitstat.holder.innerHTML=a;frag.appendChild(twitstat.holder.firstChild);twitstat.list.insertBefore(frag,twitstat.list.childNodes[0]);if(b.results.length>0){twitstat.fx(twitstat.list.childNodes[0])}return false}},convertUrls:function(a){a=a.replace(twitstat.urlRE,function(b){return twitstat.replaceUrl(b)});return a.replace(twitstat.twitterUsernameRE,'<a style="color: '+twitstat.props.link_color+'" href="http://twitter.com/$1">@$1</a>')},twitterUsernameRE:/@(\w+)/gm,urlRE:/((((ht|f){1}(tp:[/][/]){1})|((www.){1}))[-a-zA-Z0-9@:%_\+.~#?&//=]+)/gm,replaceUrl:function(a){return'<a href="'+a+'" title="'+a+'" style="color: '+twitstat.props.link_color+'">'+((a.length>34)?(a.substring(0,20)+"&hellip;"):a)+"</a>"},badge:{init:function(a){twitstat.init(a)}},props:{},url:"",searchurl:"http://search.twitter.com/search.json",updateurl:"",fxopac:0,list:{},holder:{}};
