(function(){function q(){b=window.jQuery.noConflict(true);l()}function l(){function f(a){array_index=parseInt(a.array_index);typeof a.error!="undefined"?b(i[array_index]).html(a.error):((a.action=="replace"||a.action=="replaceupdate")&&b(i[array_index]).html(a.html),a.action=="prepend"&&b("#troopla-widget-inner-"+array_index).prepend(a.html),(a.action=="update"||a.action=="replaceupdate")&&q(a.type,a.data),b("span.troopla-posted-date").each(function(){b(this).html(l(b(this).attr("data-date")))}),
setTimeout(function(){b.getJSON(m+"/widget?fmt=json&progress_token="+encodeURIComponent(a.progress_token)+"&array_index="+a.array_index+"&options="+encodeURIComponent(b(i[array_index]).attr("data-options"))+"&callback=?",function(a){f(a)})},a.delay_milliseconds))}function q(a,d){var e,j,c,f,n=null;if(a=="dashboard")for(e in d.states)if(e>0||d.states.length==1)for(c in d.states[e].state.values){f=false;for(j in d.states[e].state.values[c].state_value_list){var g;a:{g=d.states[e].state.values[c].id;
var o=j,h=d.states[e].state.values[c].state_value_list[j].field_value,l=d.states[e].state.values[c].state_value_list[j].updated_POSIX,i=d.states[e].state.values[c].dashboard_value_sort,k=void 0,r=void 0,p=void 0;if(typeof h!="undefined"&&!(h==""||h==null))if(k=h.split("^"),k[0]=="*TOGGLE*"){if(r='<img src="'+m+k[3]+'">',b("#"+g+"_visible_"+k[1]).html()!=r){for(p=0;p<parseInt(k[2]);p+=1)""+p==k[1]?b("#"+g+"_visible_"+k[1]).html(r):b("#"+g+"_visible_"+p).html("&nbsp;");i!=null&&b("#"+o+"_sortid").attr("data-sort",
h);g=true;break a}}else if(b("#"+g+"_visible_"+o).html()!=h){b("#"+g+"_visible_"+o).html(h);b("#"+g+"_updated_"+o).attr("data-date",""+l);i!=null&&b("#"+o+"_sortid").attr("data-sort",h);g=true;break a}g=false}if(g)if(f=true,n==null)n=d.states[e].state.values[c].state_value_list[j].updated_POSIX;else if(n<d.states[e].state.values[c].state_value_list[j].updated_POSIX)n=d.states[e].state.values[c].state_value_list[j].updated_POSIX}f&&(d.states[e].state.values[c].dashboard_value_sort!=null&&b("."+e+"-sort").tsort({order:d.states[e].state.values[c].dashboard_value_sort,
attr:"data-sort"}),b("#dashboard-update-"+e).attr("data-date",""+n))}}function l(a){if(a==null)return"&nbsp;";if(a=="")return"&nbsp;";var a=new Date(parseInt(a)*1E3),d=Math.floor((new Date-a)/1E3),e="",b=" ago";d<0&&(d=-d,e="In ",b="");var c=Math.floor(d/31536E3),f="Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(",");if(c>1)return f[a.getMonth()]+" "+a.getFullYear();c=Math.floor(d/2592E3);if(c>1)return a.getDate()+" "+f[a.getMonth()];c=Math.floor(d/86400);if(c>1)return e+c+" days"+b;c=Math.floor(d/
3600);if(c>1)return e+c+" hours"+b;c=Math.floor(d/60);return c>1?e+c+" mins"+b:e+d+" secs"+b}var i=[];b(document).ready(function(a){a("<link>",{rel:"stylesheet",type:"text/css",href:m+"/desktopcss/widget.css"}).appendTo("head");a("div.troopla-widget").each(function(b){i[b]=this;a.getJSON(m+"/widget?fmt=json&progress_token=&array_index="+b+"&options="+encodeURIComponent(a(this).attr("data-options"))+"&callback=?",function(a){f(a)})})})}var b,m="http://beta.troopla.com";location.hostname=="a1.quickcatchlabs.com"&&
(m="");if(window.jQuery===void 0||window.jQuery.fn.jquery!=="1.6.4"){var f=document.createElement("script");f.setAttribute("type","text/javascript");f.setAttribute("src",m+"/js/jqueryZ1Z6Z4Zmin.js");f.onload=q;f.onreadystatechange=function(){(this.readyState=="complete"||this.readyState=="loaded")&&q()};(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(f)}else b=window.jQuery,l()})();
