function doCommentVote(comment_id, vote)
{
    jQuery.getJSON('/ajax/vote', {'what': 'C', 'what_id': comment_id, 'vote': vote},
        function(data)
        {
            if(data.vote_result == 'ok')
            {
                var cm = document.getElementById('comment_rating_'+comment_id);
                var cr = parseInt(cm.innerHTML);
                cr += vote;
                cm.innerHTML = cr;
                
                hideElement('comment_vote_pm_'+comment_id);
            };
        }
    );
};

function doPostVote(post_id, vote)
{
    jQuery.getJSON('/ajax/vote', {'what': 'P', 'what_id': post_id, 'vote': vote},
        function(data)
        {
            if(data.vote_result == 'ok')
            {
                hideElement('post_rating_form_'+post_id);
                var cr = data.rating;
                var v = document.getElementById('post_rating_view_cr_'+post_id);
                v.style.width = (cr*20)+'%';
                showElement('post_rating_view_'+post_id); 
                
                var l = 'экспоната';
                if(window.location.href.indexOf('/post/') != -1) l = 'образца';
                
                //document.getElementById('post_rating_label').innerHTML = 'Рейтинг '+l+': ';
                //document.getElementById('post_rating_label_2').style.display = '';
                document.getElementById('post_rating_img').src = 'img/rating/rs'+vote+'.png';
            };
        }
    );
};