function renderLiveNowComment(data) {
    if (data && data.Comments.Comment) {

        var time_update_duration = 2000;

        var x = data.Comments.Comment;
        var articleUrl = x.ArticleUrl;
        var topicTitle = x.TopicTitle;
        var commentText = x.CommentText;
        var commentType = x.CommentType;
        var createdOn = new Date(Ninemsn.Share.Util.GetAussieDate(x.CreatedOn));
        var userID = x.UserID;
        var displayName = x.DisplayName;
        var suburb = x.Suburb;
        var parentUserID = x.ParentUserID;
        var parentDisplayName = x.ParentDisplayName;

        if ($('#liveNowCommentList').length) {

            var commentHtml = '<li class="comment userComment';

            if ((commentType == 1 || commentType == 2) && parentUserID && parentDisplayName) {
                commentHtml += ' reply">';
            } else {
                commentHtml += '">';
            }

            commentHtml += '<div class="commentText">' + commentText + '</div>';
            commentHtml += '<div class="commentTitle">'
            if (articleUrl) {
                commentHtml += '<a href="' + articleUrl + '">'
            };
            commentHtml += 'Topic: ' + topicTitle;
            if (articleUrl) {
                commentHtml += '</a>'
            };
            commentHtml += '</div>';
            commentHtml += '<div class="commentInfo';

            if ((commentType == 1 || commentType == 2) && parentUserID && parentDisplayName) {
                commentHtml += ' replyInfo">';
            } else {
                commentHtml += '">';
            }

            commentHtml += '<b class="infoDisName">' + displayName + '&nbsp;</b>';

            if (commentType == 1 && parentUserID && parentDisplayName) {
                commentHtml += 'agreed with <a>' + parentDisplayName + '</a>';
            } else if (commentType == 2 && parentUserID && parentDisplayName) {
                commentHtml += 'disagreed with <a>' + parentDisplayName + '</a>';
            } else {
                commentHtml += '<span>' + suburb + '</span><span class="commentInfoTime opaque80">' + getLiveNowCommentTime(createdOn) + '</span>';
            }

            commentHtml += '</div>';
            commentHtml += '</li>';

            $('#liveNowCommentList').html(commentHtml);
        }
    }
}

function getLiveNowCommentTime(createdOn) {
    var createdDateS = Math.floor(createdOn.getTime() / 1000);
    var now = new Date();
    var nowS = Math.floor(now.getTime() / 1000);
    var diff = nowS - createdDateS;

    var dateStr = '';

    if (diff < 60) {
        dateStr = '&nbsp;' + diff + ' sec ago';
    }
    else {
        var diffMinutes = Math.floor(diff / 60);
        var diffSecs = diff % 60;
        dateStr = '&nbsp;' + diffMinutes + ' min ' + diffSecs + ' sec ago';
    }

    return dateStr;
}
