function rerfesh_date() {
    if(typeof i18nSet === 'undefined') {
        return;
    }
    times = $(".time");
    $.each(times, function() {
        ts = $(this).attr('ts');
        if(!(typeof ts === 'undefined')) {
            tsNow = Math.round(new Date().getTime() / 1000);
            tsDiff = tsNow - ts;
            if(tsDiff>60) {
                tsDiff = Math.floor(tsDiff/60);
                if(Math.round(tsDiff)==1) {
                    showText = oneMinute;
                } else if(tsDiff>1 && tsDiff<=59) {
                    showText = minutes.replace('${time}', Math.floor(tsDiff));
                } else if(tsDiff>=60 && tsDiff<120) {
                    showText = oneHour;
                } else if (tsDiff>=120 && tsDiff<1440) {
                    showText = hours.replace('${time}', Math.floor(tsDiff/60));
                } else if(tsDiff>=1440 && tsDiff<2880) {
                    showText = oneDays;
                } else if(tsDiff>=2880 && tsDiff<10080) {
                    showText = days.replace('${time}', Math.floor(tsDiff/60/24));
                } else {
                    showText = $(this).find('abbr').text();
                }
            } else if(tsDiff<0) {
                showText = $(this).find('abbr').text();
            } else {
                showText = fewSeconds;
            }
            $(this).find('abbr').html(showText);
        }
    });
}
$(function() {
    rerfesh_date();
    dataRefreshTimeout = setInterval(rerfesh_date, 1*10*1000);
});
