$(function(){
  $("a.delete_wall").click(function(){
    var wall_id = $(this).attr("id").replace("delete-", "");
    var wall_title = $(".row-" + wall_id).find(".wall_title").text();
    if (confirm('Are you sure you want to delete the wall "' + wall_title + '"?  This action cannot be undone.')) {
      var data = {
          wall_id: wall_id,
          session_token: User.getSessionToken()
      };
      
      $.postJSON("delete.php", data, function(response){
        if (response.success) {
          $(".row-" + wall_id).fadeOut(function(){$(this).remove();});
        }
      });
    }
    return false;
  });
  
  User.init();
});
