/*
说明：距离现在时间的插件，如距离现在30秒，两天等等。。。
作者：Alexis
创作时间：20100904
*/
(function ($) {
    var nowTime = new Date();

    $.extend({
        timeapart: function (time) {
            var time = new Date(time);
            var seconds = Math.floor((nowTime - time) / 1000);
            //var time2 = new Date(nowTime.getYear - time.getYear,nowTime.getMonth-time.getMonth,nowTime.getDay-time.getDay);
            var minutes = Math.floor(seconds / 60)%60;
            var hours = Math.floor(seconds / 3600) % 24;
            var days = Math.floor(seconds / (3600*24));

            var returnStr = '';
            if (days > 0) {
                returnStr += days.toString() + '天';
            }
            if (hours > 0) {
                returnStr += hours.toString() + '时';
            }
            if (minutes > 0) {
                returnStr += minutes.toString() + '分';
            }
            return returnStr;
        }

    });
})(jQuery);