<h1><%= @actor.full_name %>'s movies</h1>
<!-- THIS VIEW IS NOT TIED TO A PARTICULAR MODEL. IT CONTAINS 
     TWO FORMS AND INTENDS TO ALLOW CONNECTING ACTORS WITH 
     MOVIES. YOU CAN ADD OR A REMOVE ACTOR(S) FROM MOVIES AND 
     VIEW THE RELATIONSHIP BETWEEN THOSE ENTITIES ON ONE SCREN. 
     IT USES RJS TO ANIMATE THE ADDITION AND REMOVAL OF MOVIES
     TO AND FROM ACTORS.
-->

  <% form_remote_tag :url => movie_remove_actor_path(@actor), :html => {:id => 'removal_form'} do %>
  <table id="MoviesStaffed">
    <tr>
      <th>Movie</th>
      <th>Remove?</th>
    </tr>
  <% for movie in @movies do %>
      <tr id = "<%= dom_id(movie) %>">
        <td><%=h movie.title %></td>
        <td><%= check_box_tag "movies[]", movie.id %></td>
      </tr>
  <% end %>
  </table>
  <br />

  <%= submit_tag "Remove checked movies" %>
  <% end %>

<hr />
<h3>Cast <%= @actor.full_name %> in a new movie</h3>

    <% form_remote_tag :url => movie_add_actor_path(@actor), :html =>{:id => 'staffing_form' } do %>
      <% un_movies = @actor.not_involved_movies %>
      <table id= "MoviesUnstaffed">
       <tr>
	    <th>Movie</th>
	    <th>Staff?</th>
	   </tr>
	   <% for movie in un_movies do %>	
		 <tr id= "<%= dom_id(movie) %>">
		 <td><%=h movie.title %></td>
		 <td><%= check_box_tag "movies[]", movie.id %></td>
	    </tr>
	   <% end %>
      </table>
      <br />	
  	  <%= submit_tag 'Staff in checked movies' %>
    <% end %>

   <p><%=link_to "Back", @actor %></p>	

    
