function addComment(commentId)
{
    $('#comment-add-form').show();
    $('#comment').focus();
    if (commentId != undefined) {
        $('#parent_comment').val(commentId);
    }
}

function commentVote(commentId, vote)
{
    $.ajax({
            data: {id: commentId, vote: vote},
            success: function(data){
                $('#vote-plus-' + commentId).css('visibility', 'hidden');
                $('#vote-minus-' + commentId).css('visibility', 'hidden');
                var votes = $('#vote-' + commentId);
                var rank = parseInt(votes.html()) + vote;
                votes.html(rank);
                if (rank >= 0) {
                    votes.removeClass('red').addClass('green');
                } else {
                    votes.removeClass('green').addClass('red');
                }
            },
            url: '/comment-vote/'
    });
}


