<% if @membership.destroyed? %>
  $("#member-<%= @membership.id %>").remove();
<% elsif @membership.valid? %>
  $("#member-<%= @membership.id %>-form").empty();
  $("#member-<%= @membership.id %>-roles").html("<%= escape_javascript @membership.roles.sort.collect(&:to_s).join(', ') %>").show();
  $("#member-<%= @membership.id %>").effect("highlight");
<% else %>
  alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => @membership.errors.full_messages.join(', ')))) %>');
<% end %>
