
  $.ajaxSetup({global: true, async: false});
  $(document).ready( function()
  {
  
    $('.rateCommentPlus, .rateCommentMinus').click( function()
    {
        var parent = $(this).parent();
        
        var cId = $(this).attr('cid');
        var number = ( $(this).hasClass('rateCommentPlus') ) ? +1 : -1;

        $.get("/scripts/php/isLogged.php", function(data)
        {
          data = parseInt( data );
          if ( data > 0 )
          {
              $.get("/scripts/php/crate.php", { "id" : cId, "ocena" : number, "type" : "katalog" }, function(dane)
              {
                parent.find('b').html( dane );
                if ( parseInt(dane) < 0 )
                {
                  parent.find('b').css('color', 'red');
                }
                else
                {
                  parent.find('b').css('color', 'inherit');
                }
              });     
          }
          else
            alertMsg("nonLogged");
        });
      
    });
    
  });
