
(function($){$.timeago=function(timestamp){if(timestamp instanceof Date)return inWords(timestamp);else if(typeof timestamp=="string")return inWords($.timeago.parse(timestamp));else return inWords($.timeago.parse($(timestamp).attr("title")));};var $t=$.timeago;$.extend($.timeago,{settings:{refreshMillis:60000,allowFuture:false},inWords:function(distanceMillis){var seconds=distanceMillis/1000;var minutes=seconds/60;var hours=minutes/60;var days=hours/24;var years=days/365;if(this.settings.allowFuture&&distanceMillis<0){var words=seconds>-45&&"Za necelou minutu"||seconds<90&&"Za minutu"||minutes<5&&sprintf("Za %d minuty",Math.round(minutes))||minutes<45&&sprintf("Za %d minut",Math.round(minutes))||minutes<90&&"Za hodinu"||hours<5&&sprintf("Za %d hodiny",Math.round(hours))||hours<24&&sprintf("Za %d hodin",Math.round(hours))||hours<48&&"Zítra"||days<5&&sprintf("Za %d dny",Math.floor(days))||days<30&&sprintf("Za %d dnů",Math.floor(days))||days<60&&"Za měsíc"||days<150&&sprintf("Za %d měsíce",Math.floor(days/30))||days<360&&sprintf("Za %d měsíců",Math.floor(days/30))||years<2&&"Za rok"||years<5&&sprintf("Za %d roky",Math.floor(years))||sprintf("Za %d let",Math.floor(years));}else{var words=seconds<45&&"Před necelou minutou"||seconds<90&&"Před minutou"||minutes<45&&sprintf("Před %d minutami",Math.round(minutes))||minutes<90&&"Před hodinou"||hours<24&&sprintf("Před %d hodinami",Math.round(hours))||hours<48&&"Včera"||days<30&&sprintf("Před %d dny",Math.floor(days))||days<60&&"Před měsícem"||days<360&&sprintf("Před %d měsíci",Math.floor(days/30))||years<2&&"Před rokem"||sprintf("Před %d roky",Math.floor(years));}
return words;},parse:function(iso8601){var s=$.trim(iso8601);s=s.replace(/-/,"/").replace(/-/,"/");s=s.replace(/T/," ").replace(/Z/," UTC");s=s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2");return new Date(s);}});$.fn.timeago=function(lowercase){var self=this;refreshAll(self,lowercase);var $s=$t.settings;if($s.refreshMillis>0){setInterval(function(){refreshAll(self,lowercase)},$s.refreshMillis);}
return self;};function refreshAll(obj,lowercase){for(i=0;i<obj.length;i++){refresh(obj[i],lowercase);}}
function refresh(obj,lowercase){var date=$t.parse(obj.title);if(!isNaN(date)){var words=inWords(date);if(lowercase){$(obj).text(words.toLowerCase());}else{$(obj).text(words);}}
return obj;}
function inWords(date){return $t.inWords(distance(date));}
function distance(date){return(new Date().getTime()-date.getTime());}
function sprintf(string,value){return string.replace(/%d/i,value);}
if($.browser.msie&&$.browser.version<7.0){document.createElement('abbr');}})(jQuery);jQuery(document).ready(function(){jQuery('span[class*=timeago]').timeago(true);});jQuery(document).ready(function(){jQuery('span[class*=Timeago]').timeago();});
