if(typeof getTweets!=='function')(function(){var twitterjs={},guid=0;!function(context,doc){var fns=[],ol,fn,f=false,testEl=doc.documentElement,hack=testEl.doScroll,domContentLoaded='DOMContentLoaded',addEventListener='addEventListener',onreadystatechange='onreadystatechange',loaded=/^loade|c/.test(doc.readyState);function flush(i){loaded=1;while(i=fns.shift()){i()}}
doc[addEventListener]&&doc[addEventListener](domContentLoaded,fn=function(){doc.removeEventListener(domContentLoaded,fn,f);flush();},f);hack&&doc.attachEvent(onreadystatechange,(ol=function(){if(/^c/.test(doc.readyState)){doc.detachEvent(onreadystatechange,ol);flush();}}));context['domReady']=hack?function(fn){self!=top?loaded?fn():fns.push(fn):function(){try{testEl.doScroll('left');}catch(e){return setTimeout(function(){domReady(fn)},50);}
fn();}()}:function(fn){loaded?fn():fns.push(fn);};}(twitterjs,document);window.getTweets=function(target,id,count,options){guid++;if(typeof id=='object'){options=id;id=options.id;count=options.count;}
if(!count)count=1;if(options){options.count=count;}else{options={};}
if(!options.timeout&&typeof options.onTimeout=='function'){options.timeout=10;}
if(typeof options.clearContents=='undefined'){options.clearContents=true;}
options.twitterTarget=target;if(typeof options.enableLinks=='undefined')options.enableLinks=true;twitterjs.domReady((function(options,guid){return function(){function render(tweet){var text=options.enableLinks?twitterlib.ify.clean(twitterlib.expandLinks(tweet)):twitterlib.expandLinks(tweet);var html='<li>';if(options.prefix){html+='<li><span className="twitterPrefix">';html+=options.prefix.replace(/%(.*?)%/g,function(m,l){return tweet.user[l];});html+=' </span></li>';}
html+='<span className="twitterStatus">'+ twitterlib.time.relative(tweet.created_at)+'</span> ';html+='<span className="twitterTime">'+ tweet.text+'</span>';if(options.newwindow){html=html.replace(/<a href/gi,'<a target="_blank" href');}
return html;}
function getTweets(){options.target=document.getElementById(options.twitterTarget);if(!options.target){return;}
var tlOptions={limit:count}
if(tlOptions.includeRT){tlOptions.include_rts=true;}
if(options.timeout){window['twitterTimeout'+ guid]=setTimeout(function(){twitterlib.cancel();options.onTimeout.call(options.target);},options.timeout*1000);}
var searchMethod='timeline';if(id.indexOf('#')===0)searchMethod='search';if(id.indexOf('/')!==-1)searchMethod='list';if(options.ignoreReplies){tlOptions.filter='-@';}
twitterlib.cache(true);twitterlib[searchMethod](id,tlOptions,function(tweets,tlOptions){var html=[],max=tweets.length>options.count?options.count:tweets.length;var template='<span class="status">%text%</span><br /><span class="time"><a href="http://twitter.com/%user_screen_name%/statuses/%id_str%">%time%</a></span><br />';for(var i=0;i<max;i++){tweets[i].time=twitterlib.time.relative(tweets[i].created_at);for(var key in tweets[i].user){tweets[i]['user_'+ key]=tweets[i].user[key];}
if(template){html.push('<p>'+ template.replace(/%([a-z_\-\.]*)%/ig,function(m,l){var r=tweets[i][l]+""||"";if(l=='text')r=twitterlib.expandLinks(tweets[i]);if(l=='text'&&options.enableLinks)r=twitterlib.ify.clean(r);return r;})+'</p>');}else if(options.bigTemplate){html.push(twitterlib.render(tweets[i]));}else{html.push(render(tweets[i]));}}
if(options.clearContents){options.target.innerHTML=html.join('');}else{options.target.innerHTML+=html.join('');}
options.callback&&options.callback(tweets);});}
if(typeof twitterlib!=='function'){setTimeout(function(){var script=document.createElement('script');script.onload=script.onreadystatechange=getTweets;script.src='http://lokizilla.net/js/mylibs/twitterlib.min.js';var head=document.head||document.getElementsByTagName('head')[0];head.insertBefore(script,head.firstChild);},0);}else{getTweets();}};})(options,guid));};})();
