/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  January 20th 2010 10:11:08 AM PST                            */
/*      Machine:  10.16.139.108                                                */
/*       Source:  Local Cache                                                  */
/*     Location:  rsrc:4:68ax3hpc                                              */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/live_timer.js                                             */

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/live_timer.js"]); }

var LiveTimer={restart:function(a){this.serverTime=a;this.localStartTime=new Date().getTime()/1000;this.updateTimeStamps();},updateTimeStamps:function(){LiveTimer.timestamps=DOM.scry(document.body,'abbr.timestamp');LiveTimer.startLoop(20000);},addTimeStamps:function(a){if(!a||!LiveTimer.timestamps)return;var c=DOM.scry(a,'abbr.timestamp');for(var b=0;b<c.length;++b)LiveTimer.timestamps.push(c[b]);LiveTimer.startLoop(0);},startLoop:function(a){this.stop();this.timeout=setTimeout(function(){LiveTimer.loop();},a);},stop:function(){clearTimeout(this.timeout);},loop:function(){var c=Math.floor(new Date().getTime()/1000-LiveTimer.localStartTime);var a=-1;LiveTimer.timestamps.each(function(f){var e=+new Date(f.getAttribute('title'))/1000;var d=LiveTimer.renderRelativeTime(LiveTimer.serverTime+c,e);if(d.text)DOM.setContent(f,d.text);if(d.next!=-1&&(d.next<a||a==-1))a=d.next;});if(a!=-1){var b=Math.max(20000,a*1000);LiveTimer.timeout=setTimeout(function(){LiveTimer.loop();},b);}},renderRelativeTime:function(c,d){var e={text:"",next:-1};if(c-d>(12*3600)||(new Date(c*1000).getDay()!=new Date(d*1000).getDay()))return e;var f=c-d,b=Math.floor(f/60),a=Math.floor(b/60);if(b<1){e.text=_tx("a few seconds ago");e.next=60-f%60;return e;}if(a<1){if(b==1){e.text=_tx("about a minute ago");}else e.text=_tx("{number} minutes ago",{number:b});e.next=60-f%60;return e;}if(a!=11)e.next=3600-f%3600;if(a==1){e.text=_tx("about an hour ago");return e;}e.text=_tx("{number} hours ago",{number:a});return e;}};

if (window.Bootloader) { Bootloader.done(["js\/live_timer.js"]); }