function rate(id, type, rate) {
    var func = 'rateComment';

    if ($('#comment'+id).attr('blocked') == 'true') {
        return;
    } else {
        $('#comment'+id).attr('blocked', 'true');
    }

    $.ajax({
        type: "POST",
        url: "ajax.php",
        data: "func="+ func +"&commentId="+ id + "&rate="+ rate,
        success: function(msg) {
            msg = msg.replace('<span class="number">[01]</span>', '<span class="number">'+$('#comment'+id+' .number').text()+'</span>');

            $('#comment'+id).replaceWith(msg);
        }
    });
}

function switchComment(id) {
    if ($('#comment'+ id +' .content').is(':visible')) {
        $('#comment'+ id +' .switchLink a').text('Pokaż komentarz');
    } else {
        $('#comment'+ id +' .switchLink a').text('Ukryj komentarz');
    }

    $('#comment'+ id +' .content').toggle(200);
}

function loginMsg() {
    alert('Aby używać tej funkcji musisz być zalogowany.');
}