_jsversion='2_323';
Array.prototype.freeArrayMem=function(){this.length=0;return this};String.prototype.unescapeHtml=function(){var b=document.createElement("div");b.innerHTML=this;var a=b.childNodes[0].nodeValue;b.removeChild(b.firstChild);return a};function isDefined(a){return typeof(window[a])!="undefined"}function defineOnce(b,a){if(!isDefined(b)){window[b]=a()}return window[b]}function checkSignature(c,a){for(var b in a){if(typeof(c[b])!=a[b]){return false}}return true}var debug=function(a){};if((typeof(console)!="undefined")&&(typeof(console.debug)!="undefined")){debug=function(a){console.debug(a)}}var _ArraysHaveIndexOf=([].indexOf);function containsIgnoreCase(a,d){var b=a.length;var c=d.toLowerCase();while(b--){if(a[b].toLowerCase()==c){return true}}}this.contains=(_ArraysHaveIndexOf)?function(a,b){return a.indexOf(b)>=0}:function(a,c){var b=a.length;while(b--){if(a[b]==c){return true}}return false};function intersects(a,c){var b=a.length;for(var d=0;d<b;d++){if(contains(c,a[d])){return true}}return false}function convertAtomDateString(i){var c=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d*)?(Z|[+-]\d{2}:\d{2})$/i;if(!c.test(i)){return""}var a=new Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var j,h,d,f,e,b,g;j=i.slice(0,4);h=a[1*i.slice(5,7)];d=i.slice(8,10);f=i.slice(11,13);e=i.slice(14,16);b=i.slice(17,19);g="GMT";if(i.indexOf("Z")==-1){var l=i.lastIndexOf(":");g+=i.slice(l-3,l)+i.slice(l+1)}return d+" "+h+" "+j+" "+f+":"+e+":"+b+" "+g}var _45min=45*60;var _2h=2*60*60;var _1day=12*_2h;var _2days=2*_1day;function _relative_time(a){var c=(arguments.length>1)?arguments[1]:new Date();var d=parseInt((c.getTime()-a)/1000);var b="";if(d<60){b=d+" sec ago"}else{if(d<120){b="1 min ago"}else{if(d<(_45min)){b=(parseInt(d/60)).toString()+" min ago"}else{if(d<(_2h)){b="1 hr ago"}else{if(d<(_1day)){b=(parseInt(d/3600)).toString()+" hr ago"}else{if(d<(_2days)){b="1 day ago"}else{b=(parseInt(d/86400)).toString()+" days ago"}}}}}}return b}function relative_time(b){var a=b;if(typeof(b)=="string"){a=Date.parse(b)}return _relative_time(a)}function notify(a){var b=$("#notification");b.html(a);b.slideDown(function(){var d=$(this);var c=function(e){return function(){e.fadeOut()}};setTimeout(c(d),2000)})}function createCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}jQuery.fn.outer=function(){return $($("<div></div>").html(this.clone())).html()};jQuery.fn.center=function(){var a=$(window);this.css("position","absolute");this.css("top",((a.height()-this.height())/2+a.scrollTop())+"px");this.css("left",((a.width()-this.width())/2+a.scrollLeft())+"px");return this};jQuery.fn.highlight=function(b){function a(e,j){var m=0;if(e.nodeType==3){var l=e.data.toUpperCase().indexOf(j);if(l>=0){var h=document.createElement("span");h.className="highlight";var f=e.splitText(l);var c=f.splitText(j.length);var d=f.cloneNode(true);h.appendChild(d);f.parentNode.replaceChild(h,f);m=1}}else{if(e.nodeType==1&&e.childNodes&&!/(script|style)/i.test(e.tagName)){for(var g=0;g<e.childNodes.length;++g){g+=a(e.childNodes[g],j)}}}return m}return this.each(function(){a(this,b.toUpperCase())})};jQuery.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;with(this.parentNode){replaceChild(this.firstChild,this);normalize()}}).end()};function Annotations(){this.annotations={};this.set=function(d,b,e){var c=this.get(d);if(typeof(c)=="undefined"){c={};c[b]=e;this.annotations[d]=c}else{c[b]=e}};this.get=function(d,b){var c=this.annotations[d];if(typeof(c)=="undefined"){return null}if(!b){return c}else{return c[b]}};this.findType=function(a,e){var c=[];for(var d in this.annotations){var b=this.get(d,a);if(e==b){c.push(d)}}return c}}Annotations.getInstance=function(){return defineOnce("ANNOTATIONS",function(){return new Annotations()})};Annotations.set=function(b,a,c){Annotations.getInstance().set(b,a,c)};Annotations.setMap=function(c,b){var d=Annotations.getInstance();for(var a in b){d.set(c,a,b[a])}};function EventsManager(){this.subscriptions=[];this.fire=function(g,f){if(f){g.__source=f}for(var c=0;c<this.subscriptions.length;c++){var e=this.subscriptions[c];var d=e.subscriber;var b=e.acceptFn;var a=e.handlerFn;if(b.apply(d,[g,f])){a.apply(d,[g,f])}}};this.subscribe=function(c,b,a){this.subscriptions.push({subscriber:c,acceptFn:b,handlerFn:a})}}EventsManager.getInstance=function(){return defineOnce("EVENTSMANAGER",function(){return new EventsManager()})};EventsManager.subscribe=function(c,b,a){return EventsManager.getInstance().subscribe(c,b,a)};EventsManager.fire=function(b,a){return EventsManager.getInstance().fire(b,a)};(function($){var P,t={},p,G=this,z=true,N=false,H="onhashchange"in G,a=Array.prototype.slice,m=document.location,i,g,d,A,v,K,E,M,q="urlInternal",b="urlExternal",C="queryString",L="fragment",f="update",I="passQueryString",u="passFragment",e="fragmentChange",s="hashchange."+e,h,J;function l(Q){return typeof Q==="string"}function D(Q){return typeof Q==="object"}function o(){var Q=a.call(arguments),R=Q.shift();return function(){return R.apply(this,Q.concat(a.call(arguments)))}}function n(){return m.href.replace(/^[^#]*#?/,"")}$.fragmentString=function(){return n()};$.urlTagAttrList=i=function(Q){return $.extend(t,Q)};i({a:"href",img:"src",form:"action",base:"href",script:"src",iframe:"src",link:"href"});function x(Q){var R=Q.nodeName;return R?t[R.toLowerCase()]:""}$.urlInternalHost=g=function(S){S=S?"(?:"+S+"\\.)?":"";var Q=new RegExp("^"+S+"(.*)","i"),R="^"+m.protocol+"//"+m.hostname.replace(Q,S+"$1")+(m.port?":"+m.port:"")+"/";return d(R)};$.urlInternalRegExp=d=function(Q){if(Q){P=l(Q)?new RegExp(Q,"i"):Q}return P};g("www");$.isUrlInternal=A=function(Q){if(!Q){return p}if(P.test(Q)){return z}if(/^https?:\/\//i.test(Q)){return N}if(/^(?:#|[a-z\d.-]+:)/i.test(Q)){return p}return z};$.isUrlExternal=v=function(R){var Q=A(R);return typeof Q==="boolean"?!Q:Q};K=function(R,Q){return this.filter(":"+R+(Q?"("+Q+")":""))};$.fn[q]=o(K,q);$.fn[b]=o(K,b);E=function(U,T,S,R){var Q=R[3]||x(T);return Q?!!U($(T).attr(Q)):N};$.expr[":"][q]=o(E,A);$.expr[":"][b]=o(E,v);function c(T,S,R,Q){var U;if(l(R)||D(R)){return B(S,R,Q,T)}else{if(D(S)){return $.param(S)}else{if(l(S)){return F(S,R,T)}else{U=T?n():m.search;return F(U,S,T)}}}}$[C]=o(c,0);$[L]=o(c,1);function O(){var R,U,Q,S=a.call(arguments),T=S.shift();if(l(S[1])||D(S[1])){R=S.shift()}U=S.shift();Q=S.shift();return this.each(function(){var X=$(this),V=R||x(this),W=V&&X.attr(V)||"";W=c(T,W,U,Q);X.attr(V,W)})}$.fn[C]=o(O,0);$.fn[L]=o(O,1);function j(){var R=a.call(arguments),S=R.shift(),Q=R.shift(),T=c(S);if($.isFunction(R[0])){T=R.shift()(T)}else{if($.isArray(R[0])){$.each(R.shift(),function(V,U){delete T[U]})}}return c(S,Q,T,R.shift())}$[I]=o(j,0);$[u]=o(j,1);function w(){var Q,R=a.call(arguments),S=R.shift();if(l(R[0])){Q=R.shift()}return this.each(function(){var V=$(this),T=Q||x(this),U=T&&V.attr(T)||"";U=j.apply(this,[S,U].concat(R));V.attr(T,U)})}$.fn[I]=o(w,0);$.fn[u]=o(w,1);function F(T,S,V){var Q,Y,R,U={},W={"null":null,"true":z,"false":N},X=decodeURIComponent,Z=V?/^.*[#]/:/^.*[?]|#.*$/g;T=T.replace(Z,"").replace(/\+/g," ").split("&");while(T.length){Q=T.shift().split("=");Y=X(Q[0]);if(Q.length===2){R=X(Q[1]);if(S){if(R&&!isNaN(R)){R=Number(R)}else{if(R==="undefined"){R=p}else{if(W[R]!==p){R=W[R]}}}}if($.isArray(U[Y])){U[Y].push(R)}else{if(U[Y]!==p){U[Y]=[U[Y],R]}else{U[Y]=R}}}else{if(Y){U[Y]=S?p:""}}}return U}function B(Q,S,R,V){var W,Y=V?/^([^#]*)[#]?(.*)$/:/^([^#?]*)[?]?([^#]*)(#?.*)/,U=Q.match(Y),X=F(U[2],0,V),T=U[3]||"";if(l(S)){S=F(S,0,V)}if(R===2){W=S}else{if(R===1){W=$.extend({},S,X)}else{W=$.extend({},X,S)}}W=$.param(W);return U[1]+(V?"#":W||!U[1]?"?":"")+W+T}$.setFragment=M=function(R,Q){var S=D(R)?c(z,R):(R||"").replace(/^#/,"");S=R?B("#"+n(),"#"+S,Q,1):"#";m.href=m.href.replace(/#.*$/,"")+S};$.replaceFragment=function(Q){m.href=m.href.replace(/#.*$/,"")+Q};$[e]=function(R){if(R===z){R=100}function Q(){var T=$.Event(e);T[L]=n();$(document).trigger(T)}H&&$(G).unbind(s);h&&clearTimeout(h);h=null;if(typeof R==="number"){if(H){$(G).bind(s,Q)}else{J=n();if($.isFunction(y)){y=y()}(function S(){var U=n(),T=y[L](J);if(U!==J){y[f](U,T);J=U;Q()}else{if(T!==J){M(T,2)}}h=setTimeout(S,R<0?0:R)})()}}};function y(){var R,Q=$.browser,S={};S[f]=S[L]=function(T){return T};if(Q.msie&&Q.version<8){S[f]=function(V,T){var U=R.document;if(V!==T){U.open();U.close();U.location.hash="#"+V}};S[L]=function(){return R.document.location.hash.replace(/^#/,"")};R=$("<iframe/>").hide().appendTo("body").get(0).contentWindow;S[f](n())}return S}})(jQuery);(function(a){a.fn.fieldtag=function(b){var c=a.extend({markedClass:"tagged",standardText:false},b);a(this).focus(function(){if(!this.changed){this.clear()}}).blur(function(){if(!this.changed){this.addTag()}}).keyup(function(){this.changed=(a(this).val()?true:false)}).each(function(){this.title=a(this).attr("title");if(a(this).val()==a(this).attr("title")){this.changed=false}this.clear=function(){if(!this.changed){a(this).val("").removeClass(c.markedClass)}};this.addTag=function(){a(this).val(c.standardText===false?this.title:c.standardText).addClass(c.markedClass)};if(this.form){this.form.tagFieldsToClear=this.form.tagFieldsToClear||[];this.form.tagFieldsToClear.push(this);if(this.form.tagFieldsAreCleared){return true}this.form.tagFieldsAreCleared=true;a(this.form).submit(function(){a(this.tagFieldsToClear).each(function(){this.clear()})})}}).keyup().blur();return a(this)}})(jQuery);(function(c){var a=(c.browser.msie?"paste":"input")+".mask";var b=(window.orientation!=undefined);c.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"}};c.fn.extend({caret:function(f,d){if(this.length==0){return}if(typeof f=="number"){d=(typeof d=="number")?d:f;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(f,d)}else{if(this.createTextRange){var g=this.createTextRange();g.collapse(true);g.moveEnd("character",d);g.moveStart("character",f);g.select()}}})}else{if(this[0].setSelectionRange){f=this[0].selectionStart;d=this[0].selectionEnd}else{if(document.selection&&document.selection.createRange){var e=document.selection.createRange();f=0-e.duplicate().moveStart("character",-100000);d=f+e.text.length}}return{begin:f,end:d}}},unmask:function(){return this.trigger("unmask")},mask:function(f,j){if(!f&&this.length>0){var g=c(this[0]);var i=g.data("tests");return c.map(g.data("buffer"),function(n,m){return i[m]?n:null}).join("")}j=c.extend({placeholder:"_",completed:null},j);var e=c.mask.definitions;var i=[];var l=f.length;var h=null;var d=f.length;c.each(f.split(""),function(m,n){if(n=="?"){d--;l=m}else{if(e[n]){i.push(new RegExp(e[n]));if(h==null){h=i.length-1}}else{i.push(null)}}});return this.each(function(){var w=c(this);var q=c.map(f.split(""),function(A,z){if(A!="?"){return e[A]?j.placeholder:A}});var u=false;var y=w.val();w.data("buffer",q).data("tests",i);function v(z){while(++z<=d&&!i[z]){}return z}function p(B){while(!i[B]&&--B>=0){}for(var A=B;A<d;A++){if(i[A]){q[A]=j.placeholder;var z=v(A);if(z<d&&i[A].test(q[z])){q[A]=q[z]}else{break}}}t();w.caret(Math.max(h,B))}function m(D){for(var B=D,C=j.placeholder;B<d;B++){if(i[B]){var z=v(B);var A=q[B];q[B]=C;if(z<d&&i[z].test(A)){C=A}else{break}}}}function s(A){var B=c(this).caret();var z=A.keyCode;u=(z<16||(z>16&&z<32)||(z>32&&z<41));if((B.begin-B.end)!=0&&(!u||z==8||z==46)){n(B.begin,B.end)}if(z==8||z==46||(b&&z==127)){p(B.begin+(z==46?0:-1));return false}else{if(z==27){w.val(y);w.caret(0,o());return false}}}function x(C){if(u){u=false;return(C.keyCode==8)?false:null}C=C||window.event;var z=C.charCode||C.keyCode||C.which;var E=c(this).caret();if(C.ctrlKey||C.altKey||C.metaKey){return true}else{if((z>=32&&z<=125)||z>186){var B=v(E.begin-1);if(B<d){var D=String.fromCharCode(z);if(i[B].test(D)){m(B);q[B]=D;t();var A=v(B);c(this).caret(A);if(j.completed&&A==d){j.completed.call(w)}}}}}return false}function n(B,z){for(var A=B;A<z&&A<d;A++){if(i[A]){q[A]=j.placeholder}}}function t(){return w.val(q.join("")).val()}function o(A){var E=w.val();var D=-1;for(var z=0,C=0;z<d;z++){if(i[z]){q[z]=j.placeholder;while(C++<E.length){var B=E.charAt(C-1);if(i[z].test(B)){q[z]=B;D=z;break}}if(C>E.length){break}}else{if(q[z]==E[C]&&z!=l){C++;D=z}}}if(!A&&D+1<l){w.val("");n(0,d)}else{if(A||D+1>=l){t();if(!A){w.val(w.val().substring(0,D+1))}}}return(l?z:h)}if(!w.attr("readonly")){w.one("unmask",function(){w.unbind(".mask").removeData("buffer").removeData("tests")}).bind("focus.mask",function(){y=w.val();var z=o();t();setTimeout(function(){if(z==f.length){w.caret(0,z)}else{w.caret(z)}},0)}).bind("blur.mask",function(){o();if(w.val()!=y){w.change()}}).bind("keydown.mask",s).bind("keypress.mask",x).bind(a,function(){setTimeout(function(){w.caret(o(true))},0)})}o()})}})})(jQuery);(function($){$.fn.findandfilter=function(selector){var ret=this.filter(selector).add(this.find(selector));ret.prevObject=ret.prevObject.prevObject;return ret};$.fn.parsecss=function(callback,parseAttributes){var parse=function(str){$.parsecss(str,callback)};this.findandfilter("style").each(function(){parse(this.innerHTML)}).end().findandfilter("link[type=text/css]").each(function(){if(!this.disabled&&!/\w+:/.test($(this).attr("href"))&&$.parsecss.mediumApplies(this.media)){$.get(this.href,parse)}}).end();if(parseAttributes){$.get(location.pathname+location.search,"text",function(HTMLtext){styleAttributes(HTMLtext,callback)})}return this};$.parsecss=function(str,callback){var ret={};str=munge(str).replace(/@(([^;`]|`[^b]|`b[^%])*(`b%)?);?/g,function(s,rule){processAtRule($.trim(rule),callback);return""});$.each(str.split("`b%"),function(i,css){css=css.split("%b`");if(css.length<2){return}css[0]=restore(css[0]);ret[css[0]]=$.extend(ret[css[0]]||{},parsedeclarations(css[1]))});callback(ret)};$.parsecss.mediumApplies=(window.media&&window.media.query)||function(str){if(!str){return true}if(str in media){return media[str]}var style=$('<style media="'+str+'">body {position: relative; z-index: 1;}</style>').appendTo("head");return media[str]=[$("body").css("z-index")==1,style.remove()][0]};$.parsecss.isValidSelector=function(str){var s=$("<style>"+str+"{}</style>").appendTo("head")[0];return[s.styleSheet?!/UNKNOWN/i.test(s.styleSheet.cssText):!!s.sheet.cssRules.length,$(s).remove()][0]};$.parsecss.parseArguments=function(str){if(!str){return[]}var ret=[],mungedArguments=munge(str,true).split(/\s+/);for(var i=0;i<mungedArguments.length;++i){var a=restore(mungedArguments[i]);try{ret.push(eval("("+a+")"))}catch(err){ret.push(a)}}return ret};$.parsecss.jquery=function(css){for(var selector in css){for(var property in css[selector]){var match=/^-jquery(-(.*))?/.exec(property);if(!match){continue}var value=munge(css[selector][property]).split("!");var which=match[2];dojQuery(selector,which,restore(value[0]),restore(value[1]))}}};$.parsecss.styleAttributes=styleAttributes;var media={};var munged={};function parsedeclarations(index){var str=munged[index].replace(/^{|}$/g,"");str=munge(str);var parsed={};$.each(str.split(";"),function(i,decl){decl=decl.split(":");if(decl.length<2){return}parsed[restore(decl[0])]=restore(decl[1])});return parsed}var REbraces=/{[^{}]*}/;var REfull=/\[[^\[\]]*\]|{[^{}]*}|\([^()]*\)|function(\s+\w+)?(\s*%b`\d+`b%){2}/;var REatcomment=/\/\*@((?:[^\*]|\*[^\/])*)\*\//g;var REcomment_string=/(?:\/\*(?:[^\*]|\*[^\/])*\*\/)|(\\.|"(?:[^\\\"]|\\.|\\\n)*"|'(?:[^\\\']|\\.|\\\n)*')/g;var REmunged=/%\w`(\d+)`\w%/;var uid=0;function munge(str,full){str=str.replace(REatcomment,"$1").replace(REcomment_string,function(s,string){if(!string){return""}var replacement="%s`"+(++uid)+"`s%";munged[uid]=string.replace(/^\\/,"");return replacement});var RE=full?REfull:REbraces;while(match=RE.exec(str)){replacement="%b`"+(++uid)+"`b%";munged[uid]=match[0];str=str.replace(RE,replacement)}return str}function restore(str){if(str===undefined){return str}while(match=REmunged.exec(str)){str=str.replace(REmunged,munged[match[1]])}return $.trim(str)}function processAtRule(rule,callback){var split=rule.split(/\s+/);var type=split.shift();if(type=="media"){var css=restore(split.pop()).slice(1,-1);if($.parsecss.mediumApplies(split.join(" "))){$.parsecss(css,callback)}}else{if(type="import"){var url=restore(split.shift());if($.parsecss.mediumApplies(split.join(" "))){url=url.replace(/^url\(|\)$/gi,"").replace(/^["']|["']$/g,"");$.get(url,function(str){$.parsecss(str,callback)})}}}}function dojQuery(selector,which,value,value2){if(/show|hide/.test(which)){which+="Default"}if(value2!==undefined&&$.livequery){var mode=2}else{mode=/\bthis\b/.test(value)?1:0}if(which&&$.fn[which]){function p(str){return function(){return $.fn[which].apply($(this),$.parsecss.parseArguments.call(this,str))}}switch(mode){case 0:return $.fn[which].apply($(selector),$.parsecss.parseArguments(value));case 1:return $(selector).each(p(value));case 2:return(new $.livequery(selector,document,undefined,p(value),value2===""?undefined:p(value2))).run()}}else{if(which){return undefined}else{switch(mode){case 0:return eval(value);case 1:return $(selector).each(Function(value));case 2:return(new $.livequery(selector,document,undefined,Function(value),value2===""?undefined:Function(value2))).run()}}}}var _show={show:$.fn.show,hide:$.fn.hide};$.each(["show","hide"],function(){var which=this,show=_show[which],plugin=which+"Default";$.fn[which]=function(){if(arguments.length>0){return show.apply(this,arguments)}return this.each(function(){var fn=$.data(this,plugin),$this=$(this);if(fn){$.removeData(this,plugin);fn.call($this);$this.queue(function(){$this.data(plugin,fn).dequeue()})}else{show.call($this)}})};$.fn[plugin]=function(){var args=$.makeArray(arguments),name=args[0];if($.fn[name]){args.shift();var fn=$.fn[name]}else{if($.effects&&$.effects[name]){if(typeof args[1]!="object"){args.splice(1,0,{})}fn=_show[which]}else{fn=_show[which]}}return this.data(plugin,function(){fn.apply(this,args)})}});var RESGMLcomment=/<!--([^-]|-[^-])*-->/g;var REnotATag=/(>)[^<]*/g;var REtag=/<(\w+)([^>]*)>/g;function styleAttributes(HTMLtext,callback){var ret="",style,tags={};HTMLtext=HTMLtext.replace(RESGMLcomment,"").replace(REnotATag,"$1");munge(HTMLtext).replace(REtag,function(s,tag,attrs){tag=tag.toLowerCase();if(tags[tag]){++tags[tag]}else{tags[tag]=1}if(style=/\bstyle\s*=\s*(%s`\d+`s%)/i.exec(attrs)){var id=/\bid\s*=\s*(\S+)/i.exec(attrs);if(id){id="#"+restore(id[1]).replace(/^['"]|['"]$/g,"")}else{id=tag+":eq("+(tags[tag]-1)+")"}ret+=[id,"{",restore(style[1]).replace(/^['"]|['"]$/g,""),"}"].join("")}});$.parsecss(ret,callback)}})(jQuery);(function(d){var a,j,h,g=false,b=false,i=[];function e(){j=c.GL=google.language;h=j.Languages;g=true;var l;while(l=i.shift()){l()}}function f(){}function c(){this.extend(d.translate);delete this.defaults;delete this.fn}c.prototype={version:"1.3.7",translateInit:function(l,n){var m=this;this.options=n;n.from=this.toLanguageCode(n.from)||"";n.to=this.toLanguageCode(n.to)||"";if(n.fromOriginal&&n.nodes[0]){n.nodes.each(function(o){var p=d.translate.getData(this,n.from,n);if(!p){return false}l[o]=p})}if(typeof l==="string"){if(!n.comments){l=this.stripComments(l)}this.rawSource="<div>"+l+"</div>";this.isString=true}else{if(!n.comments){l=d.map(l,function(o){return d.translate.stripComments(o)})}this.rawSource="<div>"+l.join("</div><div>")+"</div>";this.isString=false}this.from=n.from;this.to=n.to;this.source=l;this.elements=n.nodes;this.rawTranslation="";this.translation=[];this.startPos=0;this.i=0;this.stopped=false;n.start.call(this,n.nodes[0]?n.nodes:l,n.from,n.to,n);if(n.timeout>0){this.timeout=setTimeout(function(){n.onTimeout.call(m,n.nodes[0]?n.nodes:l,n.from,n.to,n)},n.timeout)}(n.toggle&&n.nodes[0])?this._toggle():this.translate();return this},translate:function(){if(this.stopped){return}var v=this,m=this.options;this.rawSourceSub=this.truncate(this.rawSource.substr(this.startPos),1750);this.startPos+=this.rawSourceSub.length;var s=this.rawTranslation.length,w;while((w=this.rawTranslation.lastIndexOf("</div>",s))>-1){s=w-1;var x=this.rawTranslation.substr(0,s+1),u=x.match(/<div[> ]/gi),t=x.match(/<\/div>/gi);u=u?u.length:0;t=t?t.length:0;if(u!=t+1){continue}var n=d(this.rawTranslation.substr(0,s+7)),q=n.length,p=this.i;if(p==q){break}n.slice(p,q).each(function(l,o){(function(){if(this.stopped){return false}var A=d(o).html().replace(/^\s/,""),z=p+l,B=this.source,C=this.from.length<2&&this.detectedSourceLanguage||this.from;this.translation[z]=A;if(!m.nodes[0]){if(this.isString){this.translation=A}else{B=this.source[z]}m.each.call(this,z,A,B,C,this.to,m)}else{this.each(z,this.elements[z],A,this.source[z],C,this.to,m);m.each.call(this,z,this.elements[z],A,this.source[z],C,this.to,m)}this.i++}).call(v)});break}if(this.rawSourceSub.length>0){j.translate(this.rawSourceSub,this.from,this.to,function(l){(function(){if(l.error){return m.error.call(this,l.error,this.rawSourceSub,this.from,this.to,m)}this.rawTranslation+=l.translation||this.rawSourceSub;this.detectedSourceLanguage=l.detectedSourceLanguage;this.translate()}).call(v)});if(!m.nodes[0]){return}}else{if(!this.rawTranslation){return}var y=this.from.length<2&&this.detectedSourceLanguage||this.from;if(this.timeout){clearTimeout(this.timeout)}if(!m.nodes[0]){m.complete.call(this,this.translation,this.source,y,this.to,m)}else{m.complete.call(this,this.elements.end(),this.elements,this.translation,this.source,y,this.to,m)}}},stop:function(){if(this.stopped){return this}this.stopped=true;this.options.error.call(this,{message:"stopped"});return this}};d.translate=function(n,m,l,p){if(n==a){return new c()}if(d.isFunction(n)){return d.translate.ready(n,m)}var o=new c();return d.translate.ready(function(){return o.translateInit(n,d.translate._getOpt(m,l,p))},false,o)};d.translate.fn=d.translate.prototype=c.prototype;d.translate.fn.extend=d.translate.extend=d.extend;d.translate.extend({stripComments:function(l){return l.replace(/<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)>/g,"")},truncate:function(s,m){var n,w,u,q,p,v,l=encodeURIComponent(s);for(n=0;n<10;n++){try{v=decodeURIComponent(l.substr(0,m-n))}catch(o){continue}if(v){break}}return(!(w=/<(?![^<]*>)/.exec(v)))?((!(u=/>\s*$/.exec(v)))?((q=/[\.\?\!;:](?![^\.\?\!;:]*[\.\?\!;:])/.exec(v))?((p=/>(?![^>]*<)/.exec(v))?(q.index>p.index?v.substring(0,q.index+1):v.substring(0,p.index+1)):v.substring(0,q.index+1)):v):v):v.substring(0,w.index)},getLanguages:function(v,u){if(v==a||(u==a&&!v)){return h}var t={},n=u,q=h;if(u){q=d.translate.getLanguages(v)}else{if(typeof v==="object"){n=v}}if(n){for(var s=0,o=n.length,m,p;s<o;s++){m=d.translate.toLanguageCode(n[s]);for(p in q){if(m===q[p]){t[p]=q[p]}}}}else{for(var p in h){if(j.isTranslatable(h[p])){t[p]=h[p]}}}return t},toLanguage:function(n,o){for(var m in h){if(n===m||n===h[m]||n.toUpperCase()===m||n.toLowerCase()===h[m].toLowerCase()){return o==="lowercase"?m.toLowerCase():o==="capitalize"?m.charAt(0).toUpperCase()+m.substr(1).toLowerCase():m}}},toLanguageCode:function(l){return h.a||h[d.translate.toLanguage(l)]},same:function(m,l){return m===l||d.translate.toLanguageCode(m)===d.translate.toLanguageCode(l)},isTranslatable:function(m){return j.isTranslatable(d.translate.toLanguageCode(m))},getBranding:function(m,l,n){return d(j.getBranding(m,l,n))},load:function(m,n,l){b=true;function o(){google.load(n||"language",l||"1",{callback:e})}(typeof google!=="undefined"&&google.load)?o():d.getScript("http://www.google.com/jsapi?"+(m?"key="+m:""),o);return d.translate},ready:function(l,n,m){g?l():i.push(l);if(!b&&!n){d.translate.load()}return m||d.translate},_getOpt:function(m,l,t,s){var q,p,n={};if(typeof m==="object"){n=m}else{if(!l&&!t){p=m}if(!t&&l){if(typeof l==="object"){p=m;n=l}else{q=m;p=l}}if(m!=a&&l&&t){q=m;p=l;n=t}n.from=q||n.from||"";n.to=p||n.to||""}if(n.fromOriginal){n.toggle=true}if(n.toggle){n.data=true}if(n.async===true){n.async=2}return d.extend({},d.translate._defaults,(s?d.fn.translate.defaults:d.translate.defaults),n)},_defaults:{comments:false,start:f,error:f,each:f,complete:f,onTimeout:f,timeout:0,from:"",to:"",nodes:[],walk:true,returnAll:false,replace:true,rebind:true,data:true,setLangAttr:false,subject:true,not:"",altAndVal:true,async:false,toggle:false,fromOriginal:false}});d.translate.defaults=d.extend({},d.translate._defaults)})(jQuery);var JSON=JSON||{};(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());function Antispam(){this.blackList=[];this.spammyWords=["rebate","% off","ebay","win","won","free","$","dollar","buck","viagra","cialis","gift card","gift-card","giftcard","gift certif","voucher","follow "];this.computeSpamHints=function(e){var d=0;var a=e.text.toLowerCase();for(var c=0;c<this.spammyWords.length;c++){var b=a.indexOf(this.spammyWords[c]);d=d+(b>=0?1:0)}return d};this.spamWeight=function(b){if(contains(this.blackList,b.from)){return 1}var a=this.computeSpamHints(b);if(a>=2&&b.links.length>0&&b.trendsCount>0){return 1}return b.trendsCount>=3?1:0}}function TemplatesManager(){this.templates={};this.render=function(j,a,i){var l=this.templates[j][a];var f=$("<div>"+l+"</div>");for(var b in i){var c=i[b];var h=f.find(b);if(c.html){h.html(c.html)}else{if(c.text){h.html(c.text)}}if(c.attrs){for(var d in c.attrs){var g=c.attrs[d];h.attr(d,g)}}}return f.html()};this.loadTemplates=function(a,b){var d={};var c=$("<div>"+b+"</div>");$("div.templateElement",c).each(function(){var e=$(this).html();var f=$(this).attr("id");if(f&&e){d[f]=e}});this.templates[a]=d};this.addTemplates=function(b,c){if(!this.templates[b]){var a=this;$.get("/q/templates/"+b+".html",{},function(d){a.loadTemplates(b,d);c()})}else{c()}}}TemplatesManager.getInstance=function(){return defineOnce("TEMPLATESMANAGER",function(){return new TemplatesManager()})};defineOnce("TWEETPARSER",function(){return new TweetParser()});defineOnce("ANTISPAM",function(){return new Antispam()});function Tweet(){this.id=null;this.created_at=null;this.created_at_date=null;this.from=null;this.from_picture=null;this.to=null;this.attags=[];this.hashtags=[];this.tickers=[];this.links=[];this.locations={};this.text=null;this.source=null;this.enrichedText=null;this.isRT=false;this.rts=[];this.originalTweetId=null;this.retweets=[];this.spamweight=0;this.spamweightTS=null;this.trendsCount=0;this.iso_language_code="";this.location=null;this.words=[];this.mood=0;this.spamWeight=0;if(typeof(_Tweet_prototype_called)=="undefined"){_Tweet_prototype_called=true;var a={isDuplicate:function(c,d){if(d.from!=this.from){return false}return(d.textWithoutLinks==this.textWithoutLinks)},isReplyTo:function(){return this.to},parseTwitterAPIJSON:function(f,j,g){this.id=f.id;this.created_at=f.created_at;this.created_at_date=Date.parse(this.created_at);if(!this.created_at_date){this.created_at=this.created_at.replace(/-/g,"/");this.created_at_date=Date.parse(this.created_at)}this.from=f.user.screen_name.toLowerCase();this.to=f.in_reply_to_screen_name?f.in_reply_to_screen_name.toLowerCase():"";this.from_picture=f.user.profile_image_url;this.text=f.text;this.iso_language_code="";this.enrichedText=f.text;this.textWithoutLinks=f.text;this.rts=[];this.words=[];var d=TWEETPARSER.parseText(this.text);this.attags=d.attags;this.hashtags=d.htags;this.tickers=d.tickers;this.mood=d.mood;var h=TWEETPARSER.renderAsTextAndHtml(this.text,d,d.tweet,this.iso_language_code);this.enrichedText=h.html;this.textWithoutLinks=h.text;this.words=h.words;this.links=d.links;this.rts=d.rts;this.isRT=this.rts.length>0;var c=0;for(var e=0;e<j.length;e++){if(this.text.toLowerCase().indexOf(j[e].name.toLowerCase())>=0){c+=1}}this.trendsCount=c;this.spamWeight=ANTISPAM.spamWeight(this)},parseTwitterJSON:function(f,l,g){this.id=f.id;this.created_at=f.created_at;this.created_at_date=Date.parse(this.created_at);if(!this.created_at_date){this.created_at=this.created_at.replace(/-/g,"/");this.created_at_date=Date.parse(this.created_at)}this.from=f.from_user?f.from_user.toLowerCase():"__nobody__";this.to=f.to_user?f.to_user.toLowerCase():"";this.from_picture=f.profile_image_url;this.text=f.text;var h=$(f.source.unescapeHtml());this.source={href:h.attr("href"),label:h.text()};this.iso_language_code=f.iso_language_code;this.enrichedText=f.text;this.textWithoutLinks=f.text;this.rts=[];this.words=[];var d=TWEETPARSER.parseText(this.text);this.attags=d.attags;this.hashtags=d.htags;this.tickers=d.tickers;this.mood=d.mood;var j=TWEETPARSER.renderAsTextAndHtml(this.text,d,d.tweet,this.iso_language_code);this.enrichedText=j.html;this.textWithoutLinks=j.text;this.words=j.words;this.links=d.links;this.rts=d.rts;this.isRT=this.rts.length>0;var c=0;for(var e=0;e<l.length;e++){if(this.text.toLowerCase().indexOf(l[e].name.toLowerCase())>=0){c+=1}}this.trendsCount=c;this.spamWeight=ANTISPAM.spamWeight(this)},hasLinks:function(){return this.links.length>0},hasLink:function(c){return contains(this.links,c)},getFirstLink:function(){if(this.links.length>0){return this.links[0]}else{return null}},hasHashtags:function(){return this.hashtags.length>0},hasAttags:function(){return this.attags.length>0},getFirstAttag:function(){if(this.attags.length>0){return this.attags[0].toLowerCase()}else{return null}},addRetweet:function(c){if(c.isRT){c.originalTweetId=this.id;this.retweets.push(c)}}};for(var b in a){Tweet.prototype[b]=a[b]}}}function LinksDB(){this.metadatasByUrl={};this.longUrls={};this.shortUrls={};this.urlResolutionPending={};this.getTweets=function(d){var g=this.shortUrls[d];if(!g){g=[]}if(!contains(g,d)){g.push(d)}var h=[];for(var f=0;f<g.length;f++){var c=g[f];var a=TWAZZUP.tdb.tweets.length-1;for(var b=a;b>=0;b--){var e=TWAZZUP.tdb.tweets[b];if(e.hasLinks()){if(contains(e.links,c)){h.push(e)}}}}h=h.sort(function(j,i){return j.created_at_date<i.created_at_date?1:(j.created_at_date==i.created_at_date)?0:-1});return h};this.getMetadatas=function(j,n){var d={};var g=[];var c=[];for(var f=0;f<j.length;f++){var b=j[f].url;var o=j[f].text;var l=this.getUrlMetadatas(b);if(!l){if((b.indexOf("http://twitpic.com/")==0&&b.indexOf("http://twitpic.com/photos")<0)||(b.indexOf("http://yfrog.com/")==0)||(b.indexOf("http://twitc.com/")==0)||(b.indexOf("http://mobypicture.com/?")==0)||(b.indexOf("http://tweetphoto.com/")==0)||(b.indexOf("http://www.tweetphoto.com/")==0)){var a=null;var e=null;if(b.indexOf("http://twitpic.com/")==0){a="http://twitpic.com/show/thumb/"+b.substring("http://twitpic.com/".length);e="twitpic.com"}else{if(b.indexOf("http://yfrog.com/")==0){var m=/http:\/\/yfrog.com\/([a-z0-9A-Z]+)$/.exec(b);if(m){a="http://yfrog.com/"+m[1]+".th.jpg";e="yfrog.com"}}else{if(b.indexOf("http://twitc.com/")==0){var m=/http:\/\/twitc.com\/([a-z0-9A-Z]+)$/.exec(b);if(m){a="http://twitc.com/ii3/"+m[1].substring(1)+".jpg";e="twitc.com"}}else{if(b.indexOf("http://mobypicture.com/?")==0){a="http://api.mobypicture.com/?t="+encodeURIComponent(b)+"&s=small&k=tw444zzup&format=plain";e="mobypicture.com"}else{if(b.indexOf("http://www.tweetphoto.com/")==0){var m=/http:\/\/www.tweetphoto.com\/([a-z0-9A-Z]+)$/.exec(b);if(m){a="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=medium&url=http://tweetphoto.com/"+m[1];e="tweetphoto.com"}}else{if(b.indexOf("http://tweetphoto.com/")==0){var m=/http:\/\/tweetphoto.com\/([a-z0-9A-Z]+)$/.exec(b);if(m){a="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=medium&url=http://tweetphoto.com/"+m[1];e="tweetphoto.com"}}else{var h=b.split(/[\/]+/,3);if(h.length>=2){e=h[1]}else{e="-"}}}}}}}if(a){l={domain:e,url:b,location:b,meta:{title:o,desc:"Photo",thumbs:[{src:a}]}};d[b]=l;this.longUrls[b]=b;this.shortUrls[b]=[b]}}if(!l){if(!this.urlResolutionPending[b]&&!contains(g,b)){g.push(b);this.urlResolutionPending[b]=true}else{c.push(b)}}}else{d[b]=l}}if(g.length>0){this.enqueueResolutionTask(g,n,500)}return{metadatas:d,unresolved:g,pending:c}};this.getUrlMetadatas=function(a){var b=this.metadatasByUrl[a];if(b){return b}var c=this.longUrls[a];if(c){return this.metadatasByUrl[c]}return null};this.resolutionTaskQueue=[];this.urlCallbacks={};this.resolutionTaskTimeout=-1;this.enqueueResolutionTask=function(f,g,e){clearTimeout(this.resolutionTaskTimeout);this.resolutionTaskQueue.push({urls:f,callback:g});for(var c=0;c<f.length;c++){var b=f[c];var d=this.urlCallbacks[b];if(!d){d=[];this.urlCallbacks[b]=d}d.push(g)}var a=this;this.resolutionTaskTimeout=setTimeout(function(){a.runNextResolutionTask()},e?e:500)};this.runNextResolutionTask=function(){if(this.resolutionTaskQueue.length>0){var a=this.resolutionTaskQueue[0];this.resolutionTaskQueue.splice(0,1);this.resolve(a.urls,a.callback)}};this.resolve=function(c,e){var d=0;var b=[];for(var a=0;a<c.length;a++){if(d==10){this.getUrlsInfos(b,e);b=[];d=0}b.push({url:c[a]});d++}if(b.length>0){this.getUrlsInfos(b,e)}};this.getUrlsInfos=function(c,e){var a=this;var d="";for(var b=0;b<c.length;b++){d+="u="+encodeURIComponent(c[b].url)+"&"}if(d){$.getJSON("http://meta.twazzup.com/_i?"+d+"callback=?",function(j){var f=j.metadatas;var l=j.unknown;for(var h=0;h<f.length;h++){a.setLocationMetaDatas(f[h])}var h=0;for(h=0;h<l.length&&h<10;h++){var g=l[h];$.getJSON("http://meta.twazzup.com/_gr.json?url="+encodeURIComponent(l[h])+"&callback=?",function(i){if(i&&i.meta&&!i.error){a.setLocationMetaDatas(i)}})}if(l.length>10){a.enqueueResolutionTask(l.slice(10),e,5000)}})}};this.setLocationMetaDatas=function(c){var b=c.location;shortUrls=[];if(b){var a=b.split(/[\/]+/,3);if(a.length>=2){c.domain=a[1]}else{c.domain="Erroneous"}this.metadatasByUrl[c.url]=c;this.longUrls[c.url]=c.location;shortUrls=this.shortUrls[c.location];if(!shortUrls){shortUrls=[c.url]}else{if(!contains(shortUrls,c.url)){shortUrls.push(c.url)}}this.shortUrls[c.location]=shortUrls}else{c.error=true}delete this.urlResolutionPending[c.url];this.notifyCallbacks(c,shortUrls)};this.notifyCallbacks=function(e,b){var c=this.urlCallbacks[e.url];delete this.urlCallbacks[e.url];if(c){for(var a=0;a<c.length;a++){var d=c[a];if(d){d(e,b)}}}}}LinksDB.getInstance=function(){return defineOnce("LINKSDB",function(){return new LinksDB()})};function LinkPipeManager(){this.pipes={};this.get=function(a){return this.pipes[a]};this.register=function(a){this.pipes[a.id]=a;return a};this.dispose=function(a){delete this.pipes[a]}}LinkPipeManager.getInstance=function(){return defineOnce("LINKPIPEMANAGER",function(){return new LinkPipeManager()})};function BaseLinkPipe(e,b,a,c,d){this.id=e;this.twazzup=b;this.feedingPipe=a;this.resolveUrls=c;this.params=d;this.manager=LinkPipeManager.getInstance();this.manager.register(this);this.linksDB=LinksDB.getInstance();this.links=[];this.urlOccurences={};this.urlMetadataOccurences={};this.listeners=[];this.addListener=function(f){this.listeners.push(f)};this.removeListener=function(f){this.listeners.splice(this.listeners.indexOf(f),1);if(this.listeners.length==0){this.dispose()}};this.fireNoResultsFound=function(){for(var f=0;f<this.listeners.length;f++){var g=this.listeners[f].noResultsFound;if(typeof(g)!="undefined"){this.listeners[f].noResultsFound(this)}}};this.firePipeStarted=function(){for(var f=0;f<this.listeners.length;f++){var g=this.listeners[f].pipeStarted;if(typeof(g)!="undefined"){this.listeners[f].pipeStarted(this)}}};this.firePipeStoped=function(){for(var f=0;f<this.listeners.length;f++){var g=this.listeners[f].pipeStoped;if(typeof(g)!="undefined"){this.listeners[f].pipeStoped(this)}}};this.fireMetadatasAvailable=function(h){for(var f=0;f<this.listeners.length;f++){var g=this.listeners[f].newMetadatasAvailable;if(typeof(g)!="undefined"){this.listeners[f].newMetadatasAvailable(h,this)}}};this.fireLinksAvailable=function(f){for(var g=0;g<this.listeners.length;g++){var h=this.listeners[g].newLinksAvailable;if(typeof(h)!="undefined"){this.listeners[g].newLinksAvailable(f,this)}}};this.dispose=function(){this.doDispose();this.twazzup.disposeLinkPipe(this.id);this.manager.dispose(this.id)};this.doDispose=function(){};this.latestTweetId=-1;this.newTweetsAvailable=function(f,l){var o=l.getLatestRichTweets(f);var n=[];for(var h=o.length-1;h>=0;h--){if(o[h].id>this.latestTweetId){this.latestTweetId=o[h].id;var m=o[h].links;for(var g=0;g<m.length;g++){var p=m[g];if(!((p.indexOf("http://twitpic.com/")==0&&p.indexOf("http://twitpic.com/photos")<0)||(p.indexOf("http://yfrog.com/")==0)||(p.indexOf("http://twitc.com/")==0)||(p.indexOf("http://mobypicture.com/?")==0)||(p.indexOf("http://tweetphoto.com/")==0)||(p.indexOf("http://www.tweetphoto.com/")==0))){n.push({url:p,from:o[h].from,dt:o[h].created_at_date,text:o[h].text})}}}}this.append(n)};this.append=function(w){var h=[];var g=[];var u=0;for(var v=0;v<w.length;v++){var j=w[v].url;var t=w[v].from;var o=w[v].dt;var m=w[v].text;var q=this.urlOccurences[j];var s=q?q.n:0;var z=q?q.nu:0;var x=q?q.from:[];if(!s){u++;h.push(j);this.urlOccurences[j]={n:1,nu:1,dt:o,from:[t]}}else{if(!contains(x,t)){x.push(t);this.urlOccurences[j]={n:s+1,nu:z+1,dt:o,from:x}}else{this.urlOccurences[j]={n:s,nu:z-1,dt:o,from:x}}}if(this.resolveUrls){var y=this.linksDB.longUrls[j];if(!y){g.push({url:j,text:m})}}}this.links=h.concat(this.links);if(this.resolveUrls){var p=this;var l=function(F,n){var H={n:0,nu:0,from:[],dt:0};var E=[];var G=[];for(var D=0;D<n.length;D++){if(!contains(E,n[D])){E.push(n[D]);var B=p.urlOccurences[n[D]];if(B){G.push("{"+B.n+","+B.nu+"}");H.n=H.n+B.n;H.nu=H.nu+B.nu;H.dt=H.dt?(H.dt>B.dt?H.dt:B.dt):B.dt;for(var C=0;C<B.from.length;C++){if(!contains(H.from,B.from[C])){H.from.push(B.from[C])}else{H.nu=H.nu-1}}}}}var I=p.urlMetadataOccurences[F.location];if(!I){I={md:F,n:H.n,nu:H.nu,dt:H.dt,from:H.from};p.urlMetadataOccurences[F.location]=I}else{I.n=H.n;I.nu=H.nu;I.dt=H.dt}p.fireMetadatasAvailable();EventsManager.fire({id:"MSG_RESOLVED_LINK",data:I},this)};var f=this.linksDB.getMetadatas(g,l);for(var j in f.metadatas){var A=f.metadatas[j];l(A,this.linksDB.shortUrls[A.location])}}if(u>0){this.fireLinksAvailable(u)}};this.sortFns={n:function(g,f){return g.n<f.n?1:(g.n==f.n?(g.dt<f.dt?1:(g.dt==f.dt?0:-1)):-1)},nu:function(g,f){return g.nu<f.nu?1:(g.nu==f.nu?(g.dt<f.dt?1:(g.dt==f.dt?0:-1)):-1)},nfrom:function(g,f){return g.from.length<f.from.length?1:(g.from.length==f.from.length?(g.dt<f.dt?1:(g.dt==f.dt?0:-1)):-1)},dt:function(g,f){return g.dt<f.dt?1:(g.dt==f.dt?0:-1)}};this.topEntries=function(p,j,i){var l=this.urlOccurences;if(p="md"){l=this.urlMetadataOccurences}var q=[];for(var f in l){var t=l[f];var h=t.n;var o=t.nu;var g=t.dt;var s=t.from;q.push({url:f,md:t.md,from:s,n:h,nu:o,dt:g})}var u=this.sortFns[j];var m=q.sort(u).slice(0,i);return m};this.topUrls=function(g,f){return this.topEntries("url",g,f)};this.topMetadatas=function(g,f){return this.topEntries("md",g,f)};this.feedingPipe.addListener(this)}BaseLinkPipe.factory=function(c,e,b,a,d){return new window[c](e,b,a,true,d)};function PicLinkPipe(d,b,a,c){BaseLinkPipe.apply(this,[d,b,a,true,c]);this.newTweetsAvailable=function(e,h){var n=h.getLatestRichTweets(e);var m=[];for(var g=n.length-1;g>=0;g--){var l=n[g].links;for(var f=0;f<l.length;f++){var o=l[f];if((o.indexOf("http://twitpic.com/")==0&&o.indexOf("http://twitpic.com/photos")<0)||(o.indexOf("http://yfrog.com/")==0)||(o.indexOf("http://twitc.com/")==0)||(o.indexOf("http://mobypicture.com/?")==0)||(o.indexOf("http://tweetphoto.com/")==0)||(o.indexOf("http://www.tweetphoto.com/")==0)||(o.indexOf("http://pic.gd/")==0)){m.push({url:o,from:n[g].from,dt:n[g].created_at_date,text:n[g].text})}}}this.append(m)}}PicLinkPipe.factory=function(c,e,b,a,d){return new window[c](e,b,a,d)};function BasePage(a){this.query=null;this.config=a;this.features={};this.widgetsManager=WidgetManager.getInstance();this.getFeature=function(b){return this.features[b]};this.getUrl=function(){return"/"};this.doLoad=function(d,e,c){if(!this.config.features.advancedFeature){this.config.features.advancedFeature={disabled:true,type:"AdvancedFeature",script:{pipes:[],widgets:[]}}}if(!this.config.features.youtubeFeature){this.config.features.youtubeFeature={disabled:true,type:"YoutubeFeature",title:"Videos",channel:"machinima"}}if(!this.config.features.feedFeature){this.config.features.feedFeature={disabled:true,type:"FeedFeature",title:"Feed",url:"http://twitter.com/statuses/public_timeline.atom"}}if(!this.config.features.googlenewsFeature){this.config.features.googlenewsFeature={disabled:true,type:"GooglenewsFeature",title:"News",query:e}}for(var f in this.config.features){var b=this.config.features[f];this.loadFeature(d,f,b)}c.fadeOut()};this.load=function(d,e){this.query=e;var c=$('<div style="position:absolute;padding:16px;border:1px solid;background-color:white;display:none;"><img src="/images/loadingAnimation.gif"></div>').appendTo("body");c.center();c.show();var b=this;TemplatesManager.getInstance().addTemplates("widgets",function(){b.doLoad(d,e,c)})};this.loadFeature=function(e,f,d){this.dropFeature(f);var c=d.type;var b=window[c]["factory"];if(b){feature=b.apply(null,[c,f,d]);if(feature){this.features[f]=feature;if(!feature.disabled){feature.load(e,this)}}}};this.dropFeature=function(c){var b=this.getFeature(c);if(b){b.drop();delete this.features[c]}};this.getPlaceHolder=function(b,c){return $("#"+b.id+(c?"_"+c:"")+"_PH")};this.selectedFeatureId=null;this.renderController=function(b,c){};this.getQuery=function(){return this.query};this.getUseroverlayQuery=function(){return this.query}}BasePage.factory=function(b,a){return new window[b](a)};function UserPage(h,b,d,a,e,g,f,i,c){BasePage.apply(this,[c]);this.key=h;this.owner=b;this.basequery=a;this.useroverlayQuery=e?e:a;this.lookup=d;this.title=g;this.desc=f;this.skin=i;this.getQuery=function(){return this.basequery+" "+this.query};this.getUseroverlayQuery=function(){return this.useroverlayQuery+" "+this.query};this.getUrl=function(){return"/"+this.owner.screen_name+"/"+this.lookup};this.renderController=function(n,o){var l=[];l.push('<div style="max-height:600px;overflow-x:hidden;overflow-y:auto;">');l.push("<h1>Properties</h1>");l.push('<div class="rounded"><table width="90%">');l.push("<tr><td>Page url</td><td>http://twazzup.com/"+this.owner.screen_name+"/"+this.lookup+" </td></tr>");l.push('<tr><td colspan="2"><form action="/q/page/rename/'+this.key+'" method="post">Change url to <input type="text" name="lookup" value="'+this.lookup+'"/><input type="submit"/></form></td></tr>');l.push('<tr><td colspan="2"><form action="/q/page/giveToUser/'+this.key+'" method="post">Give to <input type="text" name="screen_name" value="'+this.owner.screen_name+'"/><input type="submit"/></form></td></tr>');l.push('<tr><td>Base query</td><td><input style="width:100%" type="text" id="edt_page_query" name="query" value=""/></td></tr>');l.push('<tr><td>Title</td><td><input style="width:100%" type="text" id="edt_page_title" name="title" value=""/></td></tr>');l.push('<tr><td>Desc</td><td><input style="width:100%" type="text" id="edt_page_desc" name="desc" value=""/></td></tr>');l.push('<tr><td colspan="2">CSS</td></tr><tr><td colspan="2"><textarea style="width:100%" rows="6" id="edt_page_skincss" name="skincss">'+(this.skin.css?this.skin.css:"")+"</textarea></td></tr>");l.push('<tr><td colspan="2"><form action="/q/page/skinWithUserCss/'+this.key+'" method="post">Use twitter css from <input type="text" name="screen_name" value="'+this.owner.screen_name+'"/><input type="submit"/></form></td></tr>');l.push('<tr><td colspan="2">Html</td></tr><tr><td colspan="2"><textarea style="width:100%" rows="6" id="edt_page_skinhtml" name="skinhtml">'+(this.skin.html?this.skin.html:"")+"</textarea></td></tr>");l.push('<tr><td colspan="2"><form action="/q/page/setLogo/'+this.key+'" method="post">Logo url <input type="text" name="url" value=""/><input type="submit" value="Get logo"/></form></td></tr>');l.push("</table>");l.push('<form id="edt_page_saveform" action="/q/page/save/'+this.key+'" method="post">');l.push('<input type="hidden" name="query" value="">');l.push('<input type="hidden" name="title" value="">');l.push('<input type="hidden" name="desc" value="">');l.push('<input type="hidden" name="skin" value="">');l.push('<input type="button" value="Save" id="edt_page_save_btn"></form></div></div>');l.push("<h1>Features</h1>");for(var p in this.features){if(!this.features[p].immutable){if(!this.selectedFeatureId){this.selectedFeatureId=p}var m=this.config.features[p].type;l.push("<a href=\"#\" onClick=\"showSlidepane('featureEditor',600,'/q/page/editor/"+this.key+"/"+p+"?t="+m+"');return false;\" >"+p+"<a> ")}}o.html(l.join(""));$("#edt_page_query").val(this.basequery);$("#edt_page_title").val(this.title);$("#edt_page_desc").val(this.desc);var j=this;$("#edt_page_save_btn").click(function(){var v=$("#edt_page_title").val();var t=$("#edt_page_query").val();var s=$("#edt_page_skincss").val();var q=$("#edt_page_skinhtml").val();var u=$("#edt_page_desc").val();$("#edt_page_saveform input[name=title]").val(v);$("#edt_page_saveform input[name=query]").val(t);$("#edt_page_saveform input[name=desc]").val(u);$("#edt_page_saveform input[name=skin]").val(JSON.stringify({css:s,html:q}));$("#edt_page_saveform").submit()})};this.updateFeatureConfigHandler=function(l,j){$("#slide_pane_featureEditor_content").html('<center>Updating config...<br><image src="/images/loading_animation.gif"></center>');$.post("/q/page/update/"+this.key+"/"+l.featureId,{c:JSON.stringify(l.config)},function(m){if(m&&m.result=="OK"){$("#slide_pane_featureEditor_content").html("Page updated, please reload to see changes")}else{$("#slide_pane_featureEditor_content").html("Error while updating page : "+m.error)}},"json")};EventsManager.subscribe(this,function(l,j){return l&&l.config&&l.featureId&&l.id=="MSG_UPDATE_FEATURE_CONFIG"},this.updateFeatureConfigHandler)}UserPage.factory=function(b,a){return new window[b](a.key,a.owner,a.lookup,a.basequery,a.useroverlayQuery,a.title,a.desc,a.skin,a)};function BaseFeature(d,b,c,a){this.id=d;this.config=a;this.disabled=b;this.immutable=c;this.drop=function(){};this.load=function(e,f){};this.setDisabled=function(g,e,f){this.disabled=g;if(g){this.drop()}else{this.load(e,f)}}}BaseFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a)};function PageFeature(f,c,e,b,d,a){BaseFeature.apply(this,[f,c,e,{features:b,titles:d,expanded:a}]);this.features=b;this.titles=d?d:{};this.expanded=a?a:{};this.featureConfigs=function(g,h){return{links:{type:"LinksFeature",immutable:true,title:(this.titles.links?this.titles.links:_LOCALE.msgBundle.links_title),query:h.getQuery(),defaultSort:"nu",expanded:this.expanded.links},picGallery:{type:"PicGalleryFeature",immutable:true,title:(this.titles.picGallery?this.titles.picGallery:_LOCALE.msgBundle.gallery_title),query:h.getQuery(),defaultSort:"nu",nbCol:2,expanded:this.expanded.picGallery}}};this.pipes={};this.load=function(i,q){i.definePipe("realtimePipe",{type:"TwitterSearchPipe",params:{size:1,maxsize:2}});i.definePipe("picsPipe",{type:"PicturesPipe",params:{size:1,maxsize:1,feedingPipe:"realtimePipe"}});i.definePipe("retweetsPipe",{type:"RetweetsPipe",params:{size:1,maxsize:1,feedingPipe:"realtimePipe"}});i.definePipe("linksPipe",{type:"LinksPipe",params:{size:1,maxsize:1,feedingPipe:"realtimePipe"}});var p=q.widgetsManager.createWidget("RealtimeWidget","realtime",i,{placeHolder:q.getPlaceHolder({id:"realtimeFeature"}),pagesize:20,title:(this.titles.realtime?this.titles.realtime:"Twitter")});i.getPipe("realtimePipe").addListener(p);p.pipe=i.getPipe("realtimePipe");p.setup();var s=q.widgetsManager.createWidget("TagsWidget","tagCloud",i,{placeHolder:q.getPlaceHolder(this,"tagCloud"),extractorFn:extractTagsFromTweets,options:{tooltipoverlay:"tags",addPipeQuery:true,maxTagsCount:10,fixedSize:false}});var n=q.widgetsManager.createWidget("TagsWidget","hashtags",i,{placeHolder:q.getPlaceHolder(this,"hashtags"),extractorFn:extractHashtagsFromTweets,options:{tooltipoverlay:"htags",maxTagsCount:10,fixedSize:false}});var m=q.widgetsManager.createWidget("TagsWidget","tickers",i,{placeHolder:q.getPlaceHolder(this,"tickers"),extractorFn:extractTickersFromTweets,options:{tooltipoverlay:"tickers",maxTagsCount:10,fixedSize:false}});var j=q.widgetsManager.createWidget("TagsWidget","attags",i,{placeHolder:q.getPlaceHolder(this,"attags"),extractorFn:extractAttagsFromTweets,options:{tooltipoverlay:"attags",maxTagsCount:10,fixedSize:false}});i.getPipe("realtimePipe").addListener(s);i.getPipe("realtimePipe").addListener(n);i.getPipe("realtimePipe").addListener(j);i.getPipe("realtimePipe").addListener(m);var l=q.widgetsManager.createWidget("TrendsWidget","trends",i,{placeHolder:q.getPlaceHolder({id:"trends"})});l.setup();var h=q.widgetsManager.createWidget("FeaturedWidget","featuredTopics",i,{placeHolder:q.getPlaceHolder({id:"featuredTopics"})});h.setup();var g=q.widgetsManager.createWidget("UsersWidget","users",i,{placeHolder:q.getPlaceHolder({id:"users"}),title:_LOCALE.msgBundle.usersWidget_title});i.getPipe("realtimePipe").addListener(g);g.pipe=i.getPipe("realtimePipe");g.setup();if(b.highlights){var t=q.widgetsManager.createWidget("HighlightsWidget","highlights",i,{placeHolder:q.getPlaceHolder({id:"highlightsFeature"}),title:(this.titles.highlights?this.titles.highlights:_LOCALE.msgBundle.highlights_title),expandable:true});i.getPipe("retweetsPipe").addListener(t);t.pipe=i.getPipe("retweetsPipe");t.setup()}for(var o in this.features){if(b[o]){if(this.featureConfigs(i,q)[o]){q.loadFeature(i,o+"Feature",this.featureConfigs(i,q)[o])}}}i.startPipe("retweetsPipe",true,[{query:q.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}]);i.startPipe("linksPipe",true,[{query:q.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}]);i.startPipe("picsPipe",true,[{query:q.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}]);i.startPipe("realtimePipe",true,[{query:q.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}])}}PageFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.features,a.titles,a.expanded)};function UserPageFeature(e,b,d,a,c){PageFeature.apply(this,[e,b,d,a,c]);this.featureConfigs=function(f,g){return{links:{type:"LinksFeature",immutable:true,title:(this.titles.links?this.titles.links:"Links"),query:g.getQuery(),defaultSort:"dt",userFocus:g.owner.lookup,nbCol:2},picGallery:{type:"PicGalleryFeature",immutable:true,title:(this.titles.picGallery?this.titles.picGallery:"Photos"),query:g.getQuery(),defaultSort:"dt",userFocus:g.owner.lookup,nbCol:2}}};this.load=function(i,q){i.definePipe("realtimePipe",{type:"TwitterSearchPipe",params:{size:1,maxsize:2}});i.definePipe("picsPipe",{type:"PicturesPipe",params:{size:1,maxsize:1,fromUser:q.owner.lookup,feedingPipe:"realtimePipe"}});i.definePipe("retweetsPipe",{type:"RetweetsPipe",params:{size:1,maxsize:1,feedingPipe:"realtimePipe"}});i.definePipe("linksPipe",{type:"LinksPipe",params:{size:1,maxsize:1,fromUser:q.owner.lookup,feedingPipe:"realtimePipe"}});var p=q.widgetsManager.createWidget("RealtimeWidget","realtime",i,{placeHolder:q.getPlaceHolder({id:"realtimeFeature"}),pagesize:20,title:(this.titles.realtime?this.titles.realtime:"Real-time tweets about <b>@"+q.owner.screen_name+(q.query?("</b> and <b>"+q.query):"")+"</b>")});i.getPipe("realtimePipe").addListener(p);p.pipe=i.getPipe("realtimePipe");p.setup();var s=q.widgetsManager.createWidget("TagsWidget","tagCloud",i,{placeHolder:q.getPlaceHolder(this,"tagCloud"),extractorFn:extractTagsFromTweets,options:{tooltipoverlay:"tags",addPipeQuery:true,maxTagsCount:10,fixedSize:false}});var n=q.widgetsManager.createWidget("TagsWidget","hashtags",i,{placeHolder:q.getPlaceHolder(this,"hashtags"),extractorFn:extractHashtagsFromTweets,options:{tooltipoverlay:"htags",maxTagsCount:10,fixedSize:false}});var m=q.widgetsManager.createWidget("TagsWidget","tickers",i,{placeHolder:q.getPlaceHolder(this,"tickers"),extractorFn:extractTickersFromTweets,options:{tooltipoverlay:"tickers",maxTagsCount:10,fixedSize:false}});var j=q.widgetsManager.createWidget("TagsWidget","attags",i,{placeHolder:q.getPlaceHolder(this,"attags"),extractorFn:extractAttagsFromTweets,options:{tooltipoverlay:"attags",maxTagsCount:10,fixedSize:false}});i.getPipe("realtimePipe").addListener(s);i.getPipe("realtimePipe").addListener(n);i.getPipe("realtimePipe").addListener(j);i.getPipe("realtimePipe").addListener(m);var l=q.widgetsManager.createWidget("TrendsWidget","trends",i,{placeHolder:q.getPlaceHolder({id:"trends"})});l.setup();var h=q.widgetsManager.createWidget("FeaturedWidget","featuredTopics",i,{placeHolder:q.getPlaceHolder({id:"featuredTopics"})});h.setup();var g=q.widgetsManager.createWidget("UsersWidget","users",i,{placeHolder:q.getPlaceHolder({id:"users"}),title:"Community",sort:"rt"});i.getPipe("realtimePipe").addListener(g);g.pipe=i.getPipe("realtimePipe");g.setup();if(a.highlights){var t=q.widgetsManager.createWidget("HighlightsWidget","highlights",i,{placeHolder:q.getPlaceHolder({id:"highlightsFeature"}),title:(this.titles.highlights?this.titles.highlights:_LOCALE.msgBundle.highlights_title),expandable:true});i.getPipe("retweetsPipe").addListener(t);t.pipe=i.getPipe("retweetsPipe");t.setup()}for(var o in this.features){if(a[o]){if(this.featureConfigs(i,q)[o]){q.loadFeature(i,o+"Feature",this.featureConfigs(i,q)[o])}}}i.startPipe("retweetsPipe",true,[{query:q.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}]);i.startPipe("linksPipe",true,[{query:q.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}]);i.startPipe("picsPipe",true,[{query:q.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}]);i.startPipe("realtimePipe",true,[{query:q.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}])}}UserPageFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.features,a.titles)};function AntispamFeature(d,b,c,a){BaseFeature.apply(this,[d,b,c,{spammers:a}]);this.spammers=a;this.antispam=defineOnce("ANTISPAM",function(){return new Antispam()});this.load=function(e,f){this.antispam.blackList=this.spammers};this.drop=function(){this.antispam.blackList=[]}}AntispamFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.spammers)};function LogoFeature(d,b,c,a){BaseFeature.apply(this,[d,b,c,{url:a}]);this.url=a;this.load=function(e,f){if(this.url){$("img#pageLogo").attr("src",this.url);$("img#pageLogo").show()}else{$("img#pageLogo").attr("src","/pagelogo/"+f.key);$("img#pageLogo").show()}};this.drop=function(){$("img#pageLogo").hide()}}LogoFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.url)};function ToolbarFeature(d,b,c,a){BaseFeature.apply(this,[d,b,c,{queries:a}]);this.queries=a;this.paint=function(g,j){var f=[];for(var e=0;e<this.queries.length;e++){var h=this.queries[e];f.push('<a href="?q='+encodeURIComponent(h.q)+'" class="tag">'+h.label+"</a>&nbsp;")}return f.join("")};this.load=function(e,f){if(this.queries){$("#toolbar").html(this.paint(e,f));$("#toolbar").show()}else{$("#toolbar").html("");$("#toolbar").hide()}};this.drop=function(){$("#toolbar").hide()}}ToolbarFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.queries)};function AdvancedFeature(d,b,c,a){BaseFeature.apply(this,[d,b,c,{script:a}]);this.script=a;this.load=function(e,f){if(this.script){this.loadPipes(this.script.pipes,e,f);this.loadWidgets(this.script.widgets,e,f);this.startPipes(this.script.pipes,e,f)}};this.loadPipes=function(g,f,h){for(var e=0;e<g.length;e++){var j=g[e];f.definePipe(j.id,{type:j.type,params:{size:1,maxsize:1,feedingPipe:j.feedingpipe?j.feedingpipe:false}})}};this.widgets={};this.loadWidgets=function(j,h,l){for(var g=0;g<j.length;g++){var f=j[g];var e=l.widgetsManager.createWidget(f.type,f.id,h,f.args);this.widgets[f.id]=e;if(f.pipe){var m=h.getPipe(f.pipe);if(m){m.addListener(e);e.pipe=m}}e.setup()}};this.startPipes=function(h,g,j){for(var f=0;f<h.length;f++){var e=h[f];g.startPipe(e.id,e.autorefresh,e.queries)}}}AdvancedFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.script)};function WidgetFeature(e,b,d,c,a){BaseFeature.apply(this,[e,b,d,a]);this.title=c;this.widget=null;this.placeHolder=null;this.load=function(f,g){if(!this.placeHolder){this.placeHolder=g.getPlaceHolder(this)}this.doLoad(f,g)};this.drop=function(){this.placeHolder=null;if(this.widget){this.widget.dispose();this.widget=null}};this.setupWidget=function(f){this.widget=f;f.setup()}}WidgetFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a)};function FeedFeature(e,b,d,c,a){WidgetFeature.apply(this,[e,b,d,c,{title:c,url:a}]);this.url=a;this.doLoad=function(g,h){if(this.url){if(this.title[this.title.length-1]=="/"){this.title=this.title.substring(0,this.title.length-1)}var f=h.widgetsManager.createWidget("FeedWidget","feed",g,{placeHolder:this.placeHolder,title:this.title,expandable:true,url:this.url});this.setupWidget(f)}else{}}}FeedFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.title,a.url)};function GooglenewsFeature(f,a,e,d,b,c){WidgetFeature.apply(this,[f,a,e,d,{title:(d?d:_LOCALE.msgBundle.googlenews_title),query:b,lang:c}]);this.query=b;this.lang=c;this.doLoad=function(h,i){if(this.query){var g=i.widgetsManager.createWidget("GooglenewsWidget","googlenews",h,{placeHolder:this.placeHolder,title:this.title,expandable:true,query:this.query,lang:this.lang});this.setupWidget(g)}else{}}}GooglenewsFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.title,a.query,a.lang)};function YoutubeFeature(e,a,d,c,b){WidgetFeature.apply(this,[e,a,d,c,{title:c,channel:b}]);this.channel=b;this.doLoad=function(g,h){if(this.channel){var f=h.widgetsManager.createWidget("YoutubeWidget","youtube",g,{placeHolder:this.placeHolder,title:this.title,expandable:true,channel:this.channel});this.setupWidget(f)}else{}}}YoutubeFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.title,a.channel)};function PicGalleryFeature(a,d,h,i,g,c,f,b,e){WidgetFeature.apply(this,[a,d,h,i,{title:i,query:g,defaultSort:c,userFocus:f,nbCol:b,expanded:e}]);this.query=g;this.picurlPipe=null;this.defaultSort=c?c:"nu";this.userFocus=f;this.nbCol=b;this.expanded=e;this.doLoad=function(m,n){if(this.picurlPipe==null){var l=m.getPipe("picsPipe");this.picurlPipe=new PicLinkPipe("picurlPipe",m,l,{})}var j=n.widgetsManager.createWidget("LinksWidget2","picGallery",m,{placeHolder:this.placeHolder,title:this.title,expandable:true,expanded:this.expanded,defaultSort:this.defaultSort,defaultMode:"t",size:6,max:30,userFocus:this.userFocus,nbCol:this.nbCol});this.picurlPipe.addListener(j);this.setupWidget(j)}}PicGalleryFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.title,a.query,a.defaultSort,a.userFocus,a.nbCol,a.expanded)};function LinksFeature(h,c,g,f,d,e,b,a){WidgetFeature.apply(this,[h,c,g,f,{title:f,query:d,defaultSort:e,userFocus:b,nbCol:a}]);this.query=d;this.urlPipe=null;this.defaultSort=e?e:"nu";this.userFocus=b;this.nbCol=a;this.doLoad=function(l,m){if(this.urlPipe==null){var j=l.getPipe("linksPipe");this.urlPipe=new BaseLinkPipe("urlPipe",l,j,{})}var i=m.widgetsManager.createWidget("LinksWidget2","links",l,{placeHolder:this.placeHolder,title:this.title,expandable:true,defaultSort:this.defaultSort,defaultMode:"l",size:6,max:30,userFocus:this.userFocus,nbCol:this.nbCol});this.urlPipe.addListener(i);this.setupWidget(i)}}LinksFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.title,a.query,a.defaultSort,a.userFocus,a.nbCol)};function SponsorsFeature(g,b,e,d,c,a,f){WidgetFeature.apply(this,[g,b,e,d,{title:d,query:c,ignoreQuery:a,users:f}]);this.users=f;this.query=c;this.ignoreQuery=a;this.doLoad=function(i,l){i.definePipe("sponsorsPipe",{type:"FromUsersPipe",params:{size:1,maxsize:1,users:this.users}});var m=!i.hasPipe("sponsorsPipe");var h=l.widgetsManager.createWidget("SponsorsWidget","sponsors",i,{placeHolder:this.placeHolder,title:this.title,expandable:true,sponsors:this.users});var j=i.getPipe("sponsorsPipe");j.addListener(h);h.pipe=j;this.setupWidget(h);if(m){if(!this.query&&!this.ignoreQuery){i.startPipe("sponsorsPipe",true,[{query:l.getQuery(),filter:false,ignoreBaseQuery:true,since_id:false}])}else{if(!this.query&&this.ignoreQuery){i.startPipe("sponsorsPipe",true,[{query:"",filter:false,ignoreBaseQuery:true,since_id:false}])}else{i.startPipe("sponsorsPipe",true,[{query:this.query,filter:false,ignoreBaseQuery:true,since_id:false}])}}}}}SponsorsFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.title,a.query,a.ignoreQuery,a.users)};function EditorialFeature(e,b,d,c,a){BaseFeature.apply(this,[e,b,d,{query:c,modules:a}]);this.query=c;this.modules=a;this.widgets={};this.placeHolders={};this.load=function(h,j){for(var g=0;g<this.modules.length;g++){var f=this.modules[g];if(!this.placeHolders[f.id]){this.placeHolders[f.id]=j.getPlaceHolder(this,f.id)}}this.doLoad(h,j)};this.drop=function(){this.placeHolder={};for(var f in this.widgets){this.widgets[f].dispose()}this.widgets={}};this.setupWidget=function(f,g){this.widgets[f]=g;g.setup()};this.doLoad=function(j,m){j.definePipe("editorialPipe",{type:"TwitterSearchPipe",params:{size:1,maxsize:1,refreshdelay:60000}});var n=!j.hasPipe("editorialPipe");for(var h=0;h<this.modules.length;h++){var g=this.modules[h];var l=g.filter;l.params.size=1;l.params.maxsize=1;l.params.feedingPipe="editorialPipe";j.definePipe("editorialPipe_"+g.id,l);var f=new RealtimeWidget("editorial_"+g.id,"RealtimeWidget",j,{placeHolder:this.placeHolders[g.id],args:{pipe:"editorialPipe_"+g.id,expandable:false,title:g.title,pagesize:5}});this.setupWidget(g.id,f);j.getPipe("editorialPipe_"+g.id).plugToFeedingPipe()}if(n){j.startPipe("editorialPipe",true,[{query:this.query,filter:false,ignoreBaseQuery:true,since_id:false}])}}}EditorialFeature.factory=function(b,c,a){return new window[b](c,a.disabled,a.immutable,a.query,a.modules)};function PipeManager(){this.pipes={};this.get=function(a){return this.pipes[a]};this.register=function(a){this.pipes[a.id]=a;return a};this.dispose=function(a){delete this.pipes[a]}}PipeManager.getInstance=function(){return defineOnce("PIPEMANAGER",function(){return new PipeManager()})};function BasePipe(c,a,b){this.id=c;this.twazzup=a;this.params=b;this.manager=PipeManager.getInstance();this.manager.register(this);this.listeners=[];this.addListener=function(d){this.listeners.push(d)};this.removeListener=function(d){this.listeners.splice(this.listeners.indexOf(d),1);if(this.listeners.length==0){this.dispose()}};this.fireNoResultsFound=function(){for(var d=0;d<this.listeners.length;d++){var e=this.listeners[d].noResultsFound;if(typeof(e)!="undefined"){this.listeners[d].noResultsFound(this)}}};this.firePipeStarted=function(){for(var d=0;d<this.listeners.length;d++){var e=this.listeners[d].pipeStarted;if(typeof(e)!="undefined"){this.listeners[d].pipeStarted(this)}}};this.firePipeStoped=function(){for(var d=0;d<this.listeners.length;d++){var e=this.listeners[d].pipeStoped;if(typeof(e)!="undefined"){this.listeners[d].pipeStoped(this)}}};this.fireNewTweetsAvailable=function(d){for(var e=0;e<this.listeners.length;e++){var f=this.listeners[e].newTweetsAvailable;if(typeof(f)!="undefined"){this.listeners[e].newTweetsAvailable(d,this)}}};this.dispose=function(){this.doDispose();this.twazzup.disposePipe(this.id);this.manager.dispose(this.id)};this.doDispose=function(){}}BasePipe.factory=function(b,d,a,c){return new window[b](d,a,c)};function FeededPipe(g,d,a,e,c,f){TwitterSearchPipe.apply(this,[g,d,f]);this.feedingPipe=a;this.pluggedToFeedingPipe=false;this.queriesFilter=e;this.tweetFilter=c;var b=this.append;this.append=function(h){b.apply(this,[h]);if(!this.pluggedToFeedingPipe){this.plugToFeedingPipe()}};this.plugToFeedingPipe=function(){this.pluggedToFeedingPipe=true;this.feedingPipe.addListener(this)};this.newTweetsAvailable=function(j,p){var h=[];var l=p.getLatestRichTweets(j);for(var o=0;o<l.length;o++){var n=l[o];var m=this.tweetFilter(n,this);if(m){h.push(m)}}if(h.length==0){this.fireNewTweetsAvailable(0)}else{this.appendTweets(h)}};this.start=function(i,h){this.queries=this.queriesFilter(h,this);this.currentQueryIndex=0;this.autoRefresh=false;this.refresh(this);this.firePipeStarted()};this.computeStats=function(){if(this.fifo.length>1){this.dates={now:new Date(),latest:Date.parse(this.fifo[0].created_at),oldest:Date.parse(this.fifo[this.fifo.length-1].created_at),mid:Date.parse(this.fifo[Math.floor(this.fifo.length/2)].created_at),durationh:((new Date().getTime())-Date.parse(this.fifo[this.fifo.length-1].created_at))/3600000}}else{this.dates=null}if(this.dates){this.stats={speeds:{avg:this.fifo.length/(this.dates.now-this.dates.oldest)*1000,mid:(this.fifo.length/2)/(this.dates.now-this.dates.mid)*1000},duration:{global:this.dates.now-this.dates.oldest,medium:this.dates.now-this.dates.mid}}}};this.doDispose=function(){if(this.pluggedToFeedingPipe){this.feedingPipe.removeListener(this)}}}FeededPipe.factory=function(c,e,b,d){var a=b.getPipe(d.feedingPipe);return new window[c](e,b,a,d)};function PicturesPipe(d,b,a,c){FeededPipe.apply(this,[d,b,a,c.fromUser?function(g,f){var e=[];for(var h=0;h<g.length;h++){var j=g[h];var l={query:"(pic.gd OR twitpic OR yfrog OR twitc.com OR mobypicture.com OR tweetphoto.com) from:"+c.fromUser+" "+j.query,filter:"links",ignoreBaseQuery:true,since_id:false};e.push(l)}return e}:function(g,f){var e=[];for(var h=0;h<g.length;h++){var j=g[h];var l={query:"(pic.gd OR twitpic OR yfrog OR twitc.com OR mobypicture.com OR tweetphoto.com) "+j.query,filter:"links",ignoreBaseQuery:false,since_id:false};e.push(l)}return e},c.fromUser?function(f,e){if((f.from==c.fromUser)&&(f.text.indexOf("http://twitpic.com/")>=0||f.text.indexOf("http://yfrog.com/")>=0||f.text.indexOf("http://twitc.com/")>=0||f.text.indexOf("http://mobypicture.com/")>=0||f.text.indexOf("http://tweetphoto.com/")>=0||f.text.indexOf("http://www.tweetphoto.com/")>=0||f.text.indexOf("http://pic.gd/")>=0)){return f}return null}:function(f,e){if(f.text.indexOf("http://twitpic.com/")>=0||f.text.indexOf("http://yfrog.com/")>=0||f.text.indexOf("http://twitc.com/")>=0||f.text.indexOf("http://mobypicture.com/")>=0||f.text.indexOf("http://tweetphoto.com/")>=0||f.text.indexOf("http://www.tweetphoto.com/")>=0||f.text.indexOf("http://pic.gd/")>=0){return f}return null},c])}PicturesPipe.factory=FeededPipe.factory;function LinksPipe(d,b,a,c){FeededPipe.apply(this,[d,b,a,c.fromUser?function(g,f){var e=[];for(var h=0;h<g.length;h++){var j=g[h];var l={query:"from:"+c.fromUser+" "+j.query,filter:"links",ignoreBaseQuery:true,since_id:false};e.push(l)}return e}:function(g,f){var e=[];for(var h=0;h<g.length;h++){var j=g[h];var l={query:j.query,filter:"links",ignoreBaseQuery:false,since_id:false};e.push(l)}return e},c.fromUser?function(f,e){if((f.from==c.fromUser)&&f.hasLinks()&&!(f.text.indexOf("http://twitpic.com/")>=0||f.text.indexOf("http://yfrog.com/")>=0||f.text.indexOf("http://twitc.com/")>=0||f.text.indexOf("http://mobypicture.com/")>=0||f.text.indexOf("http://tweetphoto.com/")>=0||f.text.indexOf("http://www.tweetphoto.com/")>=0||f.text.indexOf("http://pic.gd/")>=0)){return f}return null}:function(f,e){if(f.hasLinks()&&!(f.text.indexOf("http://twitpic.com/")>=0||f.text.indexOf("http://yfrog.com/")>=0||f.text.indexOf("http://twitc.com/")>=0||f.text.indexOf("http://mobypicture.com/")>=0||f.text.indexOf("http://tweetphoto.com/")>=0||f.text.indexOf("http://www.tweetphoto.com/")>=0||f.text.indexOf("http://pic.gd/")>=0)){return f}return null},c])}LinksPipe.factory=FeededPipe.factory;function RetweetsPipe(d,b,a,c){FeededPipe.apply(this,[d,b,a,function(g,f){var e=[];for(var h=0;h<g.length;h++){var j=g[h];var l={query:"RT "+j.query,filter:false,ignoreBaseQuery:false,since_id:false};e.push(l)}return e},function(f,e){if(f.isRT){return f}return null},c])}RetweetsPipe.factory=FeededPipe.factory;function ContainsTagPipe(e,c,b,a,d){FeededPipe.apply(this,[e,c,b,function(h,g){var f=[];for(var j=0;j<h.length;j++){var l=h[j];var m={query:g.tag+" "+l.query,filter:false,ignoreBaseQuery:false,since_id:false};f.push(m)}return f},function(g,f){if(g.text.indexOf(f.tag)){return g}return null},d]);this.tag=a}ContainsTagPipe.factory=function(c,e,b,d){var a=b.getPipe(d.feedingPipe);return new window[c](e,b,a,d.tag,d)};function TwitterSearchPipe(c,a,b){BasePipe.apply(this,[c,a,b]);this.twitter=a.twitter;this.size=b.size;this.maxsize=b.maxsize;this.currentQueryIndex=0;this.queries=b.queries;this.refreshdelay=b.refreshdelay?b.refreshdelay:30000;this.getFullQuery=function(){var e="";for(var d=0;d<this.queries.length;d++){e+=this.queries[d].query+" "}return e};this.fifo=[];this.tweets=[];this.autoRefresh=false;this.speed=-1;this.midspeed=-1;this.dates=null;this.stats=null;this.fireTwitterSearchLaunched=function(){for(var d=0;d<this.listeners.length;d++){var e=this.listeners[d].twitterSearchLaunched;if(typeof(e)!="undefined"){this.listeners[d].twitterSearchLaunched(this)}}};this.fireTwitterSearchDone=function(){for(var d=0;d<this.listeners.length;d++){var e=this.listeners[d].twitterSearchDone;if(typeof(e)!="undefined"){this.listeners[d].twitterSearchDone(this)}}};this.getLatestRichTweets=function(d){return this.tweets.slice(0,d)};this.hasTweetsBefore=function(g){var f=false;var e=0;while(!f&&(this.tweets.length>e)){var d=this.getRichTweetAt(e);e++;if(d.id==g){f=true;break}}if(f){return this.tweets.length>e}else{return false}};this.getRichTweetsPage=function(h,d){var g=false;var f=0;while(!g&&(this.tweets.length>f)){var e=this.getRichTweetAt(f);f++;if(e.id==h){g=true;break}}if(g){return this.tweets.slice(f,Math.min(this.tweets.length,d+f))}else{return[]}};this.find=function(h){var g=[];var f={};var j=false;if(h.maxdt){j=h.maxdt}for(var e=0;e<this.tweets.length;e++){var d=this.getRichTweetAt(e);if((!f[d.id])&&(!j||j>=d.created_at_date)){if(h.retweeted){if(containsIgnoreCase(d.rts,h.retweeted)){g.push(d);f[d.id]=true}}else{if(h.attag){if(containsIgnoreCase(d.attags,h.attag)){g.push(d);f[d.id]=true}}else{if(h.from){if(d.from==h.from){g.push(d);f[d.id]=true}}else{if(h.link_filter_fn){if(h.link_filter_fn(d.links)){g.push(d);f[d.id]=true}}else{if(h.text_filter_fn){if(h.text_filter_fn(d.text)){g.push(d);f[d.id]=true}}}}}}}}return g};this.start=function(e,d){this.queries=d;this.currentQueryIndex=0;this.autoRefresh=e;this.refresh(this);this.firePipeStarted()};this.stop=function(){clearTimeout(this.refreshTimeout);this.autoRefresh=false;this.firePipeStoped()};this.refreshTimeout=false;this.refresh=function(e){var f=this.queries[this.currentQueryIndex];this.currentQueryIndex=(this.currentQueryIndex+1)%this.queries.length;this.fireTwitterSearchLaunched();var d=this.fifo.length==0?this.size:1;this.twitter.search(f.query,100,d,analysisCallbackBuilder(function(g){if(g.results&&g.results.length>0){f.since_id=g.results[0].id}e.fireTwitterSearchDone();e.append(g.results);if(e.autoRefresh){this.refreshTimeout=setTimeout(function(){e.refresh(e)},e.refreshdelay)}}),f.since_id,f.ignoreBaseQuery,f.filter)};this.appendTweets=function(e){if(e.length>0){var f=[];for(var d=0;d<e.length;d++){f.push({id:e[d].id,created_at:e[d].created_at})}this.fifo=f.concat(this.fifo);this.tweets=e.concat(this.tweets);this.garbage();this.computeStats();this.fireNewTweetsAvailable(e.length)}else{if(this.fifo.length==0){this.fireNoResultsFound()}}};this.append=function(g){if(g.length>0){var j=[];var h=[];var d=g.length;for(var f=0;f<d;f++){var m=g[f];if(!(this.twazzup.tdb.isBannedSpammer(m.from))){var e=this.twazzup.tdb.load(m);if(e!=null){j.push(e);h.push({id:m.id,created_at:m.created_at})}}}this.fifo=h.concat(this.fifo);if(this.queries.length>1){this.fifo=this.fifo.sort(function(l,i){return(l.id==i.id)?0:((l.id>i.id)?-1:1)})}this.tweets=j.concat(this.tweets);if(this.queries.length>1){this.tweets=this.tweets.sort(function(l,i){return(l.id==i.id)?0:((l.id>i.id)?-1:1)})}this.garbage();this.computeStats();this.fireNewTweetsAvailable(j.length)}else{if(this.fifo.length==0){this.fireNoResultsFound()}}};this.garbage=function(){if(this.fifo.length>(100*this.maxsize)){this.fifo=this.fifo.slice(0,100*this.maxsize);this.tweets=this.tweets.slice(0,100*this.maxsize)}};this.computeStats=function(){if(this.fifo.length>1){this.dates={now:new Date(),latest:Date.parse(this.fifo[0].created_at),oldest:Date.parse(this.fifo[this.fifo.length-1].created_at),mid:Date.parse(this.fifo[Math.floor(this.fifo.length/2)].created_at),durationh:((new Date().getTime())-Date.parse(this.fifo[this.fifo.length-1].created_at))/3600000};this.twazzup.tdb.setMainTimeframeDurationH(this.dates.durationh)}else{this.dates=null}if(this.dates){this.stats={speeds:{avg:this.fifo.length/(this.dates.now-this.dates.oldest)*1000,mid:(this.fifo.length/2)/(this.dates.now-this.dates.mid)*1000},duration:{global:this.dates.now-this.dates.oldest,medium:this.dates.now-this.dates.mid}}}};this.getRichTweetAt=function(d){return this.tweets[d]}}TwitterSearchPipe.factory=BasePipe.factory;function FromUsersPipe(d,a,c,b){TwitterSearchPipe.apply(this,[d,a,b]);this.users=c;this.start=function(p,m){var s=[];var h=3;var f=0;var e="";for(var l=0;l<this.users.length;l++){e+=(f>0?" OR ":"")+"from:"+this.users[l];f++;if(f>h){s.push(e);e="";f=0}}if(e){s.push(e)}var o=[];for(var l=0;l<m.length;l++){var e=m[l];for(var g=0;g<s.length;g++){q2={query:s[g]+" "+e.query,filter:e.filter,ignoreBaseQuery:e.ignoreBaseQuery,since_id:false};o.push(q2)}}this.queries=o;this.currentQueryIndex=0;this.autoRefresh=p;this.refresh(this);this.firePipeStarted()}}FromUsersPipe.factory=function(b,e,a,c){var d=c.users;return new window[b](e,a,d,c)};function TwitterTimelinePipe(c,a,b){TwitterSearchPipe.apply(this,[c,a,b]);this.timelineSince_id=-1;this.refresh=function(e){var f=this.queries[this.currentQueryIndex];this.currentQueryIndex=(this.currentQueryIndex+1)%this.queries.length;this.fireTwitterSearchLaunched();var d=this.fifo.length==0?this.size:1;this.twitter.friendsTimeline(e.timelineSince_id,function(g){if(g.code=="ok"&&g.message){if(g.message.length>0){e.timelineSince_id=g.message[0].id}e.fireTwitterSearchDone();e.append(g.message);if(e.autoRefresh){this.refreshTimeout=setTimeout(function(){e.refresh(e)},60000)}}})};this.append=function(g){if(g.length>0){var j=[];var h=[];var d=g.length;for(var f=0;f<d;f++){var m=g[f];if(!(this.twazzup.tdb.isBannedSpammer(m.user.screen_name))){var e=this.twazzup.tdb.load(m,true);if(e!=null){j.push(e);h.push({id:m.id,created_at:m.created_at})}}}this.fifo=h.concat(this.fifo);if(this.queries.length>1){this.fifo=this.fifo.sort(function(l,i){return(l.id==i.id)?0:((l.id>i.id)?-1:1)})}this.tweets=j.concat(this.tweets);if(this.queries.length>1){this.tweets=this.tweets.sort(function(l,i){return(l.id==i.id)?0:((l.id>i.id)?-1:1)})}this.garbage();this.computeStats();this.fireNewTweetsAvailable(j.length)}else{if(this.fifo.length==0){this.fireNoResultsFound()}}if(this.feedingPipe&&!this.pluggedToFeedingPipe){this.pluggedToFeedingPipe=true;this.feedingPipe.addListener(this)}}}TwitterTimelinePipe.factory=BasePipe.factory;function Player(b,a){this.id=b;this.twazzup=a;this.frame=null;this.linksDB=LinksDB.getInstance();this.history=[];this.currentIndex=0;this.pushItem=function(c){this.history.unshift(c);if(this.history.length>10){this.history=this.history.slice(0,9)}this.currentIndex=0;this.render()};this.setIndex=function(c){this.currentIndex=c;this.render()};this.find=function(e){for(var c=0;c<this.history.length;c++){var d=true;for(k in e){var g=e[k];var f=this.history[c][k];if(g!=f){d=false;break}}if(d){return c}}return-1};this.previewHandler=function(d,c){this.preview(d.href)};this.preview=function(e){var c=this.find({type:"link",key:e});if(c>=0){this.setIndex(c)}else{this.content.prepend("<center><img src='/images/loadingAnimation.gif'></center>");var d=this;var i=function(l,m){var q=l;if(q&&q.meta&&!q.error){var s=q.meta.title?q.meta.title:e;if(s.length>43){s=s.substring(0,40)+"..."}var p='<a href="'+q.url+'" target="_blank"><b>'+s+"</b></a>";var j=[];j.push('<div style="">'+p+'<br><small style="color:#a0a0a0">'+q.location+"</small><br/>");j.push('<div style="max-height:120px;overflow:auto;"><img src="'+q.meta.thumbs[0].src+'" style="float:left;padding:2px;border:1px solid #d0d0d0" width="80"><div style="margin-left:90px;color:#909090">'+q.meta.desc+'</div><div style="clear:both"></div></div>');if(q.meta.video){if(q.meta.video.embed){j.push(q.meta.video.embed)}else{j.push('<embed  type="application/x-shockwave-flash" src="'+q.meta.video.src+'"  width="300" _height="300"></embed>')}}else{if(q.domain=="song.ly"){var o=q.meta.thumbs[0].src;j.push('<object type="application/x-shockwave-flash" data="/flash/player_mp3.swf" width="200" height="20">');j.push('<param name="movie" value="/flash/player_mp3.swf" />');j.push('<param name="FlashVars" value="mp3='+encodeURIComponent(q.location)+'" />');j.push("</object>")}else{if(q.domain&&q.domain.indexOf("flickr.com")>=0){var o=q.meta.thumbs[0].src;j.push('<div class="_linkMedia" style="position:relative;"><img src="'+o+'" style="width:100px;margin-top:5px"></div>')}}}j.push("</div>");var n={type:"link",key:e,loc:q.location,html:j.join(""),name:s,htitle:p,bit_ly_stats:null};if(e.indexOf("http://bit.ly/")==0){BitlyCB.statsResponse=function(t){n.bit_ly_stats=t.results;d.pushItem(n)};BitlyClient.stats(e,"BitlyCB.statsResponse")}else{d.pushItem(n)}}else{var s=e;if(s.length>43){s=s.substring(0,40)+"..."}var p='<a href="'+e+'" target="_blank"><b>'+s+"</b></a>";var j=[];j.push('<div style="">'+p+"<br/>");j.push('<div style="max-height:120px;overflow:auto;"><img src="http://open.thumbshots.org/image.pxf?url='+encodeURIComponent(e)+'" style="float:left;padding:2px;border:1px solid #d0d0d0" width="80"><div style="margin-left:90px;color:#909090">-</div><div style="clear:both"></div></div>');j.push("</div>");var n={type:"link",key:e,loc:e,html:j.join(""),name:s,htitle:p,bit_ly_stats:null};if(e.indexOf("http://bit.ly/")==0){BitlyCB.statsResponse=function(t){n.bit_ly_stats=t.results;d.pushItem(n)};BitlyClient.stats(e,"BitlyCB.statsResponse")}else{d.pushItem(n)}}};var g=this.linksDB.getMetadatas([{url:e,text:""}],i);for(var f in g.metadatas){var h=g.metadatas[f];i(h,this.linksDB.shortUrls[h.location])}}showSlidepane("player")};this.render=function(){var m=[];for(var h=0;h<this.history.length;h++){var v=this.history[h];if(h==this.currentIndex){m.push('<div class="rounded selectedPreview"  style="padding:4px;line-height: 1.2em; font-size: 0.9em;margin-bottom:4px;" >'+v.html)}else{m.push('<div class="rounded" style="padding:4px;line-height: 1.2em; font-size: 0.8em;margin-bottom:4px;">'+v.htitle);m.push('<small> &middot; <a href="#" index="'+h+'" class="setIndexBtn">show</a></small>')}if(v.bit_ly_stats&&h==this.currentIndex){m.push('<div style="margin-top:4px">');var n=v.bit_ly_stats;var g=[];var t=0;for(var d in n.referrers){var s=n.referrers[d];var q=0;for(var w in s){var p=s[w];q+=p;t+=p}if(!d){d=""}g.push({ref:d?d:"Direct,E-mail ...",c:q})}g.sort(function(i,c){return(i.c==c.c?0:((i.c<c.c)?1:-1))});m.push('<a href="http://bit.ly/info/'+n.hash+'" target="_blank">'+t+" Clicks</a>");m.push("</div>")}if(h==this.currentIndex){var j=this.linksDB.getTweets(v.loc);if(j.length>0){if(j.length>1){m.push('<a href="#" onClick="$(\'#relatedTweetsForPrev\').toggle();return false;">'+j.length+" Related tweets</a>")}else{m.push('<a href="#" onClick="$(\'#relatedTweetsForPrev\').toggle();return false;">1 Related tweet</a>')}var o=['<div id="relatedTweetsForPrev" style="display:none;margin-top:4px;max-height:200px;overflow:auto;font-size:.8em;line-height:1.1em;background-color:#f5f5f5;border:1px inset #d0d0d0">'];for(var f=0;f<j.length;f++){renderTweet(j[f],o,{userBubble:false});for(var e=0;e<j[f].retweets.length;e++){renderTweet(j[f].retweets[e],o,{userBubble:false})}}o.push("</div>");m.push(o.join(""))}}m.push("</div>")}this.content.html(m.join(""));activateTweetsBehaviors(this.twazzup,this.content);var u=this;$("embed",this.frame).attr("width","274");$("embed",this.frame).attr("height","200");this.content.find("a.setIndexBtn").click(function(){var c=$(this).attr("index");u.setIndex(c);return false});showSlidepane("player");$(".selectedPreview").effect("highlight",{},1000)};this.play=function(f,d){var c=this.find({type:"media",key:f});if(c>=0){this.setIndex(c)}else{var e='<a href="#"><b>'+f+"</b></a>";this.pushItem({type:"media",key:f,html:unescape(d),name:f,htitle:e,bit_ly_stats:null})}};this.close=function(){};$("div#slide_pane_player").html("");this.frame=$("div#slide_pane_player");this.content=$('<div style="line-height:1.2em;padding:0"></div>').appendTo(this.frame);EventsManager.getInstance().subscribe(this,function(d,c){return d&&d.href&&d.id=="MSG_SHOW_LINK_PREVIEW"},this.previewHandler)}function renderTweet(j,e,l){var c=$.extend({inlineTwitpic:true,pinnable:true,actionable:true,userBubble:true,highlight:false},l);if(!e){e=[]}var g=null;for(var d=0;d<j.links.length;d++){var f=j.links[d];var h=null;if(f.indexOf("http://twitpic.com/")==0){g={th:"http://twitpic.com/show/thumb/"+f.substring("http://twitpic.com/".length),lnk:f};break}else{if(f.indexOf("http://yfrog.com/")==0){var i=/http:\/\/yfrog.com\/([a-z0-9A-Z]+)$/.exec(f);if(i){thumb="http://yfrog.com/"+i[1]+".th.jpg";g={th:"http://yfrog.com/"+i[1]+".th.jpg",lnk:f};break}}else{if(f.indexOf("http://twitc.com/")==0){var i=/http:\/\/twitc.com\/([a-z0-9A-Z]+)$/.exec(f);if(i){thumb="http://twitc.com/ii3/"+i[1].substring(1)+".jpg";g={th:thumb,lnk:f};break}}else{if(f.indexOf("http://mobypicture.com/?")==0){thumb="http://api.mobypicture.com/?t="+encodeURIComponent(f)+"&s=small&k=tw444zzup&format=plain";g={th:thumb,lnk:f};break}else{if(f.indexOf("http://www.tweetphoto.com/")==0){var i=/http:\/\/www.tweetphoto.com\/([a-z0-9A-Z]+)$/.exec(f);if(i){thumb="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=thumbnail&url=http://tweetphoto.com/"+i[1];g={th:thumb,lnk:f};break}}else{if(f.indexOf("http://tweetphoto.com/")==0){var i=/http:\/\/tweetphoto.com\/([a-z0-9A-Z]+)$/.exec(f);if(i){thumb="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=thumbnail&url=http://tweetphoto.com/"+i[1];g={th:thumb,lnk:f};break}}}}}}}}var b="";if(j.rts.length>0){tweetclass="retweet"}else{if(j.to){tweetclass="replyto"}else{tweetclass="simple"}}if(j.spamWeight>0.75){tweetclass+=" bigspam"}else{if(j.spamWeight>0.5){tweetclass+=" spam"}else{if(j.spamWeight>0.25){tweetclass+=" medspam"}else{if(j.spamWeight>0){tweetclass+=" lowspam"}}}}e.push("<div class='tweet "+tweetclass+" "+(c.pinnable?"pinnable":"")+" "+(c.actionable?"actionable":"")+"' from='"+j.from+"' tweetid='"+j.id+"'>");e.push("<div class='sourcetext'>"+j.text+"</div>");e.push("<div class='picture'><img class='userInfos "+(c.userBubble?"userBubble":"")+" "+(c.highlight?"highlight":"")+"' src='"+j.from_picture+"' userid='"+j.from+"'></div>");e.push("<div class='from'><a class='"+(c.userBubble?"userBubble":"")+"' href='/"+j.from+"' userid='"+j.from+"'>"+j.from+"</a>");e.push("</div>");if(g&&c.inlineTwitpic){e.push("<a class='inlinedPic' target='_blank' href='"+g.lnk+"' ><img src='"+g.th+"' style='width:48px;border:0'></a><div class='text tagsoup' style='padding-right:70px'>"+j.enrichedText+"</div><div class='conversations'></div>")}else{e.push("<div class='text tagsoup'>"+j.enrichedText+"</div><div class='conversations'></div>")}e.push("<div class='meta'><span class='light'><a href='http://twitter.com/"+j.from+"/statuses/"+j.id+"' target='_blank' class='tweetViewAction'><span class='date' date='"+j.created_at+"'>"+relative_time(j.created_at)+" </span></a> from <a href='"+j.source.href+"' target='blank'>"+j.source.label+"</a> </span>");if(c.actionable){e.push("<span class='tweetAction'> &middot; <a href='#' class='tweetRetweetAction'>Retweet</a> &middot; <a href='#' class='tweetReplyAction'>"+_LOCALE.msgBundle.reply_action+"</a> &middot; <a href='#' class='favoriteAction'>"+_LOCALE.msgBundle.favorite_action+"</a> &middot; <a href='#' class='translateAction'>"+_LOCALE.msgBundle.translate_action+"</a> <a href='#' class='originalText' style='display:none'>"+_LOCALE.msgBundle.untranslate_action+"</a> </span></div>")}else{e.push("</div>")}e.push("</div>");var a=e.join("");return a}function activateTweetElementsBehavior(a,b){b.each(function(){activateTweetElementBehaviors(a,$(this))})}function activateTweetsBehaviors(b,a){$(".tweet",a).each(function(){activateTweetElementBehaviors(b,$(this))})}function activateTweetElementBehaviors(b,a){if(a.hasClass("actionable")){activateActionableBehavior(b,a)}}function activateActionableBehavior(b,a){var c=function(d){return function(){var e=$(this).parents(".tweet");var f=e.attr("tweetid");var g=d.getWidget("clipboard");if(g){var h=d.tdb.get(f);if(h){g.select(h)}}return false}};a.find("a.copyTweetAction").click(c(b));a.find("a.favoriteAction").click(function(){var d=$(this).parents(".tweet");var e=d.attr("tweetid");$.get("/favorites/create/"+e,{},function(f){if(f.code){if(f.code=="ok"){notify("Added to your favorites")}else{notify("Could not add to favorites")}}},"json");return false});a.find("a.originalText").click(function(){var e=$(this).parents(".tweet");var i=e.find(".sourcetext").text();var f=e.attr("tweetid");var h=$(".tweet[tweetid="+f+"]");var d=h.find(".text.tagsoup");var g=h.find(".conversations");d.slideDown();g.slideUp();h.find("a.translateAction").show();h.find("a.originalText").hide();return false});a.find("a.translateAction").click(function(){var e=$(this).parents(".tweet");var j=e.find(".sourcetext").text();var f=e.attr("tweetid");var i=$(".tweet[tweetid="+f+"]");var d=i.find(".text.tagsoup");var g=i.find(".conversations");i.find("a.originalText").show();i.find("a.translateAction").hide();var h=b.config.locale.uilang;if(!h){h="en"}$.translate(j,h,{complete:function(l){g.text(l);d.slideUp();g.slideDown()}});return false});a.find("a.tweetRetweetAction").click(function(){var d=$(this).parents(".tweet");var f=d.attr("from");var e=d.find(".sourcetext").text();b.getWidget("twitterTool").retweet("RT @"+f+": "+e+" (via @twazzup)");return false});a.find("a.tweetReplyAction").click(function(){var d=$(this).parents(".tweet");var f=d.attr("from");var e=d.attr("tweetid");b.getWidget("twitterTool").reply(f,e,b.tdb.get(e).hashtags);return false});a.bind("mouseenter",function(){$(this).find(".tweetAction").show()});a.bind("mouseleave",function(){$(this).find(".tweetAction").hide()})}function SavedQueriesWidget(){this.quickSaveSearch=function(){var a=this;var c=$("#searchBox").val();var d=_LOCALE.lang;var b=c;if(b){$.post("/q/",{q:c,lang:d,name:b},function(e){if(e.has_error){alert("No possible to save this search")}else{notify(_LOCALE.msgBundle.search_saved_notification);showSlidepane("savedsearch")}},"json")}};this.setupControls=function(){var a=this;$(".saveSearchButton").click(function(){var b=$(this);a.quickSaveSearch();return false})};this.isDisplayed=false;this.setupControls()}defineOnce("TWEETPARSER",function(){return new TweetParser()});function TwitterTool(e,d){this.id=e;this.twazzup=d;this.container=null;this.popup=null;this.directMessage=function(){var g={};var f=this;g.text=$("#twitterToolField_status").val();if(g.text){$.post("/direct_messages/send/"+$("#twitterToolField_in_reply_to").val(),g,function(h){if(h.code){if(h.code=="error"){if(h.message=="no_text"){notify("Text must not be empty")}else{if(h.message=="no_user_id"){notify("Must DM to someone")}else{if(h.message=="not_signed_in"){notify("Not signed in... please sign in")}else{notify("unknown error "+h.message)}}}}else{if(h.code=="ok"){notify("Tweet sent :)");f.close()}else{notify("Unknown return code : "+h.code)}}}else{notify("Unknown response "+h.toSource())}},"json")}};this.reportSpam=function(f,g){var h={spammer:f,tweet_id:g};$.post("/q/spam/report",h,function(i){if(i.code){if(i.code=="error"){if(i.message=="no_status"){notify("Status must not be empty")}else{if(i.message=="not_signed_in"){notify("Not signed in... please sign in")}else{notify("unknown error "+i.message)}}}else{if(i.code=="ok"){notify(f+" has been reported as a spammer");b.close()}else{notify("Unknown return code : "+i.code)}}}else{notify("Unknown response "+i.toSource())}},"json")};this.updateStatus=function(){var g={};var f=this;g.status=$("#twitterToolField_status").val();g.in_reply_to_status_id=$("#twitterToolField_in_reply_to_status_id").val();if(g.status){$.post("/status/update",g,function(h){if(h.code){if(h.code=="error"){if(h.message=="no_status"){notify("Status must not be empty")}else{if(h.message=="not_signed_in"){notify("Not signed in... please sign in")}else{notify("unknown error "+h.message)}}}else{if(h.code=="ok"){notify("Tweet sent :)");f.close()}else{notify("Unknown return code : "+h.code)}}}else{notify("Unknown response "+h.toSource())}},"json")}};this.reply=function(h,g,f){$("#twitterToolField_status").val("@"+h+"  "+f.join(" "));$("#twitterToolField_in_reply_to").val(h);$("#twitterToolField_in_reply_to_status_id").val(g);this.checkStatus();this.show();$("#twitterToolField_status").focus().caret(h.length+2)};this.retweet=function(f){$("#twitterToolField_status").val(f);$("#twitterToolField_in_reply_to").val("");$("#twitterToolField_in_reply_to_status_id").val("");this.checkStatus();this.show()};this.tweet=function(f){$("#twitterToolField_status").val(f);$("#twitterToolField_in_reply_to").val("");$("#twitterToolField_in_reply_to_status_id").val("");this.checkStatus();this.show()};this.checkStatus=function(){var f=$("#twitterToolField_status").val();if(f){$("#twitterToolField_statusCounter").text(140-f.length);if(f.length>140){$("#twitterToolField_statusCounter").addClass("error");$("#twitterToolField_status").addClass("error");$("input[type=button].needsValidText",this.popup).attr("disabled","disabled")}else{$("#twitterToolField_statusCounter").removeClass("error");$("#twitterToolField_status").removeClass("error");$("input[type=button].needsValidText",this.popup).removeAttr("disabled")}}else{$("#twitterToolField_statusCounter").text("140");$("#twitterToolField_statusCounter").removeClass("error");$("#twitterToolField_status").removeClass("error");$("input[type=button].needsValidText",this.popup).removeAttr("disabled")}};this.clear=function(){var f=TWEETPARSER.parseText(this.twazzup.query).htags.join(" ");$("#twitterToolField_status").val(f);$("#twitterToolField_in_reply_to").val("");$("#twitterToolField_in_reply_to_status_id").val("")};this.close=function(){hideSlidepane();this.clear()};this.show=function(){showSlidepane("tweet")};var c=[];var a=TWEETPARSER.parseText(this.twazzup.query).htags.join(" ");c.push('<div id="twitterToolFormContainer">');c.push('<form id="twitterToolForm"><textarea maxlength="140" id="twitterToolField_status" style="width:100%;font-size:1em;margin-bottom:5px" rows="6" >'+a+'</textarea><input type="hidden" value="" id="twitterToolField_in_reply_to"><input type="hidden" value="" id="twitterToolField_in_reply_to_status_id">');c.push('<div id="twitterToolField_statusCounter">140</div><div style="text-align:right"><input type="button" id="twitterToolSubmit_Tweet" name="updateStatus" value=" Send " disabled="true" class="needsValidText" style="font-size:1em"></div><input type="button" id="twitterToolSubmit_DM" name="DM" value="DM" disabled="true" style="display:none" class="needsValidText">');c.push("</form></div>");$("div#tweet_form").append(c.join(""));var b=this;$("#twitterToolField_status").keyup(function(f){b.checkStatus()});$("#twitterToolForm").submit(function(){return false});$("#twitterToolCancel").click(function(){b.close();return false});$("#twitterToolSubmit_Tweet").click(function(){b.updateStatus();return false});$("#twitterToolSubmit_DM").click(function(){b.directMessage();return false})}function OverlayManager(){this.overlays={};this.registerOverlay=function(a){this.overlays[a.id]=a};this.hideAll=function(){for(var b in this.overlays){var a=this.overlays[b];a.hide()}};this.dispose=function(a){delete this.overlays[a]}}OverlayManager.getInstance=function(){return defineOnce("OVERLAYMANAGER",function(){return new OverlayManager()})};function Overlay(a){this.id=a;this.manager=OverlayManager.getInstance();this.manager.registerOverlay(this)}function Scrolling(c,b,a){this.id=c;this.frame=b;this.twazzup=a;this.frame.html("<div id='pane_"+this.id+"'></div>");this.pane=$("#pane_"+this.id);this.pane.html("<div id='injectionDiv_"+this.id+"'></div>");this.pane.append("<div id='injectedDiv_"+this.id+"' style='display:inline-block;width:100%'></div>");this.injectionDiv=$("#injectionDiv_"+this.id,this.pane);this.injectedDiv=$("#injectedDiv_"+this.id,this.pane);this.init=function(){this.frame.css("overflow","hidden");this.frame.css("position","relative")};this.append=function(e,f){var d=$(e).appendTo(this.injectedDiv);this.frame.css("height",this.injectedDiv.height());if(f){f(this.injectedDiv,d)}};this.injectAll=function(f,d,g){var e=this;this.inject(f.join(""),d,g)};this.injectList=function(h,i,d,j,f){if(h.length>0){if(!f){f=i/h.length}var e=this;var g=function(l,m){j(l,m);e.injectList(h.slice(0,h.length-1),i,d,j,f)};this.inject(h[h.length-1],d,g,f)}};this.inject=function(g,d,j,f){var e=this;this.injectionDiv.html(g);var i=this.injectedDiv.height();if(i>0){this.frame.css("height",this.injectedDiv.height())}this.pane.css("margin-top",-this.injectionDiv.height());if(!f){f=100}this.pane.animate({marginTop:0},f,function(){var h=e.injectionDiv.html();e.injectionDiv.html("");var l=$(h).prependTo(e.injectedDiv);e.injectedDiv.find(".tweet:gt("+(d-1)+")").remove();e.frame.css("height",e.injectedDiv.height());if(j){j(e.injectedDiv,l)}})};this.init()}function InfoWidget(b,a){Overlay.apply(this,[b]);this.component=null;this.options=$.extend({},{cssClass:"infos",trigger:{event:"click",eventDelay:0,selector:".infoTrigger"},beforeShow:function(c,d){},afterShow:function(c,d){},beforeHide:function(c){},afterHide:function(c){},clickOnFocus:function(c,d){}},a);this.setText=function(c){this.text.text(c)};this.init=function(){var c=this;var d=[];d.push('<a href="#" onClick="return false;" id="infoWidget'+this.id+'" style="position:absolute;display:none;padding:4px;background-color:white;border:1px solid #a0a0a0;text-align:center"><span id="infoBubbleText"></span></a>');$("body").append(d.join(""));this.component=$("#infoWidget"+this.id);this.text=$("#infoBubbleText");this.component.click(function(){c.options.clickOnFocus(c.focus,c)});if(this.options.trigger.eventDelay>0){var f=this;$(this.options.trigger.selector).live(this.options.trigger.event+"InfoDelayed",function(){f.show($(this))});var e=function(g){return function(){g.trigger(f.options.trigger.event+"InfoDelayed")}};$(this.options.trigger.selector).live("mouseout",function(){if(!$(this).hasClass("arrow")){clearTimeout(f.delayTimeout);f.hideDelayTimeout=setTimeout(function(){f.hide()},500)}});$(this.options.trigger.selector).live(this.options.trigger.event,function(){if(!$(this).hasClass("arrow")){f.delayTimeout=setTimeout(e($(this)),f.options.trigger.eventDelay)}})}else{$(this.options.trigger.selector).live(this.options.trigger.event,function(){if(!$(this).hasClass("arrow")){if(!f.isVisible){f.show($(this))}else{f.hide()}}})}$(this.options.trigger.selector).live("mouseover",function(){if(!$(this).hasClass("arrow")){clearTimeout(f.hideDelayTimeout)}});var f=this;this.component.mouseenter(function(){clearTimeout(f.hideDelayTimeout)});this.component.mouseleave(function(){f.hideDelayTimeout=setTimeout(function(){f.hide()},500)})};this.isVisible=false;this.focus=null;this.show=function(c){this.isVisible=true;this.focus=c;this.options.beforeShow(c,this);this.component.show();this.options.afterShow(c,this)};this.hide=function(){this.focus=null;this.options.beforeHide(this);this.component.hide();this.options.afterHide(this);this.isVisible=false};this.delayTimeout=null;this.hideDelayTimeout=null}function BubbleWidget(b,a){Overlay.apply(this,[b]);this.bubble=null;this.arrow=null;this.bubbleContent=null;this.options=$.extend({},{cssClass:"bubble",trigger:{event:"click",eventDelay:0,selector:".bubbleTrigger"},beforeShow:function(c,d){},afterShow:function(c,d){},beforeHide:function(c){},afterHide:function(c){}},a);this.highlighBubbled=function(d){if(!this.options.hideBubbled){var e=d.offset();var c=this.bubble.offset();this.arrow.css({top:c.top-6,left:e.left-8+d.outerWidth()/2,zIndex:999999});this.arrow.show()}else{this.arrow.hide()}};this.isVisible=false;this.show=function(c){this.isVisible=true;this.options.beforeShow(c,this);this.bubble.show();this.options.afterShow(c,this);this.highlighBubbled(c)};this.hide=function(){this.options.beforeHide(this);this.bubble.hide();this.arrow.hide();this.options.afterHide(this);this.isVisible=false};this.getBubbleContent=function(){return this.bubbleContent};this.delayTimeout=null;this.hideDelayTimeout=null;this.init=function(){var c=[];c.push('<div id="arrow_'+this.id+'" style="position:absolute;display:none;"><img src="/images/bubble_arrow.png"></div>');c.push('<div id="'+this.id+'" class="'+this.options.cssClass+' bubble"><div id="'+this.id+'Content" class="bubbleContent"><div class="bubbleInnerContent"></div></div><div id="'+this.id+'Bottom"></div></div>');$("body").append(c.join(""));this.bubble=$("#"+this.id);this.arrow=$("#arrow_"+this.id);this.bubbleContent=$(".bubbleInnerContent",this.bubble);if(this.options.trigger.eventDelay>0){var e=this;$(this.options.trigger.selector).live(this.options.trigger.event+"Delayed",function(){e.show($(this))});var d=function(f){return function(){f.trigger(e.options.trigger.event+"Delayed")}};$(this.options.trigger.selector).live("mouseout",function(){if(!$(this).hasClass("arrow")){clearTimeout(e.delayTimeout);e.hideDelayTimeout=setTimeout(function(){e.hide()},500)}});$(this.options.trigger.selector).live(this.options.trigger.event,function(){if(!$(this).hasClass("arrow")){e.delayTimeout=setTimeout(d($(this)),e.options.trigger.eventDelay)}})}else{$(this.options.trigger.selector).live(this.options.trigger.event,function(){if(!$(this).hasClass("arrow")){if(!e.isVisible){e.show($(this))}else{e.hide()}}})}$(this.options.trigger.selector).live("mouseover",function(){if(!$(this).hasClass("arrow")){clearTimeout(e.hideDelayTimeout)}});var e=this;this.arrow.mouseenter(function(){clearTimeout(e.hideDelayTimeout)});this.arrow.mouseleave(function(){e.hideDelayTimeout=setTimeout(function(){e.hide()},500)});this.bubble.mouseenter(function(){clearTimeout(e.hideDelayTimeout)});this.bubble.mouseleave(function(){e.hideDelayTimeout=setTimeout(function(){e.hide()},500)})}}function PopupButton(e,b){this.button=e;this.options=b;this.optionsDiv=$("<ul class='buttonOptions'></ul>").insertAfter(this.button);this.optionsDiv.css({position:"absolute",display:"none"});this.showOptions=function(){this.optionsDiv.slideDown()};var a=this;for(var d=0;d<this.options.length;d++){var c=this.options[d];this.optionsDiv.append("<li>"+c.label+"</li>")}this.button.click(function(){a.showOptions();return false})}function SlidePane(){this.selectedPane=null;this.getPane=function(a){return $("div#slide_pane_"+a)};this.togglePane=function(c,b,a){if(c==this.selectedPane){this.hidePanes()}else{this.showPane(c,b,a)}};this.showPane=function(b,e,a){OverlayManager.getInstance().hideAll();if(this.selectedPane!=b){this.selectedPane=b;$("div#slide_pane_buttons div.btn").removeClass("selected");$("div#slide_pane_button_"+b).addClass("selected");$("div.slide_pane_content").hide();var c=$("div#slide_pane_"+b).attr("title");if(!c){c=""}$("#slide_pane_title").text(c);if(!e){e=356}var f=$("div#body_wrapper");var h=$("body").width();var d=$("div#slide_pane_wrapper");var i=this.getPane(b);var g=i.find("form.onDisplayPaneForm");i.show();d.animate({right:0,width:e},500);f.animate({width:h-300,marginRight:300},500);g.each(function(){var j=$($(this).attr("target"));j.html("<center><br><br><img src='/images/loadingAnimation.gif'></center>");if(a){$(this).attr("action",a)}$.get($(this).attr("action"),$(this).serializeArray(),function(l){j.html(l)})})}};this.hidePanes=function(){this.selectedPane=null;$("div#slide_pane_buttons div.btn").removeClass("selected");$("#slide_pane_title").text("");var a=$("div#body_wrapper");var b=$("body").width();var c=$("div#slide_pane_wrapper");c.animate({right:-300,width:356},500,function(){$("div.slide_pane_content").hide()});a.animate({width:b,marginRight:0},500)}}var SLIDEPANE=new SlidePane();function toggleSlidepane(c,b,a){SLIDEPANE.togglePane(c,b,a)}function showSlidepane(c,b,a){SLIDEPANE.showPane(c,b,a)}function hideSlidepane(){SLIDEPANE.hidePanes()}function analysisCallbackBuilder(a){return function(e){var d={results:[]};for(var c=0;c<e.length;c++){for(var b=0;b<e[c].length;b++){d.results.push(e[c][b])}}a(d)}}function Twazzup(a){this.widgetsManager=WidgetManager.getInstance();this.trends=[];this.config={};$.extend(this,a);this.page=null;this.featured=this.config.widgets.featured;this.trends=this.config.widgets.trends;this.query=null;this.twitter=null;this.tdb=null;this.pipes={};this.pipeOptions={};this.disposePipe=function(b){delete this.pipes[b]};this.hasPipe=function(b){return this.pipes[b]!=null};this.definePipe=function(c,b){this.pipeOptions[c]=b};this.getPipe=function(b){if(!b){return null}if(this.pipes[b]){return this.pipes[b]}else{return this.createPipe(b,this.pipeOptions[b])}};this.setPipe=function(b){this.pipes[b.id]=b};this.createPipe=function(g){var f=this.pipeOptions[g];if(f){var d=f.type;var e=f.params;if(d){var c=null;var b=window[d].factory;if(b){c=b.apply(null,[d,g,this,e])}if(c){this.pipes[g]=c}return c}}return null};this.plugToPipe=function(d,c){var b=this.getPipe(d);if(b){c.pipe=b;b.addListener(c);return b}else{return null}};this.startPipe=function(e,c,b){var d=this.getPipe(e);if(d){if(!b){b=[{query:this.query,filter:false,ignoreBaseQuery:false,since_id:false}]}d.start(c,b)}};this.getWidget=function(b){return this.widgetsManager.get(b)};this.getWidgetClass=function(d){for(var c=0;c<d.length;c++){var b=d[c];if(b.indexOf("wclass_")==0){return b.split("_",2)[1]}}return null};this.initPage=function(c,f){var e=null;var d=c.type;var b=window[d].factory;if(b){e=b.apply(null,[d,c]);e.load(this,f)}return e};this.init=function(c,d){var b=this;this.query=d;this.tdb=new TweetDB(this);this.twitter=this.createTwitter(c);this.widgetsManager.register(new Player("player",this));this.widgetsManager.register(this.createUserInfosBubble()).init();this.widgetsManager.register(new TwitterTool("twitterTool",this));this.installPreviewLinkBtn();if(c.page){this.page=this.initPage(c.page,d)}this.startTrendUpdater(60000)};this.installPreviewLinkBtn=function(){var b=this;$("a.previewLinkBtn").live("click",function(){var c=$(this).attr("href");EventsManager.getInstance().fire({id:"MSG_SHOW_LINK_PREVIEW",href:c});return false})};this.createUserInfosBubble=function(){var b=this;var c=new BubbleWidget("userInfosTooltip",{userInfos:{},fillPopup:function(f,d,m){var l=f.options.userInfos[d];if(l){var i=f.getBubbleContent();var g=[];g.push('<div class="userPic"><img width="73" height="73" src="'+l.profile_image_url+'"/>');g.push('<a href="#" target="_blank" id="userFollow" style="display:none">Follow</a>');g.push('<a href="#" target="_blank" id="userUnFollow" style="display:none">Un-follow</a></div>');g.push('<div class="userInfo">');g.push("<div>");if(l.name&&l.name.toLowerCase()!=d.toLowerCase()){g.push('<span class="userName">'+l.name+"</span> - ")}g.push('<b><a href="/'+d+'" class="userScreenName" title="@'+d+' on twitter">'+d+"</a></b></div>");g.push('<div class="userCount"><b>'+l.followers_count+'</b> followers / <span id="friendsCount"><b>'+l.friends_count+"</b> friends</span></div>");if(l.location){g.push('<div class="userLocation"><b>Location</b> '+l.location+"</div>")}if(l.url){var e=l.url;if(e.length>30){e=e.substr(0,27)+"..."}g.push('<div class="userUrl"><b>Web</b> <a href="'+l.url+'" target="_blank">'+e+"</a></div>")}if(l.description){g.push("<div class='userDesc'><b>Bio</b> "+l.description+"</div>")}g.push("</div>");g.push('<div id="latestTweetsTitle" style="display:none;font-size:.8em;clear:both;background-color:#f5f5f5;font-weight:bold;padding:4px 8px;margin-top:5px"></div>');g.push("<div id='latestTweets' style='position:relative;font-size:.8em;max-height:200px;overflow:hidden;overflow-x:auto;overflow-y:auto;background-color:#fff;border:1px solid #f5f5f5;clear:both'>");g.push("<center>Getting latest tweets for "+$("#searchBox").val()+"<br><img src='/images/loadingAnimation.gif'></center>");g.push("</div>");if(l.status){}i.html(g.join(""));var h=function(o){return function(p){if(p.code=="ok"){notify("You are now following "+o)}else{if(p.message=="not_signed_in"){notify("You must sign in to follow someone")}else{notify("Sorry, impossible to follow "+o)}}}};$("#userFollow").click(function(){$.post("/friendship/create/"+d,{},h(d),"json");return false});var n=function(o){return function(p){if(p.code=="ok"){notify("You don't follow "+o)}else{if(p.message=="not_signed_in"){notify("You must sign in to un-follow someone")}else{notify("Sorry, impossible to un-follow "+o)}}}};$("#userUnFollow").click(function(){$.post("/friendship/destroy/"+d,{},n(d),"json");return false});$.get("/friendship/exists/"+d,{},function(o){if(o.code=="ok"&&o.message){$("#userUnFollow").show()}else{$("#userFollow").show()}},"json");var j=analysisCallbackBuilder(f.options.displayUserTweets);if(!m){f.options.searchTweetsTimeout=setTimeout(function(){b.twitter.search(b.page.getUseroverlayQuery()+" from:"+d,30,2,j)},500)}else{f.options.searchTweetsTimeout=setTimeout(function(){b.twitter.search("from:"+d+" to:"+m+" OR from:"+m+" to:"+d,30,2,j)},500)}}},searchTweetsTimeout:-1,displayUserTweets:function(h){var j=h.results;if(j.length==0){$("#latestTweets").hide()}else{var d=[];var g=[];for(var f=0;f<j.length;f++){var e=j[f];twt=new Tweet();twt.parseTwitterJSON(e,b.trends,b);renderTweet(twt,g,{inlineTwitpic:true,pinnable:false,actionable:true,userBubble:false,highlight:false})}$("#latestTweets").html(g.join(""));$("#latestTweetsTitle").html(((j.length>29)?"More than ":"")+j.length+" tweet"+((j.length>1)?"s":"")+" on this topic").show();activateTweetsBehaviors(b,$("#latestTweets"));$("#latestTweets .userBubble").removeClass("userBubble")}},trigger:{event:"mouseover",eventDelay:500,selector:".userBubble"},beforeHide:function(d){clearTimeout(d.options.searchTweetsTimeout)},afterShow:function(g,h){clearTimeout(h.options.searchTweetsTimeout);if(g){var f=g.attr("userid");if(f){var d=h.bubble;var i=g.offset();d.css({top:i.top+4+g.outerHeight(),left:i.left});h.getBubbleContent().html("<center>Getting user infos for "+f+" ...<br><img src='/images/loadingAnimation.gif'></center>");var e=false;if(g.hasClass("inReplyTo")){e=g.attr("userid2")}if(h.options.userInfos[f]){h.options.fillPopup(h,f,e)}else{$.getJSON("http://twitter.com/users/show.json?screen_name="+f+"&callback=?",{},function(j){h.options.userInfos[f]=j;h.options.fillPopup(h,f,e)})}}}}});return c};this.search=function(d){var c=this;this.query=d;this.tdb.setQuery(d);var b=function(){$(".date").each(function(){var e=$(this).attr("date");if(e){$(this).text(relative_time(e))}});setTimeout(b,60000)};setTimeout(b,60000)};this.createTwitter=function(b){var c=null;if(b.event&&b.event.basequery){c=b.event.basequery}var d=new Twitter(c,b,{query:function(){return $("#searchBox").val()}});var e=this.config.locale.lang;if(!e){e="all"}d.setPreferedLang(e);return d};this.getTrends=function(){return this.trends};this.fetchTrends=function(c){var b=this;return function(){var d=function(e){b.trends=e;b.fireTrendsUpdated();if(c>0){setTimeout(b.fetchTrends(c),c)}};$.getJSON("/trends.json?callback=?",{},d)}};this.startTrendUpdater=function(b){(this.fetchTrends(b))()};this.tweetThisPage=function(){var b="Follow "+document.location;if(this.page&&this.page.lookup=="sept11th"){b="Never forget Sept 11th. The twitterverse pays its tribute at http://www.twazzup.com/Sept11th #911"}this.getWidget("twitterTool").tweet(b)};this.spreadTheWord=function(){this.getWidget("twitterTool").tweet("Follow "+(document.location+"").split("?",2)[0])};this.sendMessageTo=function(b){this.getWidget("twitterTool").tweet("@"+b+" ")};this.tweetThisProfile=function(b){this.getWidget("twitterTool").tweet("I'm loving @"+b+" Twazzup profile http://twazzup.com/"+b+" - everyone on Twitter has one!")};this.listeners=[];this.addListener=function(b){if(checkSignature(b,{trendsUpdated:"function"})){this.listeners.push(b);b.trendsUpdated(this.trends)}else{}};this.fireTrendsUpdated=function(){for(var b=0;b<this.listeners.length;b++){this.listeners[b].trendsUpdated(this.trends)}}}function TweetDB(c){this.twazzup=c;this.query=null;this.queryLowerCase=null;this.setQuery=function(d){this.query=d;this.queryLowerCase=d.toLowerCase()};this.tweets=[];this.tweetPos={};this.tweetsCount=0;this.maxSpamweight=2;this.mainTimeframeDurationH=null;this.setMainTimeframeDurationH=function(d){this.mainTimeframeDurationH=d};this.load=function(e,f){if(e.id){var d=this.get(e.id);if(!d){d=new Tweet();if(!f){d.parseTwitterJSON(e,this.twazzup.getTrends(),this.twazzup)}else{d.parseTwitterAPIJSON(e,this.twazzup.getTrends(),this.twazzup)}if(d.spamWeight>0.5){return null}this.store(d)}return d}return null};this.findTweetsIdxAboutUrl=function(e){r=[];var d=this.tweets.length;for(var g=0;g<d;g++){var f=this.tweets[g];if(f.hasLinks()){if(contains(f.links,e)){r.push(g)}}}return r};this.metrics={};this.metricFunctions={};this.addMetric=function(e,d){this.metricFunctions[e]=d};this.computeMetrics=function(e){for(var f in this.metricFunctions){var d=this.metricFunctions[f];this.metrics[f]=d(this,e)}this.fireNewMetricsAvailable()};this.fireNewMetricsAvailable=function(){for(var d=0;d<this.listeners.length;d++){var e=this.listeners[d].newMetricsAvailable;if(typeof(e)!="undefined"){this.listeners[d].newMetricsAvailable(this)}}};this.bannedSpammers={};this.computeStats=function(){var e=this.computeStatsQueue.concat();this.computeStatsQueue=[];for(var d=0;d<e.length;d++){this.computeSpamweight(e[d].tweet,e[d].idx,false)}this.computeMetrics(null)};this.computeSpamweight=function(h,n,p,l){if(this.queryLowerCase.indexOf(h.from.toLowerCase())>=0){return false}if(!l){l=new Date()}var j=false;var d=[];for(var f=n-1;f>=0;f--){var g=this.tweets[f];if(g){var o=g.id;if(g.isDuplicate(this,h)){g.spamweightTS=l;d.push(f)}}}if(d.length>0){var m=d.length;for(var f=0;f<d.length;f++){var e=d[f];this.tweets[e].spamweight=m}h.spamweight=m;h.spamweightTS=l;if(m>=this.maxSpamweight){if(!this.bannedSpammers[h.from]){j=true}this.bannedSpammers[h.from]=true}}return j};this.get=function(e){var d=this.tweetPos[e];return this.tweets[d]};this.getList=function(g){var h=[];var d=g.length;for(var f=0;f<d;f++){var e=this.get(g[f]);if(e){h.push(e)}}return h};this.computeStatsQueue=[];this.computeStatsTimeout=-1;this.store=function(e){clearTimeout(this.computeStatsTimeout);this.tweetPos[e.id]=this.tweetsCount++;this.tweets.push(e);var d=this;this.computeStatsQueue.push({tweet:e,idx:d.tweetsCount-1});this.computeStatsTimeout=setTimeout(function(){d.computeStats()},500)};this.garbage=function(){var d=this.tweets.length;if(d>(2000)){this.tweetsCount=2000;this.tweets=this.tweets.slice(d-2000);this.tweetPos={};for(var e=0;e<2000;e++){this.tweetPos[this.tweets[e].id]=e}d=2000}};this.isBannedSpammer=function(d){return this.bannedSpammers[d]};this.listeners=[];this.addListener=function(d){this.listeners.push(d)};this.fireNewSpammersFound=function(){for(var d=0;d<this.listeners.length;d++){var e=this.listeners[d].newSpammersFound;if(typeof(e)!="undefined"){this.listeners[d].newSpammersFound(this)}}};this.isInMainTimeFrameFilter=function(){if(this.mainTimeframeDurationH){var e=-1;if(this.mainTimeframeDurationH<=0.2){e=1}else{if(this.mainTimeframeDurationH<=24){e=24}else{if(this.mainTimeframeDurationH<=24*7){e=24*7}}}if(e>0){var d=new Date();var e=d-e*3600000;return function(f){return Date.parse(f.created_at)>=e}}else{return function(f){return true}}}return function(f){return false}};this.getRetweetedUsers=function(f){var l={};var j=function(o,p,n){if(o.isRT){for(var i=0;i<o.rts.length;i++){var q=o.rts[i];if(!(n[q])){if(p[q]){p[q]=1+p[q]}else{p[q]=1}}}}};if(f){var e=this.isInMainTimeFrameFilter();j=function(o,p,n){if(o.isRT&&e(o)){for(var i=0;i<o.rts.length;i++){var q=o.rts[i];if(!(n[q])){if(p[q]){p[q]=1+p[q]}else{p[q]=1}}}}}}for(var h=0;h<this.tweets.length;h++){var g=this.tweets[h];j(g,l,this.bannedSpammers)}var d=[];for(var m in l){d.push({from:m,c:l[m]})}return d};this.getTopRetweetedUsers=function(f,e){var d=this.getRetweetedUsers(e).sort(function(h,g){return h.c<g.c?1:(h.c==g.c?0:-1)}).slice(0,f);return d};this.findRetweetedTweetsFromUser=function(D,q){var v=function(i,j){return(i.from!=D&&i.isRT&&contains(i.rts,j))};var f=function(i,j){return(i.from==j&&!i.isRT)};if(q){var h=this.isInMainTimeFrameFilter();v=function(i,j){return(h(i)&&i.from!=D&&i.isRT&&contains(i.rts,j))};f=function(i,j){return(h(i)&&i.from==j&&!i.isRT)}}var A=[];var B=[];if(this.bannedSpammers[D]){return[]}var w=this.tweets.length;for(var z=0;z<w;z++){var p=this.tweets[z];if(v(p,D)){A.push(p)}else{if(f(p,D)){B.push(p)}}}var g=[];var n={};for(var z=0;z<B.length;z++){var p={t:B[z],rtweets:[]};if(!contains(g,p.t.id)){for(var y=0;y<A.length;y++){var m=A[y];if(m.created_at_date>p.t.created_at_date){if(m.hasLinks()&&p.t.hasLinks()){for(var x=0;x<p.t.links.length;x++){if(contains(m.links,p.t.links[x])){p.rtweets.push(m);break}}}else{if(p.t.hasLinks()){}else{var C=p.t.text.substring(0,Math.min(40,p.t.text.length)).toLowerCase();if(m.text.toLowerCase().indexOf(C)){p.rtweets.push(m)}}}}}if(p.rtweets.length>0){var e=n[p.t.from];if(!e){n[p.t.from]=[p]}else{n[p.t.from].push(p)}}g.push(p.t.id)}}var s=[];for(var o in n){var e=n[o];var d=e.sort(function(j,i){(j.rtweets.length==i.rtweets.length)?0:((j.rtweets.length>i.rtweets.length)?-1:1)})[0];s.push(d)}return s};this.getUsers=function(){var h={};for(var g=0;g<this.tweets.length;g++){var f=this.tweets[g];var e=h[f.from];if(!e){h[f.from]={a:1,rt:0,r:0,pic:f.from_picture,dt:f.created_at_date}}else{h[f.from].a=e.a+1;h[f.from].pic=f.from_picture;if(h[f.from].dt<f.created_at_date){h[f.from].dt=f.created_at_date}}h[f.from].spammer=this.bannedSpammers[f.from];for(var d=0;d<f.rts.length;d++){var l=f.rts[d];var e=h[l];if(!e){h[l]={a:0,rt:1,r:0,pic:null,dt:null}}else{h[l].rt=e.rt+1}h[l].spammer=this.bannedSpammers[l]}}return h};this.getTweetsByUsers=function(){var d={};for(var e=0;e<this.tweets.length;e++){var g=this.tweets[e];var f=d[g.from];if(!f){f={from:g.from,tweets:[g]};d[g.from]=f}else{f.tweets.push(g)}}return d};var b=this;var a=function(){b.garbage()};setInterval(a,20000)}function TagOccurences(){this.occurences={};this.addOccurence=function(d,a,b){var c=this.get(a);if(!c||!c.dates||!c.dates.length){this.occurences[a]={spamweight:d,dates:[b]}}else{c.dates.push(b)}};this.get=function(a){return this.occurences[a]};this.top=function(a,h,b){var g=[];var d=function(i){var c=true;return c};for(var m in this.occurences){var j=0;var e=this.occurences[m].dates;var l=this.occurences[m].spamweight;for(var f=0;f<e.length;f++){if(d(e[f])){j+=1-l}}if(j>0){g.push({tag:m,n:j})}}return g.sort(function(i,c){if(i.n==c.n){return i.tag<c.tag?-1:(i.tag==c.tag?0:1)}else{return i.n<c.n?1:-1}}).slice(0,a)}}function extractTags(e,f,a,d){var b=f.words;for(var c=0;c<b.length;c++){var g=b[c];if(!(a.indexOf(g)>=0)){e.addOccurence(0,g,d)}}}function extractTagsFromTweets(e,a){var d=new TagOccurences();for(var c=0;c<e.length;c++){var b=e[c];if(b.spamweight<=1){extractTags(d,b,a.toLowerCase(),Date.parse(b.created_at))}}return d}function extractHashtagsFromTweets(f,c){var a=new TagOccurences();var h={};var g=c.toLowerCase();for(var e=0;e<f.length;e++){var m=f[e];var b=Date.parse(m.created_at);if(m.spamweight<=1){for(var d=0;d<m.hashtags.length;d++){var l=m.hashtags[d].toLowerCase();if(!(g.indexOf(l)>=0)){if(!h[m.from]||!h[m.from][l]){a.addOccurence(m.spamweight,l,b);if(!h[m.from]){h[m.from]={}}h[m.from][l]=true}}}}}return a}function extractAttagsFromTweets(f,c){var a=new TagOccurences();var h={};var g=c.toLowerCase();for(var e=0;e<f.length;e++){var m=f[e];var b=Date.parse(m.created_at);if(m.spamweight<=1){for(var d=0;d<m.attags.length;d++){var l=m.attags[d].toLowerCase();if(!(g.indexOf(l)>=0)){if(!h[m.from]||!h[m.from][l]){a.addOccurence(m.spamweight,"@"+l,b);if(!h[m.from]){h[m.from]={}}h[m.from][l]=true}}}}}return a}function extractTickersFromTweets(f,c){var a=new TagOccurences();var h={};var g=c.toLowerCase();for(var e=0;e<f.length;e++){var m=f[e];var b=Date.parse(m.created_at);if(m.spamweight<=1){for(var d=0;d<m.tickers.length;d++){var l=m.tickers[d].toLowerCase();if(!(g.indexOf(l)>=0)){if(!h[m.from]||!h[m.from][l]){a.addOccurence(m.spamweight,l,b);if(!h[m.from]){h[m.from]={}}h[m.from][l]=true}}}}}return a}function extractAuthorsFromTweets(e,a){var d=new TagOccurences();for(var c=0;c<e.length;c++){var b=e[c];d.addOccurence(0,b.from.toLowerCase(),b.created_at_date)}return d}function TweetParser(){this.TAG=1;this.URL=2;this.TXT=0;this.pos=["cool","nice","great","love","like",":)",":-)",";)",";-)",":D",":-D","^^","^ ^","^_^"];this.neg=["hate","fuck","upset","disapoint",":(",":-("];this.stopwords={en:["a","about","above","accordingly","after","again","against","ah","all","also","although","always","am","among","amongst","an","and","any","anymore","anyone","are","as","at","away","be","been","begin","beginning","beginnings","begins","begone","begun","being","below","between","but","by","ca","can","cannot","come","could","did","do","doing","during","each","either","else","end","et","etc","even","ever","far","ff","following","for","from","further","furthermore","get","go","goes","going","got","had","has","have","he","her","hers","herself","him","himself","his","how","i","if","in","into","is","it","its","itself","last","lastly","less","many","may","me","might","more","must","my","myself","near","nearly","never","new","next","no","not","now","o","of","off","often","oh","on","only","or","other","otherwise","our","ourselves","out","over","perhaps","put","puts","quite","rt","s","said","saw","say","see","seen","shall","she","should","since","so","some","such","t","than","that","the","their","them","themselves","then","there","therefore","these","they","this","those","though","throughout","thus","to","too","toward","unless","until","up","upon","us","ve","very","via","was","we","were","what","whatever","when","where","which","while","who","whom","whomever","whose","why","with","within","without","would","yes","you","your","yours","yourself","yourselves","http"],fr:["rt","via","sur","sous","en","pas","ne","on","si","on","a","au","le","la","les","du","de","des","pour","vers","avec","comme","et","ou","or","ni","car","que","une","est","un","http"]};this.parseText=function(s){var b=[];var d=[];var D=[];var e=[];var z=[];var u=[];var q=null;var y;var l=function(c){if(c==null){return true}if(c.type){return(!c.v||c.v=="")}};for(var A=0;A<s.length;A++){var C=s.charAt(A);if(q){if(q.type==this.URL){if(" \n\r".indexOf(C)>=0){b.push(q);q=null}else{q.url+=C;q.v+=C}}else{if(q.type==this.TAG){if(q.tagtype=="$"){if(!("abcdefghijklmnopqrstuvwxyz".indexOf(C.toLowerCase())>=0)){if("@#$".indexOf(C)>=0){b.push(q);q={type:this.TAG,tagtype:C,v:""}}else{if(q.v==""){q={type:this.TXT,v:q.tagtype+C}}else{b.push(q);q={type:this.TXT,v:C}}}}else{q.v+=C}}else{if(!("abcdefghijklmnopqrstuvwxyz0123456789_".indexOf(C.toLowerCase())>=0)){if("@#$".indexOf(C)>=0){b.push(q);q={type:this.TAG,tagtype:C,v:""}}else{if(q.v==""){q={type:this.TXT,v:q.tagtype+C}}else{b.push(q);q={type:this.TXT,v:C}}}}else{q.v+=C}}}else{var m=s.substring(A);if(m.indexOf("http://")==0){b.push(q);q={type:this.URL,scheme:"http://",url:"",v:""};A+=6}else{if(m.indexOf("https://")==0){b.push(q);q={type:this.URL,scheme:"https://",url:"",v:""};A+=7}else{if("@#$".indexOf(C)>=0){b.push(q);q={type:this.TAG,tagtype:C,v:""}}else{q.v+=C}}}}}}else{var m=s.substring(A);if(m.indexOf("http://")==0){q={type:this.URL,scheme:"http://",url:"",v:""};A+=6}else{if(m.indexOf("https://")==0){q={type:this.URL,scheme:"https://",url:"",v:""};A+=7}else{if("@#$".indexOf(C)>=0){q={type:this.TAG,tagtype:C,v:""}}else{q={type:this.TXT,v:C}}}}}}b.push(q);for(var A=0;A<b.length;A++){var a=b[A];if(a){if(a.type==this.TAG&&a.tagtype=="@"){if(A>0){var f=b[A-1];if(f.type==this.TXT){var o=trim(f.v);if(o.match(/(rt|retweet|via)[:]?$/i)){a.rt=true}}}}else{if(a.type==this.URL){var B=a.url.replace(/([\|,;.:\?!\)\]]+)$/g,"_-_-_-$1").split("_-_-_-");a.url=B[0];var x="";if(B.length>1){x=B[1]}var g=a.url;if(g.match(/^([a-z0-9_\-\.]+)\/?$/i)){a.domain=true;a.url=a.url.replace(/[\/]+/i,"");a.v=a.url}else{if(A>0){var f=b[A-1];var j=trimGarbage(f.v);if(f.type==this.TXT&&(j!="")){if(!j.match(/[\(\[]+/g)){x=""}a.v=trimGarbage(f.v)+x;b[A-1]=null}}}}else{if(a.type==this.TXT){if(A>0){var f=b[A-1];if(f.type==this.TXT){a.v=f.v+a.v;b[A-1]=null}}}}}}}cleaned=[];for(var A=0;A<b.length;A++){var a=b[A];if(a){switch(a.type){case this.TAG:if(a.v==""){a.type=this.TXT;a.v=a.tagtype}else{switch(a.tagtype){case"@":D.push(a.v.toLowerCase());if(a.rt){e.push(a.v.toLowerCase())}break;case"$":u.push("$"+a.v);break;case"#":z.push("#"+a.v.toLowerCase());break}}break;case this.URL:d.push(a.scheme+a.url);break}cleaned.push(a)}}var h=0;for(var A=0;A<this.pos.length;A++){var t=this.pos[A];if(s.indexOf(t)>=0){h++}}for(var A=0;A<this.neg.length;A++){var w=this.neg[A];if(s.indexOf(w)>=0){h--}}return{tweet:cleaned,links:d,htags:z,attags:D,rts:e,tickers:u,mood:h}};this.renderAsTextAndHtml=function(s,p,l,d){var m=s.replace(/#([a-z0-9]+)/gi,"<a class='inlinetag' href='?q=%23$1'>#$1</a>");m=m.replace(/\$([a-z]+[0-9]*)/gi,"<a class='inlinetag' href='?q=$$$1'>$$$1</a>");var f={};for(var g=0;g<p.links.length;g++){var j=p.links[g];if(!f[j]){var c=(j.length>25?(j.substring(0,23)+"..."):j);m=m.replace(j,"<a href='"+j+"' target='_blank' title='"+j+"' class='previewable'>"+c+"</a><span class='preview'>(<a href='"+j+"' class='previewLinkBtn'>"+_LOCALE.msgBundle.preview_action+"</a>)</span>");f[j]=true}}m=m.replace(/\@([a-z0-9_]+)/gi,"<a class='userBubble' href='/$1' target='_blank' userid='$1'>@$1</a>");var s=[];var h=[];for(var g=0;g<l.length;g++){var t=l[g];switch(t.type){case(this.TAG):break;case(this.URL):break;case(this.TXT):s.push(t.v+" ");break}}s=s.join("");var o=[];var b=s.toLowerCase().replace(/[\s:;,\.\?!\"\'\(\)\[\]\{\}]+/g," ").split(" ");var a=/^[a-z\xE4\xF6\xFC]*[A-Z\xC4\xD6\xDC]([A-Z\xC4\xD6\xDC\xDF]+|[a-z\xE4\xF6\xFC\xDF]{3,})/i;for(var g=0;g<b.length;g++){var e=b[g];var q=this.stopwords[d];if(!q){q=this.stopwords.en}if(a.test(e)&&!contains(o,e)&&!contains(q,e)){o.push(e)}}return{html:m,text:s,words:o}}}function trimGarbage(a){return a.replace(/^[:\)\s\.-]+/g,"").replace(/[:\s\.\(-]+$/g,"")}function trim(a){return a.replace(/^[\s]+/g,"").replace(/[\s]+$/g,"")}function trimAll(a){return trim(trimGarbage(trim(a)))}function Twitter(b,a,c){this.baseQuery=b;this.queryGetter=c;this.preferences=$.extend({lang:""},a);this.setBaseQuery=function(d){this.baseQuery=d};this.setPreferedLang=function(d){this.preferences.lang=d};this.mentions=function(e,h,m,f,g,j,l){var d="http://twitter.com/statuses/mentions.json";var i=[];$.getJSON(d+"?count="+g+"&callback=?",this._twitterMentionsCallbackFun(2,e,h,m,f,g,j,l,i))};this._twitterMentionsCallbackFun=function(h,d,g,o,e,f,l,m,j){var n=this;var i=function(q){j=j.concat(q);if((q.length==f)&&(pg<=l)){var p="http://twitter.com/statuses/mentions.json";$.getJSON(p+"?count="+f+"&callback=?",n._twitterMentionsCallbackFun(h+1,d,g,o,e,f,l,m,j))}else{m(j)}};return i};this.friendsTimeline=function(d,f){var e=[];$.get("/statuses/friends_timeline",{since_id:d},function(g){f(g)},"json")};this.search=function(i,o,l,m,p,g,e){if(l>15){l=15}var j=[];var f=this.preferences.lang;var d=(this.baseQuery?(!g?this.baseQuery+" ":"")+i:i);this.fireSearchStarted(d);var n=this;var h={};h.type="GET";h.url="http://search.twitter.com/search.json?q="+encodeURIComponent(d)+(e?"&filter:"+e:"")+"&lang="+f+"&rpp="+o+(p?"&since_id="+p:"");h.processData=true;h.data={};h.dataType="jsonp";h.success=this._twitterSearchCallbackFun(2,o,l,i,m,j,p,g,e);h.error=function(q,t,s){alert(q.responseText)};$.ajax(h)};this._twitterSearchCallbackFun=function(f,n,j,g,l,i,o,e,d){var m=this;var h=function(p){if(typeof(p.results)!="undefined"){i.push(p.results);var s=(m.baseQuery?(!e?m.baseQuery+" ":"")+g:g);if((p.results.length==100)&&(f<=j)){var u=m.preferences.lang;var t={};t.type="GET";t.url="http://search.twitter.com/search.json?q="+encodeURIComponent(s)+(d?"&filter:"+d:"")+"&lang="+u+"&page="+f+"&rpp="+n+(o?"&since_id="+o:"");t.processData=true;t.data={};t.dataType="jsonp";t.success=m._twitterSearchCallbackFun(f+1,n,j,g,l,i,o,e,d);t.error=function(q,w,v){alert(q.responseText)};$.ajax(t)}else{m.fireSearchReturned(s,i);l(i)}}else{m.fireSearchReturned(s,i);l(i)}};return h};this.listeners=[];this.addListener=function(d){if(checkSignature(d,{searchStarted:"function",searchReturned:"function"})){this.listeners.push(d)}};this.fireSearchStarted=function(e){for(var d=0;d<this.listeners.length;d++){this.listeners[d].searchStarted(e)}};this.fireSearchReturned=function(f,e){for(var d=0;d<this.listeners.length;d++){this.listeners[d].searchReturned(f,e)}}}function WidgetManager(){this.widgets={};this.getByType=function(b){var c=[];for(var d in this.widgets){var a=this.widgets[d];if(a.type==b){c.push(a)}}return c};this.get=function(a){return this.widgets[a]};this.register=function(a){this.widgets[a.id]=a;return a};this.dispose=function(a){delete this.widgets[a]};this.createWidget=function(d,e,c,b){var a=window[d].factory;if(a){return a.apply(null,[e,c,b])}}}WidgetManager.getInstance=function(){return defineOnce("WIDGETMANAGER",function(){return new WidgetManager()})};function BaseWidget(d,b,a,c){this.id=d;this.type=b;this.twazzup=a;this.pipe=null;this._placeHolder=c;if(typeof(c)=="string"){this._placeHolder=$(c)}this.rollbackHtml=this._placeHolder.outer();this.manager=WidgetManager.getInstance();this.manager.register(this);this.getPlaceHolder=function(){return this._placeHolder};this._visible=false;this.show=function(){this._visible=true;this._placeHolder.show()};this.hide=function(){this._visible=false;this._placeHolder.hide()};this.toggle=function(){this._visible=!this._visible;this._placeHolder.toggle()};this.isVisible=function(){return this._visible};this.prependHtml=function(e){this._placeHolder.prepend(e)};this.appendHtml=function(e){this._placeHolder.append(e)};this.renderHtml=function(e){this._placeHolder.html(e)};this.renderHtmlBefore=function(e){this._placeHolder.before(e)};this.renderHtmlAfter=function(e){this._placeHolder.after(e)};this.renderText=function(e){this._placeHolder.text(e)};this.$=function(e){return $(e,this._placeHolder)};this.activateTweetsBehaviors=function(){activateTweetsBehaviors(this.twazzup,this._placeHolder)};this.setup=function(){this.doSetup()};this.doSetup=function(){};this.tearDown=function(){};this.rollback=function(){this._placeHolder.replaceWith(this.rollbackHtml)};this.disposed=false;this.dispose=function(){this.rollback();if(this._pluggedToPipe){this._pluggedToPipe.removeListener(this);this._pluggedToPipe=null}this.doDispose();this.disposed=true;this.manager.dispose(this.id)};this.doDispose=function(){}}function BoxWidget(b,f,c,h,g,a,e){BaseWidget.apply(this,[b,f,c,h]);if($("#wrapper_"+this.id).length==0){var i={"div.widgetWrapper":{attrs:{id:"wrapper_"+this.id}}};var l=TemplatesManager.getInstance().render("widgets","boxWidgetFrame_wrapper",i);this._placeHolder.wrap(l);this._parentSelector="#wrapper_"+this.id;this._parentContainer=$(this._parentSelector);if(g){this._title=g;this._expandable=a;this._expanded=e;i["div.sectionTitle a.expend"]={attrs:{id:this.id+"_title","class":"expend "+(!this._expanded?"folded":"")},text:g};var j=TemplatesManager.getInstance().render("widgets","boxWidgetFrame_title",i);this._parentContainer.prepend(j);if(this._expandable){var d=this;$("#"+this.id+"_title").click(function(){$(this).toggleClass("folded");d._expanded=!d._expanded;if(d._expanded){d.expand()}else{d.collapse()}return false})}}}this.isExpanded=function(){return this._expanded};this.expand=function(){};this.collapse=function(){};this.show=function(){this._visible=true;this._parentContainer.show()};this.hide=function(){this._visible=false;this._parentContainer.hide()};this.toggle=function(){this._visible=!this._visible;this._parentContainer.toggle()};this.rollback=function(){this._parentContainer.replaceWith(this.rollbackHtml)}}function FeaturedWidget(c,a,b){BaseWidget.apply(this,[c,"FeaturedWidget",a,b]);this.bubble=null;this.setupBubble=function(){var d=this;this.bubble=new BubbleWidget("moreFeaturedTooltip",{topOffset:4,trigger:{event:"mouseover",eventDelay:250,selector:"#showMoreFeature"},beforeShow:function(m,p){if(m){if(d.twazzup.featured.directory.length>0){var v=p.bubble;var w=m.offset();var x=w.top+4+m.outerHeight();var l=w.left;if(p.options.leftAlignment){l=$(p.options.leftAlignment).offset().left}if(p.options.leftAlignmentOffset){l+=p.options.leftAlignmentOffset}if(p.options.topOffset){x=x+p.options.topOffset}v.css({top:x,left:l,zIndex:999997});p.getBubbleContent().html("");var s=[];var u=d.twazzup.featured.directory;for(var o=0;o<u.length;o++){var h=u[o];var g=h.name;s.push("<div><b>"+g+"</b></div>");for(var n=0;n<h.topics.length;n++){var y=h.topics[n];var f=y.q;var g=y.name;var e=y.style;e=e?e:"";s.push('<a href="?q='+encodeURIComponent(f)+'" class="tag feature" style="'+e+'">'+g+"</a> ")}}p.getBubbleContent().html(s.join(""))}}}});this.bubble.init()};this.render=function(){var m=this.twazzup.featured["default"];var h=[];for(var g=0;g<m.length;g++){var f=m[g];var l=f.q;var e=f.name;var j=f.style;j=j?j:"";h.push('<a href="?q='+encodeURIComponent(l)+'" class="tag feature" style="'+j+'">'+e+"</a>&nbsp;")}var d=this.twazzup.featured.directory;if(d.length){h.push('<a class="tag feature" id="showMoreFeature" href="#">More...</a></li>')}this.renderHtml(h.join(""))};this.setupBubble();this.render()}FeaturedWidget.factory=function(c,b,a){return new FeaturedWidget(c,b,a.placeHolder)};function FeedWidget(f,c,d,e,a,b){BoxWidget.apply(this,[f,"FeedWidget",c,d,e,a]);this.url=b;this.feedurl=null;this.bubbleList=null;this.setupBubble=function(){if(!OverlayManager.getInstance().overlays.feedItemInfosTooltip){var g=this;this.bubbleList=new BubbleWidget("feedItemInfosTooltip",{rightAlignmentOffset:-10,hideBubbled:true,topOffset:-50,trigger:{event:"mouseover",eventDelay:250,selector:"div.itemfeed .title a"},beforeShow:function(m,p){if(m){var s=p.bubble;var t=m.offset();var u=t.top;var l=t.left-s.outerWidth();if(p.options.rightAlignment){l=$(p.options.rightAlignment).offset().left-s.outerWidth()}if(p.options.rightAlignmentOffset){l+=p.options.rightAlignmentOffset}if(p.options.topOffset){u=u+p.options.topOffset}s.css({top:u,left:l,zIndex:999997});p.getBubbleContent().html("");var i=g.entries[m.attr("itemIndex")];var q=i.content;var h=i.link;var v=i.title;var j=relative_time(i.publishedDate);var o="by "+i.author;var q=TemplatesManager.getInstance().render("widgets","itemFeed",{"div.itemFeedContent":{html:q},".title a":{text:v,attrs:{href:h}},"div.sub-title span.date":{text:j},"div.sub-title span.author":{text:o}});p.getBubbleContent().html(q);var x=$(window);s.css("top",((x.height()-s.height())/2+x.scrollTop())+"px")}}});this.bubbleList.init()}};this.render=function(){var q=0;var l=[];var o=TemplatesManager.getInstance();for(var j=0;j<this.entries.length;j++){var p=this.entries[j];var h=null;var m=p.content;if(m&&!p.thumbnail){var g=[];$("<div>"+m+"</div>").find("img").each(function(){var i=$(this).attr("src");if(i.indexOf("http://api.tweetmeme.com/imagebutton.gif")<0){g.push(i)}});if(g.length>0){h=g[0]}p.thumbnail=h}l.push(o.render("widgets","itemFeedPreview",{"div.thumbnail img":{attrs:{src:h}},".title a":{attrs:{href:p.link,itemIndex:j},text:p.title},"div.itemfeedContent":{html:m},"div.sub-title span.date":{text:relative_time(p.publishedDate)},"div.sub-title span.author":{text:"by "+p.author},"div.body div.snippet":{text:p.contentSnippet}}));if(q==0){l.push("<div class='hiddenEntries' style='"+(!this.isExpanded()?"display:none":"")+";clear:both'>")}q++}if(q>0){l.push("</div>")}this.renderHtml(l.join(""));if(this.entries.length>0){this.show()}else{this.hide()}};this.expand=function(){this.$(".hiddenEntries").slideDown()};this.collapse=function(){this.$(".hiddenEntries").hide()};this.entries=[];this.setEntries=function(g){if(g&&g.responseData&&g.responseData.feed&&g.responseData.feed.entries){this.entries=(g.responseData.feed.entries)}this.render()};this.refresh=function(){if(!this.disposed){if(!this.feedurl){var g=this;$.getJSON("http://ajax.googleapis.com/ajax/services/feed/lookup?v=1.0&q="+encodeURIComponent(this.url)+"&callback=?",function(i){if(i&&i.responseData&&i.responseData.url){g.feedurl=i.responseData.url;g.refresh()}else{}})}else{var h=encodeURIComponent(this.baseQuery);var g=this;$.getJSON("http://ajax.googleapis.com/ajax/services/feed/load?q="+encodeURIComponent(this.feedurl)+"&v=1.0&rsz=large&callback=?",function(i){g.setEntries(i);if(!g.disposed){setTimeout(function(){g.refresh()},300000)}})}}};this.doSetup=function(){var g=this;TemplatesManager.getInstance().addTemplates("widgets",function(){g.setupBubble();g.refresh()})};this.doDispose=function(){}}FeedWidget.factory=function(c,b,a){return new FeedWidget(c,b,a.placeHolder,a.title,a.expandable,a.url)};function FriendsWidget(d,b,a,c){BoxWidget.apply(this,[d,b,a,c]);this.twitter=this.twazzup.twitter;this.player=this.twazzup.getWidget("player");this.newTweetsAvailable=function(e,f){var g=this.twazzup.tdb.getTweetsByUsers();this.render(g)};this.render=function(i){var f=[];for(var h in i){var g=i[h];f.push("<div style='border:2px dashed #f0f0f0;margin-bottom:5px;'>");var e=g.tweets[0];renderTweet(e,f);f.push("<div>"+(g.tweets.length-1)+" more tweets</div>");f.push("</div>")}this.renderHtml(f.join(""));this.show()}}function GooglenewsWidget(g,b,c,f,a,d,e){BoxWidget.apply(this,[g,"GooglenewsWidget",b,c,f,a]);this.baseQuery=d;this.lang=e;this.render=function(){var m=0;var j=[];for(var h=0;h<this.news.length;h++){var l=this.news[h];j.push('<div class="story">');if(l.image){j.push('<div class="thumbnail"><a title="'+l.image.publisher+'" href="'+l.image.originalContextUrl+'" target="_blank"><img src="'+l.image.tbUrl+'" width="80"/></a><div class="source"><a href="'+l.image.originalContextUrl+'" target="_blank">'+l.image.publisher+"</a></div></div>")}j.push('<h2 class="title"><a href="'+l.unescapedUrl+'" target="_blank">'+l.titleNoFormatting+"</a></h2>");j.push('<div class="sub-title"><span class="source">'+l.publisher+'</span> - <span class="date">'+relative_time(l.publishedDate_date)+"</span></div>");j.push('<div class="body"><div class="snippet">'+l.content+'</div></div><div style="clear:both"></div></div>');if(m==0){j.push("<div class='hiddenNews' style='"+(!this.isExpanded()?"display:none":"")+";clear:both'>")}m++}if(m>0){j.push("</div>")}this.renderHtml(j.join(""));if(this.news.length>0){this.show()}else{this.hide()}};this.expand=function(){this.$(".hiddenNews").slideDown()};this.collapse=function(){this.$(".hiddenNews").hide()};this.news=[];this.setNews=function(j){if(j&&j.responseData&&j.responseData.results&&j.responseData.results){this.news=(j.responseData.results);for(var h=0;h<this.news.length;h++){var l=this.news[h];l.publishedDate_date=Date.parse(l.publishedDate)}this.news.sort(function(m,i){return m.publishedDate_date>i.publishedDate_date?-1:(m.publishedDate_date==i.publishedDate_date?0:1)})}this.render()};this.refresh=function(){if(!this.disposed){var i=encodeURIComponent(this.baseQuery);var h=this;$.getJSON("http://ajax.googleapis.com/ajax/services/search/news?v=1.0&rsz=large&q="+i+(this.lang?("&ned="+this.lang):"")+"&callback=?",function(j){h.setNews(j);if(!h.disposed){setTimeout(function(){h.refresh()},300000)}})}};this.doSetup=function(){this.refresh()};this.doDispose=function(){}}GooglenewsWidget.factory=function(c,b,a){return new GooglenewsWidget(c,b,a.placeHolder,a.title,a.expandable,a.query,a.lang)};function HighlightsWidget(e,b,c,d,a){BoxWidget.apply(this,[e,"HighlightsWidget",b,c,d,a]);this.twitter=this.twazzup.twitter;this.renderHtmlAfter('<div id="'+this.id+'_users"></div>');this.trendMakersWidget=new UserGalleryWidget("#"+this.id+"_users");this.retweetedTweets=[];this.retweetedTweetIds={};this.ignoredUsers={};this.droppedUsers={};this.newSpammersFound=function(f){};this.newTweetsAvailable=function(f,g){this.refresh()};this.refresh=function(){var q=this.twazzup.tdb.getTopRetweetedUsers(5);this.retweetedTweets=[];this.retweetedTweetIds={};if(q&&q.length>0){var g=[];for(var n=0;n<q.length;n++){var f=q[n].from;var h=this.twazzup.tdb.findRetweetedTweetsFromUser(f,true);if(h.length>0){for(var l=0;l<h.length;l++){var p=h[l];if(!this.retweetedTweetIds[p.t.id]){this.retweetedTweets.push(p);this.retweetedTweetIds[p.t.id]=true}}}else{if(!this.ignoredUsers[f]){g.push(f)}}}for(var n=0;n<g.length;n++){var m=g[n];if(!this.twazzup.tdb.isBannedSpammer(m)){var o=this;var s=function(i){return function(j){o.handlePotentialHighlights(i,j)}};this.twitter.search("-RT from:"+m+" "+this.twazzup.query,20,1,s(m))}}}this.render()};this.handlePotentialHighlights=function(f,p){var o=p[0];if(!this.twazzup.tdb.isBannedSpammer(f)&&o){for(var n=0;n<o.length;n++){var m=this.twazzup.tdb.load(o[n])}var l=this.twazzup.tdb.findRetweetedTweetsFromUser(f,true);if(l.length>0){for(var h=0;h<l.length;h++){var g=l[h];if(!this.retweetedTweetIds[g.t.id]){this.retweetedTweets.push(g);this.retweetedTweetIds[g.t.id]=true}}}else{this.ignoredUsers[f]=true}}this.render()};this.expand=function(){this.$(".hiddenTweets").slideDown()};this.collapse=function(){this.$(".hiddenTweets").hide()};this.render=function(){var o=this.retweetedTweets.sort(function(n,i){return n.t.created_at_date==i.t.created_at_date?0:(n.t.created_at_date>i.t.created_at_date?-1:1)});if(this.trendMakersWidget){this.trendMakersWidget.setTweets(this.twazzup.tdb,o)}var p=0;var j=[];for(var h=0;h<o.length;h++){var g=o[h].t;if(!this.twazzup.tdb.isBannedSpammer(g.from)){if(p==0){renderTweet(g,j,{highlight:true});j.push("<div class='hiddenTweets' style='"+(!this.isExpanded()?"display:none":"")+"'>")}else{var l=g.from;var f=g.from_picture;renderTweet(g,j,{highlight:true})}p++}}if(p>0){j.push("</div>")}this.renderHtml(j.join(""));this.activateTweetsBehaviors();if(p>0){this.show()}else{this.hide()}var m=this};this.twazzup.tdb.addListener(this)}HighlightsWidget.factory=function(c,b,a){return new HighlightsWidget(c,b,a.placeHolder,a.title,a.expandable)};function UserGalleryWidget(a){this.selector=a;this.container=$(a);this.setTweets=function(c,f){var j={};for(var e=0;e<f.length;e++){var l=f[e].t;if(!c.isBannedSpammer(l.from)){var h=j[l.from];if(!h){h={id:l.from,pic:l.from_picture,tweets:[]}}h.tweets.push(l);j[l.from]=h}}var g=[];var d=0;for(var h in j){if(d==0){g.push('<div class="sectionSubtitle">')}d++;var b=j[h];g.push('<img class="userInfos tmFace small userBubble" userid="'+h+'" width="32" height="32" src="'+b.pic+'" index="0" >')}if(d>0){g.push("</div>")}this.container.html(g.join(""));if(d>1){this.container.show()}else{this.container.hide()}}}function LinksWidget2(c,d,l,j,a,e,f,m,i,h,b,g){BoxWidget.apply(this,[c,"LinksWidget2",d,l,j,a,g]);this.twitter=this.twazzup.twitter;this.player=this.twazzup.getWidget("player");this.renderTimeout=-1;this.size=m?m:6;this.max=i?i:20;this.userFocus=h;this.nbCol=(b>0)?b:3;this.toolbar=null;this.content=null;this.bubbleLinks=null;this.bubbleThumbs=null;this.setupBubble=function(){if(!OverlayManager.getInstance().overlays.linkInfosTooltip){var n=this;this.bubbleList=new BubbleWidget("linkInfosTooltip",{rightAlignmentOffset:-10,hideBubbled:true,topOffset:-5,trigger:{event:"mouseover",eventDelay:250,selector:"a.elinkLink"},beforeShow:function(p,v){if(p){var w=p.attr("location");if(w){var x=v.bubble;var y=p.offset();var z=y.top;var o=y.left-x.outerWidth();if(v.options.rightAlignment){o=$(v.options.rightAlignment).offset().left-x.outerWidth()}if(v.options.rightAlignmentOffset){o+=v.options.rightAlignmentOffset}if(v.options.topOffset){z=z+v.options.topOffset}x.css({top:z,left:o,zIndex:999997});v.getBubbleContent().html("");var u=LinksDB.getInstance().getTweets(w);var t=[];for(var s=0;s<u.length;s++){renderTweet(u[s],t,{userBubble:false});for(var q=0;q<u[s].retweets.length;q++){renderTweet(u[s].retweets[q],t,{inlineTwitpic:true,pinnable:false,actionable:true,userBubble:false,highlight:false})}}v.getBubbleContent().html(t.join(""));activateTweetsBehaviors(n.twazzup,v.getBubbleContent());$(".userBubble",v.getBubbleContent()).removeClass("userBubble")}}}});this.bubbleThumbs=new BubbleWidget("twitpicInfosTooltip",{leftAlignment:"#twCol2",leftAlignmentOffset:0,topOffset:4,trigger:{event:"mouseover",eventDelay:250,selector:"a.picLink"},beforeShow:function(p,v){if(p){var w=p.attr("location");if(w){var x=v.bubble;var y=p.offset();var z=y.top+4+p.outerHeight();var o=y.left;if(v.options.leftAlignment){o=$(v.options.leftAlignment).offset().left}if(v.options.leftAlignmentOffset){o+=v.options.leftAlignmentOffset}if(v.options.topOffset){z=z+v.options.topOffset}x.css({top:z,left:o,zIndex:999997});v.getBubbleContent().html("");var u=LinksDB.getInstance().getTweets(w);var t=[];for(var s=0;s<u.length;s++){renderTweet(u[s],t,{userBubble:false});for(var q=0;q<u[s].retweets.length;q++){renderTweet(u[s].retweets[q],t,{inlineTwitpic:true,pinnable:false,actionable:true,userBubble:false,highlight:false})}}v.getBubbleContent().html(t.join(""));activateTweetsBehaviors(n.twazzup,v.getBubbleContent());$(".userBubble",v.getBubbleContent()).removeClass("userBubble")}}}});this.bubbleList.init();this.bubbleThumbs.init()}};this.newMetadatasAvailable=function(p,o){clearTimeout(this.renderTimeout);var n=this;this.renderTimeout=setTimeout(function(){n.render(o)},1000)};this.newLinksAvailable=function(n,o){};this.mode=f?f:"l";this.modes=[{id:"l",label:"list",desc:"List view"},{id:"t",label:"thumbnails",desc:"Thumbnails view"}];this.sort=e?e:"nu";this.sorts=[{id:"nu",label:"pop",desc:"Sort by popularity"},{id:"nfrom",label:"users",desc:"Sort by number of different users sharing this link"},{id:"n",label:"tweets",desc:"Sort by number of tweets sharing this link"},{id:"dt",label:"date",desc:"Sort by date of latest tweet"}];this.renderToolbar=function(q){var p=[];p.push("Sort by ");for(var o=0;o<this.sorts.length;o++){if(o>0){p.push(" | ")}if(this.sorts[o].id==this.sort){p.push(this.sorts[o].label)}else{p.push('<a href="#'+this.sorts[o].id+'" class="toolbarelement linksSort" title="'+this.sorts[o].desc+'">'+this.sorts[o].label+"</a> ")}}p.push(" view as ");for(var o=0;o<this.modes.length;o++){if(o>0){p.push(" | ")}if(this.modes[o].id==this.mode){p.push(this.modes[o].label)}else{p.push('<a href="#'+this.modes[o].id+'" class="toolbarelement linksMode" title="'+this.modes[o].desc+'">'+this.modes[o].label+"</a> ")}}this.toolbar.html(p.join(""));var n=this;$("a.linksSort",this.toolbar).click(function(){n.sort=$(this).attr("href").substring(1);n.render(q);return false});$("a.linksMode",this.toolbar).click(function(){n.mode=$(this).attr("href").substring(1);n.render(q);return false})};this.render=function(p){var n=p.topMetadatas(this.sort,this.max);var o=this["render"+this.mode];o.apply(this,[p,n])};this.installActions=function(n){};this.renderGrid=function(t,p){var s=[];s.push("<div class='grid' style='padding: 5px 0px 5px 4px;'>");for(var q=0;q<t;q++){s.push('<div class="image image_'+q+'" ><a href="#" class="prev_overlay"  style="position:absolute;top:5px;left:5px;"><a class="picLink picLink_'+q+'" target="_blank"  href="#"  location="#"><img url="#" class="twitpic img_'+q+'" src="" border="0" style="" ></a>');s.push("</div>");if(q==p-1){s.push("<div class='hiddenLinks' style='"+(!this.isExpanded()?"display:none":"")+";clear:both'>")}}s.push("</div>");s.push("<div style='clear:both'></div></div>");this.content.html(s.join(" "));var o=this;$("a.prev_overlay",this.content).click(function(){var n=$(this).attr("href");o.player.preview(n);return false})};this.rendert=function(v,z){var q=$("div.grid",this.getPlaceHolder());if(q.size()==0){this.renderGrid(this.max,this.nbCol);q=$("div.grid",this.getPlaceHolder())}var u=0;for(var y=0;y<this.max&&y<z.length;y++){var B=z[y].from;var t=false;if(this.userFocus){t=contains(B,this.userFocus)}var p=z[y].md;var o=p.meta?p.meta.thumbs[0].src:null;var w=$("a.picLink_"+u,q);var x=$("img.img_"+u,q);var C=$("div.image_"+u,q);var s=z[y].url;var A=z[y][this.sort];if(o){x.attr("src",o);x.attr("url",s);w.attr("href",s);w.attr("location",p.location);w.attr("title",p.meta.title);if(t){C.addClass("focussedUser")}else{C.removeClass("focussedUser")}C.show();u++}}for(var y=u;y<this.max;y++){$("div.image_"+y,q).hide()}if(u>0){this.show()}else{this.hide()}};this.renderl=function(t,w){var x=[];var q=0;for(var v=0;v<this.max&&v<w.length;v++){var o=w[v].md;if((!o.error)&&o&&o.domain){if(o.meta){x.push('<div class="elink">');x.push('<div class="rank">'+(v+1)+"</div>");if(o.meta.video||o.domain=="song.ly"||o.domain.indexOf("flickr.com")>=0){x.push('<div class="detail embed">')}else{x.push('<div class="detail noembed">')}var s=(o.meta.desc.length>100)?(o.meta.desc.substring(0,100)+"..."):o.meta.desc;var u=o.domain;var y=o.meta.title;if(!y){y=o.location}if(o.meta.video){var p=o.meta.thumbs[0].src;if(o.domain=="blip.fm"){p="/images/thumbs/blipfm.png"}x.push('<div class="_linkMedia" ><a href="'+o.url+'" class="play_overlay"><img src="/images/playOverlay.png"></a><img src="'+p+'" style="width:100px;margin-top:5px"></div>')}else{if(o.domain=="song.ly"){var p=o.meta.thumbs[0].src;x.push('<div class="_linkMedia" ><a href="'+o.url+'" class="play_overlay"><img src="/images/playOverlay.png"></a><img src="'+p+'" style="width:100px;margin-top:5px"></div>')}else{if(o.domain.indexOf("flickr.com")>=0){var p=o.meta.thumbs[0].src;x.push('<div class="_linkMedia" ><img src="'+p+'" style="width:100px;margin-top:5px"></div>')}}}x.push('<div style="'+((o.meta.video||o.domain=="song.ly"||o.domain.indexOf("flickr.com")>=0)?"padding-right:110px":"")+'"><div class="title"><div style="float:right"><img style="width:14px;vertical-align:middle" alt="" src="http://www.google.com/s2/favicons?domain='+u+'" title="source: '+u+'"/></div> <a class="elinkLink previewable" target="_blank" href="'+o.url+'" title="'+w[v].n+" tweets from "+w[v].from.length+" users, last shared "+relative_time(w[v].dt)+'" location="'+o.location+'">'+y+"</a></div>");x.push('<div class="desc">'+s+"</div>");x.push('<div class="url" location="'+o.location+'" style="cursor:pointer;">source: '+u+'</div><div style="clear:both"></div>');x.push("</div></div>");x.push("</div>");q++;if(q==this.size){x.push("<div class='hiddenLinks' style='"+(!this.isExpanded()?"display:none":"")+"'>")}}}}if(q>=6){x.push("</div>")}this.content.html(x.join(""));if(q>0){this.show()}else{this.hide()}var z=this;$("a.play_overlay",z.placeHolder).click(function(){var n=$(this).attr("href");z.player.preview(n);return false})};this.expand=function(){$(".hiddenLinks",this.content).slideDown()};this.collapse=function(){$(".hiddenLinks",this.content).hide()};this.doSetup=function(){this.renderHtml('<div class="toolbar"></div><div class="content"></div>');this.toolbar=$("div.toolbar",this.getPlaceHolder());this.content=$("div.content",this.getPlaceHolder());this.setupBubble()}}LinksWidget2.factory=function(c,b,a){return new LinksWidget2(c,b,a.placeHolder,a.title,a.expandable,a.defaultSort,a.defaultMode,a.size,a.max,a.userFocus,a.nbCol,a.expanded)};function RealtimeWidget(e,b,c,a,d){BaseWidget.apply(this,[e,"RealtimeWidget",b,c]);this.title=d;this.scrolling=null;this.firstDisplay=true;this.paused=false;this.pagesize=a?a:20;this.pagesizeinc=a?a:20;this.noResultsFound=function(f){$("#noresults_"+this.id).show()};this.pipeStarted=function(f){};this.pipeStoped=function(f){};this.newTweetsAvailable=function(f,h,g){$("#realtimeBox_"+this.id).show();this.displayPendingTweetsMessage(f,h);if(!this.paused||this.firstDisplay){this.render(f,h);this.firstDisplay=false}if(g){this.pause()}};this.pendingTweetsCount=0;this.displayPendingTweetsMessage=function(f){if(f){this.pendingTweetsCount+=f}var l=this;if(l.paused){$("#realtimeCtrl_"+this.id).html("<a href='#'><img src='/images/play.png' border='0' title='"+_LOCALE.msgBundle.realtime_btn_resume_title+"'></a>");var h=function(m){return function(){m.resume(m.pendingTweetsCount,m.pipe);return false}};var g=function(m){return function(){m.refresh(m.pendingTweetsCount,m.pipe);return false}};$("#realtimeCtrl_"+this.id+" a").click(h(this));if(this.firstDisplay){$("#pendingTweetsMessage_"+this.id).html("").hide()}else{if(!this.pendingTweetsCount){$("#pendingTweetsMessage_"+this.id).html(_LOCALE.msgBundle.realtime_pendingTweetsMessage_0)}else{if(this.pendingTweetsCount==1){$("#pendingTweetsMessage_"+this.id).html(_LOCALE.msgBundle.realtime_pendingTweetsMessage_1)}else{if(this.pendingTweetsCount>1){$("#pendingTweetsMessage_"+this.id).html("<b>"+this.pendingTweetsCount+_LOCALE.msgBundle.realtime_pendingTweetsMessage_2)}}}}$("a.btnRtRefresh").click(g(this));$("a.btnRtResume").click(h(this));$("#pendingTweetsMessage_"+this.id).slideDown()}else{$("#pendingTweetsMessage_"+this.id).html("").hide();$("#realtimeCtrl_"+this.id).html("<div id='speed_"+this.id+"' class='speed'></div> <a href='#'><img src='/images/pause.png' border='0' title='"+_LOCALE.msgBundle.realtime_btn_pause_title+"'></a>");var j=function(m){return function(){m.pause();return false}};$("#realtimeCtrl_"+this.id+" a").click(j(this));if(this.pipe.stats){var i=parseFloat((this.pipe.stats.speeds.avg*60*60).toFixed(0));if(i>0){$("#speed_"+this.id).html("<a title='"+_LOCALE.msgBundle.realtime_speed_title_H+"'>"+i+" TPH</a>")}else{$("#speed_"+this.id).html("")}}else{$("#speed_"+this.id).html("")}}};this.refresh=function(f,g){this.paused=false;this.newTweetsAvailable(f,g,true)};this.resume=function(f,g){this.paused=false;this.newTweetsAvailable(f,g,false)};this.pause=function(){this.paused=true;this.displayPendingTweetsMessage()};this.nextPage=function(){this.pause();var l=this.pipe.getRichTweetsPage(this.firstRenderedId,this.pagesizeinc);if(l.length>0){this.pagesize+=this.pagesizeinc;var j=[];for(var h=0;h<l.length;h++){var g=l[h];renderTweet(g,j)}var f=this;var m=function(i,n){n.mouseenter(function(){f.pinTweet($(this),f.getPlaceHolder())});activateTweetElementsBehavior(f.twazzup,n);f.firstRenderedId=l[l.length-1].id};this.scrolling.append(j.join(""),m)}else{$("#moreResultsBtn_"+this.id).hide()}};this.lastRenderedId=false;this.render=function(g,q,f){this.pendingTweetsCount=0;var m=[];var s=Math.min(this.pagesize,g);if(s>0){var l=q.getLatestRichTweets(s);var h=this.lastRenderedId;for(var j=0;j<s;j++){var p=l[j];renderTweet(p,m)}var o=this;var n=function(i,t){t.mouseenter(function(){o.pinTweet($(this),o.getPlaceHolder())});o.firstRenderedId=i.find("div.tweet:last").attr("tweetid");if(o.firstRenderedId){o.firstRenderedId=parseInt(o.firstRenderedId)}if(o.pipe.hasTweetsBefore(o.firstRenderedId)){$("#moreResultsBtn_"+o.id).show()}else{$("#moreResultsBtn_"+o.id).hide()}};this.scrolling.inject(m.join(""),this.pagesize,n,1000)}};this.pinTweet=function(f,g){var m=this.pinnedTweet;var i=g.position();var l=f.position();this.pinnedTweet.css({top:l.top-4,left:-4,width:f.width(),height:f.height()});var j=f.attr("from");var h=f.attr("tweetid");this.pinnedTweet.html("<div class='tweet actionable' from='"+j+"' tweetid='"+h+"' style='border-top:2px solid #f0f0f0;border-bottom:2px solid #b0b0b0;border-left:2px solid #F7F7F7;border-right:2px solid #F7F7F7;/*background-image:url(/images/pinned_bg.png)*/;background-color:#F7F7F7;width:"+(f.width())+"px;height:"+(f.height()+4)+";padding:7px;' >"+f.html()+"</div>");activateTweetsBehaviors(this.twazzup,this.pinnedTweet);this.pinnedTweet.show()};this.doSetup=function(){var g=[];g.push('<div id="noresults_'+this.id+'" class="noresults" style="display:none">No results</div>');g.push('<div id="realtimeBox_'+this.id+'" class="realtimeBox" style="display:none">');g.push('<div class="sectionTitle">');g.push('<div id="realtimeCtrl_'+this.id+'" class="realtimeCtrl"></div>'+this.title);g.push("</div>");g.push("<div id='pendingTweetsMessage_"+this.id+"' class='pendingTweetsMessage'></div>");g.push('<div id="realtimeScroller_'+this.id+'" style="width:100%"></div>');g.push("<div><a href='#' id='moreResultsBtn_"+this.id+"' class='moreResultsBtn' style='display:none'>"+_LOCALE.msgBundle.more_results+"</a></div>");g.push("</div>");this.getPlaceHolder().append(g.join(""));this.scrolling=new Scrolling(this.id,$("#realtimeScroller_"+this.id));$("#realtimeScroller_"+this.id).append("<div id='pinnedTweet_"+this.id+"' class='pinnedTweet' style='position:absolute; display:none;'></div>");this.pinnedTweet=$("#pinnedTweet_"+this.id);var f=this;var h=function(){f.pinnedTweet.hide()};this.scrolling.frame.mouseleave(h);$("#moreResultsBtn_"+this.id).click(function(){f.nextPage();return false})}}RealtimeWidget.factory=function(c,b,a){return new RealtimeWidget(c,b,a.placeHolder,a.pagesize,a.title)};function SpeakersWidget(d,b,a,c){BoxWidget.apply(this,[d,b,a,c]);this.speakers=c.args.speakers;this.newSpammersFound=function(e){};this.newTweetsAvailable=function(f,h){var e=[];var j={};for(var g=0;g<this.speakers.length;g++){var l=h.find({from:this.speakers[g]});if(!j[this.speakers[g]]){if(l.length>0){e.push(l[0]);j[this.speakers[g]]=true}}}this.render(e)};this.render=function(e){var m=e.sort(function(n,i){return n.created_at_date==i.created_at_date?0:(n.created_at_date>i.created_at_date?-1:1)});var o=0;var j=[];for(var h=0;h<m.length;h++){var g=m[h];if(o==0){renderTweet(g,j,{highlight:true});j.push("<div class='spkHiddenTweets' style='"+(!this.isExpanded()?"display:none":"")+"'>")}else{var l=g.from;var f=g.from_picture;renderTweet(g,j,{highlight:true})}o++}if(o>0){j.push("</div>")}if(m.length>1){j.push("<div id='speakersList'><div class='sectioSubtitle'>");for(var h=0;h<m.length;h++){var g=m[h];j.push('<img class="userInfos tmFace userBubble" userid="'+g.from+'" width="32" height="32" src="'+g.from_picture+'" index="0" >')}j.push("</div></div>")}this.renderHtml(j.join(""));this.activateTweetsBehaviors();if(o>0){this.show()}else{this.hide()}};this.expand=function(){this.$(".spkHiddenTweets").slideDown()};this.collapse=function(){this.$(".spkHiddenTweets").hide()};this.twazzup.tdb.addListener(this)}function SponsorsWidget(f,c,d,e,a,b){BoxWidget.apply(this,[f,"SponsorsWidget",c,d,e,a]);this.sponsors=b;this.newSpammersFound=function(g){};this.newTweetsAvailable=function(h,l){var g=[];var m={};for(var j=0;j<this.sponsors.length;j++){var n=l.find({from:this.sponsors[j]});g=g.concat(n)}this.render(g)};this.render=function(l){var m=l.sort(function(n,i){return n.created_at_date==i.created_at_date?0:(n.created_at_date>i.created_at_date?-1:1)}).slice(0,50);var h=0;var o=[];for(var j=0;j<m.length;j++){var v=m[j];if(h==0){renderTweet(v,o,{highlight:true});o.push("<div class='hiddenSpoTweets' style='"+(!this.expanded?"display:none":"")+"'>")}else{var s=v.from;var p=v.from_picture;renderTweet(v,o,{highlight:true})}h++}if(h>0){o.push("</div>")}var q=[];var u=0;if(m.length>1){var g={};q.push("<div id='correspondents'><div class='sectionSubtitle'>");for(var j=0;j<m.length;j++){var v=m[j];if(!g[v.from]){q.push('<img class="userInfos tmFace small userBubble" userid="'+v.from+'" width="32" height="32" src="'+v.from_picture+'" index="0" >');g[v.from]=true;u++}}q.push("</div></div>")}if(u>1){o.push(q.join(""))}this.renderHtml(o.join(""));this.activateTweetsBehaviors();if(h>0){this.show()}else{this.hide()}};this.expand=function(){this.$(".hiddenSpoTweets").slideDown()};this.collapse=function(){this.$(".hiddenSpoTweets").hide()}}SponsorsWidget.factory=function(c,b,a){return new SponsorsWidget(c,b,a.placeHolder,a.title,a.expandable,a.sponsors)};function StaticWidget(d,b,a,c){BoxWidget.apply(this,[d,b,a,c]);this.content=c.args.content;this.doSetup=function(){this.renderHtml(this.content);if(this.content){this.show()}else{this.hide()}}}StaticWidget.defaultParameters=function(){return{title:"Static",content:"",expandable:false,expanded:false}};function EmbedWidget(d,b,a,c){c.args.content=c.args.embed;StaticWidget.apply(this,[d,b,a,c])}EmbedWidget.defaultParameters=function(){return{title:"Embed",embed:"",expandable:false,expanded:false}};function EditorLinksWidget(g,c,b,e){var d=[];for(var a=0;a<e.args.links.length;a++){var f=e.args.links[a];d.push('<div><a href="'+f.href+'" target="_blank">'+f.name+"</a></div>")}e.args.content=d.join("");StaticWidget.apply(this,[g,c,b,e])}EditorLinksWidget.defaultParameters=function(){return{title:"Editor's links",links:[{name:"Twazzup",href:"http://www.twazzup.com"}],expandable:false,expanded:false}};function TagsWidget(f,c,e,a,d,b){BaseWidget.apply(this,[f,"TagsWidget",c,e]);this.timeSegmentGetter=a;this.extractorFn=d;this.options=$.extend({},{fixedSize:true,minSize:0.65,maxSize:1.1,maxTagsCount:5,addPipeQuery:false},b);this.bubble=null;this.setupBubble=function(h){var g=this;this.bubble=new BubbleWidget("tagsInfosTooltip_"+this.options.tooltipoverlay,{topOffset:4,trigger:{event:"mouseover",eventDelay:250,selector:".tag_"+this.options.tooltipoverlay},beforeShow:function(l,p){if(l){var u=l.text();if(u){var q=p.bubble;var s=l.offset();var t=s.top+4+l.outerHeight();var j=s.left;if(p.options.leftAlignment){j=$(p.options.leftAlignment).offset().left}if(p.options.leftAlignmentOffset){j+=p.options.leftAlignmentOffset}if(p.options.topOffset){t=t+p.options.topOffset}q.css({top:t,left:j,zIndex:999997});p.getBubbleContent().html("");var o=h.find({text_filter_fn:function(i){if(i){if(i.toLowerCase().indexOf(u.toLowerCase())>=0){return true}}return false}});var n=[];for(var m=0;m<o.length;m++){renderTweet(o[m],n,{inlineTwitpic:true,userBubble:false})}p.getBubbleContent().html(n.join(""));p.getBubbleContent().highlight(u);activateTweetsBehaviors(g.twazzup,p.getBubbleContent())}}}});this.bubble.init()};this.newTweetsAvailable=function(h,l){if(this.options.tooltipoverlay&&!this.bubble){this.setupBubble(l)}var m=false;var j=false;var g=null;if(this.timeSegmentGetter){m=this.timeSegmentGetter.getMaxDate();j=this.timeSegmentGetter.getMinDate();g=this.extractorFn(l.getLatestRichTweets(l.fifo.length),l.getFullQuery()).top(10,m,j)}var i=this.extractorFn(l.getLatestRichTweets(l.fifo.length),l.getFullQuery()).top(10);this.render(i,g,l)};this.computeHeadline=function(g,l){var j=l[0];for(var h=1;h<l.length;h++){var m=this.findIntersectionAround(j,l[h],g)}};this.findIntersectionAround=function(m,l,s){var g=s;var j=m.text.indexOf(s);var i=l.text.indexOf(s);if(j*i>=0){var p=s;for(var n=j+s.length+1;n<m.text.length;n++){var o=m.text.substring(j,n);if(l.text.indexOf(o,i)==i){p=o}else{break}}var q="";for(var n=j-1;n>=0;n--){var h=m.text.substring(n,j);if(l.text.indexOf(h,i-h.length)==i-h.length){q=h}else{break}}return q+p}return""};this.getMinMax=function(h){var g={min:null,max:null};for(var l=0;l<h.length;l++){var j=h[l];if(g.min==null){g.min=j.n}else{g.min=Math.min(g.min,j.n)}if(g.max==null){g.max=j.n}else{g.max=Math.max(g.max,j.n)}}return g};this.getTagSize=function(m,h){var j=parseFloat(this.options.maxSize-this.options.minSize);var i=parseFloat(this.options.maxSize+this.options.minSize)/2;var g=parseFloat(h.max-h.min);if(this.options.fixedSize||g==0){return i}else{var l=m-parseFloat(h.max+h.min)/2;return i+(j*l)/g}};this.render=function(l,p,j){var m=this.getMinMax(l);var o=[];var h="";var s=0;for(var n=0;n<l.length&&n<this.options.maxTagsCount;n++){var u=l[n];h="font-size:"+this.getTagSize(u.n,m)+"em;";var g=u.tag;if(this.options.addPipeQuery){g=TWAZZUP.page.query+" "+g}if(u.n>1){o.push('<a href="?q='+encodeURIComponent(g)+'" style="'+h+'" class="tag_'+this.options.tooltipoverlay+'">'+u.tag+"</a> ");s++}}if(p){o.push("<hr/>Relevant to time constraint : ");h="";for(var n=0;n<p.length&&n<this.options.maxTagsCount;n++){var u=p[n];var g=u.tag;if(this.options.addPipeQuery){g=TWAZZUP.page.query+" "+g}if(u.n<=1){h="color:#a0a0a0"}o.push("<a href='?q="+encodeURIComponent(g)+"' title='"+u.n+"' style='"+h+"' class='tag_"+this.options.tooltipoverlay+"'>"+u.tag+"</a> ");s++}}this.renderHtml(o.join(""));if(s==0){this.hide()}else{this.show()}}}TagsWidget.factory=function(c,b,a){return new TagsWidget(c,b,a.placeHolder,a.timeSegmentGetter,a.extractorFn,a.options)};function TrendsWidget(c,a,b){BaseWidget.apply(this,[c,"TrendsWidget",a,b]);this.trends=[];this.moreTrends=[];this.bubble=null;this.setupBubble=function(){var d=this;this.bubble=new BubbleWidget("moreTrendsTooltip",{topOffset:4,trigger:{event:"mouseover",eventDelay:500,selector:"#showMoreTrends"},beforeShow:function(g,j){if(g){if(d.moreTrends.length>0){var m=j.bubble;var n=g.offset();var o=n.top+4+g.outerHeight();var f=n.left;if(j.options.leftAlignment){f=$(j.options.leftAlignment).offset().left}if(j.options.leftAlignmentOffset){f+=j.options.leftAlignmentOffset}if(j.options.topOffset){o=o+j.options.topOffset}m.css({top:o,left:f-10,zIndex:999997});j.getBubbleContent().html("");var l=[];l.push("<ul>");for(var h=0;h<d.moreTrends.length;h++){var p=d.moreTrends[h];var e=p.q;l.push('<li><a href="/search?q='+e+'" class="tag">'+p.name+"</a></li> ")}l.push("</ul>");j.getBubbleContent().html(l.join(""))}}}});this.bubble.init()};this.trendsUpdated=function(d){this.render()};this.render=function(){var j=this.twazzup.getTrends();this.trends=[];this.quickTrends=[];for(var h=0;h<j.length&&h<50;h++){if(h<3){this.quickTrends.push(j[h])}this.trends.push(j[h])}var g=[];for(var h=0;h<this.trends.length;h++){var f=this.trends[h];var e=f.q;var d=f.name;if(d.length>33){d=d.substring(0,30)+"..."}g.push('<a href="/search?q='+e+'" class="tag">'+d+"</a> ")}this.renderHtml(g.join(""));g=[];for(var h=0;h<this.quickTrends.length;h++){var f=this.quickTrends[h];var e=f.q;var d=f.name;if(d.length>13){d=d.substring(0,10)+"..."}g.push('<a href="/search?q='+e+'" class="tag">'+d+"</a> ")}g.push('<a id="showMoreTrends" href="#" onClick="showSlidepane(\'trends\');return false;"><img src="/images/dropd14.png" border="0"></a>');$("#hotTopics").html(g.join(""))};this.doSetup=function(){this.twazzup.addListener(this);this.setupBubble()}}TrendsWidget.factory=function(c,b,a){return new TrendsWidget(c,b,a.placeHolder)};function UsersWidget(f,c,d,e,a,b){BoxWidget.apply(this,[f,"UsersWidget",c,d,e,a]);this.newTweetsAvailable=function(g,h){var i=this.twazzup.tdb.getUsers();this.render(i)};this.sorts={rt:{lbl:"Influencers",attr:"rt"},a:{lbl:"Most active",attr:"a"},dt:{lbl:"Latest",attr:"dt"}};this.sort=b?b:"rt";this.render=function(p){if(!p){p=this.twazzup.tdb.getUsers()}var j=[];for(var t in p){j.push({u:t,pic:p[t].pic,rt:p[t].rt,a:p[t].a,dt:p[t].dt,r:p[t].r})}var q=function(s,u){var i=u[s].attr;var w=u[s].desc?-1:1;return function(z,y){return w*(z[i]==y[i]?0:(z[i]>y[i]?-1:1))}};j=j.sort(q(this.sort,this.sorts));var m=[];m.push('<div class="">');m.push('<div style="border-bottom:1px solid #eeeeee;padding:2px 8px">');for(var x in this.sorts){m.push("<a href='#' class='usersSort "+(x==this.sort?"selected":"")+"' sort='"+x+"'>"+this.sorts[x].lbl+"</a> ")}m.push("</div>");m.push('<div style="border-top:1px solid white;padding:6px 8px 0 8px">');for(var h=0;h<j.length;h++){var l=j[h];if(l.pic){if((this.sort!="rt")||(l.rt>0)){m.push("<a href='/"+l.u+"'><img src='"+l.pic+"' title='"+l.u+" : "+l.a+" tweets, Retweeted "+l.rt+" times' class='userInfos tmFace userBubble "+(l.spammer?"spammer":"")+"' userid='"+l.u+"' border='0'></a>")}}}m.push("</div>");m.push("</div>");this.renderHtml(m.join(""));patchwork=$("div#usersPatchwork");var n=[];j=[];for(var t in p){j.push({u:t,pic:p[t].pic,rt:p[t].rt,a:p[t].a,dt:p[t].dt,r:p[t].r})}var q=function(s,u){var i=u[s].attr;var w=u[s].desc?-1:1;return function(z,y){return w*(z[i]==y[i]?0:(z[i]>y[i]?-1:1))}};j=j.sort(q("dt",this.sorts));var g=4;if(j.length<7){g=2}else{if(j.length<12){g=3}else{g=4}}var o=150/g;for(var h=0;h<j.length&&h<g*g;h++){var l=j[h];if(l.pic){n.push("<img src='"+l.pic+"' border='0' width='"+o+"' height='"+o+"'/>")}}patchwork.html(n.join(""));var v=this;$("a.usersSort").click(function(){var i=$(this).attr("sort");$("a.usersSort").removeClass("selected");$(this).addClass("selected");v.sort=i;v.render();return false});this.show()}}UsersWidget.factory=function(c,b,a){return new UsersWidget(c,b,a.placeHolder,a.title,a.expandable,a.sort)};function VidGalleryWidget(d,b,a,c){BoxWidget.apply(this,[d,b,a,c]);this.player=this.twazzup.getWidget("player");this.renderTimeout=-1;this.videos=[];this.resolvedUrls=[];this.twitPicOccurences=null;this.newTweetsAvailable=function(p,e){var j={};var m=[];var g=e.getLatestRichTweets(p);for(var f=0;f<g.length;f++){var o=g[f];if(o.hasLinks()){var h=o.links[0];if(!j[h]||!this.resolvedUrls[h]){j[h]=true;m.push(h)}}}var n=0;for(var f=0;f<m.length;f++){var l=m[f];n+=this.processLink(l,null);if(n>15){break}}};this.currentlyResolving={};this.processLink=function(f,g){var e=this.twazzup.tdb.getUrlMetaDatas(f);if(!e){this.resolveLink(f,g);return 1}else{this.notifyLinkOccurence(e,g);return 0}};this.resolveLink=function(e,g){if(!this.currentlyResolving[e]){this.currentlyResolving[e]=true;var f=this;$.getJSON("http://meta.twazzup.com/_gr.json?url="+encodeURIComponent(e)+"&callback=?",function(h){if(h&&h.meta&&!h.error){h.source="vidGallery";if(h.meta.video&&h.meta.title&&(h.location.indexOf("youtube.com")>0)){f.twazzup.tdb.setLocationMetaDatas(h);f.videos.push(h);f.notifyLinkOccurence(h,g)}delete f.currentlyResolving[e]}})}else{}};this.notifyLinkOccurence=function(f,g){clearTimeout(this.renderTimeout);var e=this;this.renderTimeout=setTimeout(function(){e.render()},750)};this.render=function(){var e=this.videos;if(e.length>0){this.show()}else{this.hide()}var h=[];var m=0;for(var g=0;g<20&&g<e.length;g++){var l=e[g];if(l){if(m%3==0){h.push("<div style='clear:both'></div>")}if(l.meta){h.push('<div class="vlink" style="float:left;width:110px;padding:4px;font-size:.7em">');var j=l.meta.thumbs[0].src;h.push('<div class="_linkMedia" style="position:relative;"><a href="#" class="thickbox"  style="position:absolute;top:10px;left:5px;"><img src="/images/playOverlay.png"></a><img src="'+j+'" style="width:105px;margin-top:5px;padding:3px;background-color:white;border:1px solid #d2dada"></div>');if(l.meta.video.embed){h.push('<div id="emb_'+g+'" class="embeded_src" style="display:none;text-align:center" >'+escape(l.meta.video.embed)+"</div>")}else{h.push('<div id="emb_'+g+'" class="embeded_src" style="display:none;text-align:center">'+escape('<embed  type="application/x-shockwave-flash" src="'+l.meta.video.src+'"  width="500" height="300"></embed>')+"</div>")}h.push('<div class="title"><a class="elinkLink" target="_blank" href="'+l.url+'" location="'+e[g].location+'">'+l.meta.title+"</a></div>");h.push("</div>");m++;if(m==3){h.push("<div style='clear:both'></div><div class='hiddenVids' style='"+(!this.isExpanded()?"display:none":"")+"'>")}}}}if(m>=3){h.push("</div>")}if(m>0){h.push("<div style='clear:both'></div>")}this.renderHtml(h.join(""));var f=this.player;this.$(".embeded_src").each(function(){var n=$(this);var i=n.html();var p=n.parents("div.vlink").find("a.elinkLink").text();var o=n.parents("div.vlink").find("a.thickbox");o.click(function(){f.play(p,i);return false})})};this.expand=function(){this.$(".hiddenVids").slideDown()};this.collapse=function(){this.$(".hiddenVids").hide()}}function YoutubeWidget(f,b,d,e,a,c){BoxWidget.apply(this,[f,"YoutubeWidget",b,d,e,a]);this.channel=c;this.player=this.twazzup.getWidget("player");this.render=function(){var q=0;var o=[];for(var m=0;m<this.videos.length;m++){var h=this.videos[m];var g=h.id["$t"].split(":")[3];var p=$(h.content["$t"]).find("span:first").text();if(p.length>100){p=p.substring(0,97)+"..."}var l=h.author[0]["name"]["$t"];var j=Date.parse(convertAtomDateString(h.published["$t"]));o.push('<div class="elink"><div class="detail embed">');o.push('<div class="_linkMedia"><a href="'+h.link[0].href+'" class="play_overlay"><img src="/images/playOverlay.png"></a><img src="http://i.ytimg.com/vi/'+g+'/default.jpg" style="width:100px;margin-top:5px"/></div>');o.push('<div style="padding-right:110px"><div class="title"><a href="'+h.link[0].href+'" target="_blank">'+h.title["$t"]+"</a></div>");o.push('<div class="sub-title">'+l+" - "+relative_time(j)+"</div>");o.push('<div class="desc">'+p+'</div><div style="clear:both"></div></div>');o.push("</div></div>");if(q==0){o.push("<div class='hiddenVideos' style='"+(!this.isExpanded()?"display:none":"")+";clear:both'>")}q++}if(q>0){o.push("</div>")}this.renderHtml(o.join(""));if(this.videos.length>0){this.show()}else{this.hide()}var s=this;$("a.play_overlay",this.placeHolder).click(function(){var i=$(this).attr("href");s.player.preview(i);return false})};this.expand=function(){this.$(".hiddenVideos").slideDown()};this.collapse=function(){this.$(".hiddenVideos").hide()};this.videos=[];this.setVideos=function(g){if(g&&g.feed&&g.feed.entry){this.videos=(g.feed.entry)}this.render()};this.refresh=function(){if(!this.disposed){var g=this;$.getJSON("http://gdata.youtube.com/feeds/base/users/"+g.channel+"/uploads?alt=json-in-script&v=2&orderby=published&client=ytapi-youtube-profile&callback=?",function(h){g.setVideos(h);if(!g.disposed){setTimeout(function(){g.refresh()},60000)}})}};this.doSetup=function(){this.refresh()};this.doDispose=function(){}}YoutubeWidget.factory=function(c,b,a){return new YoutubeWidget(c,b,a.placeHolder,a.title,a.expandable,a.channel)};