$().ready(
function(){

$(".rate").click(function(){

clicked=$(this).html();

if(clicked=="[-]"){ rate="minus";  }
if(clicked=="[+]"){ rate="plus";  }

data=$(this).attr('id');

      $.ajax({
   type: "POST",
   url: "/ajax/cm_rate.php",
   data: data,
   success: function(msg){   
     if(msg!=0){ 
     oldrate=$("#"+msg).html();
     if(rate=="minus"){ newrate=parseInt(oldrate)-1; }
     else if(rate=="plus") { newrate=parseInt(oldrate)+1; }
     if(newrate>0){ newrate = "+"+newrate; }
     $("#"+msg).html(newrate); 
     }  
   }
 });


$(this).parent().parent().html("");

});

});
