
var lsVote={};

$(document).ready(function() {
    lsVote.vote = function(topic_id, the_el, vote_val, item_type){
        
        if ($('.lightbox').length !== 0){
            $('#do-register').click();
            return;
        }        
        
        $.post('/blogs-ajax/vote/'+topic_id+'/',{"yauzaa":Math.random(), "direction": vote_val},function(resp){
            if (resp == 'ok'){
                console.log(the_counter = $(the_el).parent().parent().children("li.total").children('span'));
                old_val = the_counter.html();
                the_counter.html(parseInt(vote_val)+parseInt(old_val));
            }else{
                if (resp[0] == 'm'){
                    alert(resp.substr(2));
                }else
                    alert('ошибка! попробуйте позднее!');
            }
        });
        
    }
});
