function vote(id, ctype ,direction) {
	$.post('/run/vote/' + ctype + '/' + id + '/' + direction + 'vote/',function(data){
		$("#spinner").fadeIn();
		$.get("/run/liked_people/" + ctype + "/" + id + "/", function(html){
				$("#spinner").hide();					
				$("#like_" + id + ' .like_button').hide();
				$("#like_" + id + " .liked-people-container").html(html);
			});
	 });    
}
function updateLikeButtonEvent(){
    $('.like_button').click(function (caller) {
      var id = $(this).parents('.like_widget').attr('objectid');
      var ctype = $(this).attr('contenttype');
      vote(id, ctype, 'up');
      return false;
      }
  );
}
$(document).ready(function() {
	updateLikeButtonEvent();
});
