<%  project = project_listing
    @project_listing_zindex = @project_listing_zindex.nil? ? 200 : @project_listing_zindex - 1
-%>
<div id="<%= dom_id(project, "container") %>" class="list" style="z-index:<%= @project_listing_zindex %>">
  <div id="<%= dom_id(project) %>" class="project sortable_row" style="display:''">
    <div class="position">
      <span class="handle">DRAG</span>
    </div>  
    <div class="data">
      <%= link_to_project( project ) %><%= " (" + count_undone_todos_and_notes_phrase(project,"actions") + ")" %>
    </div>
    <div class="buttons">
      <span class="grey"><%= project.current_state.to_s.upcase %></span>
      <a class="delete_project_button" href="<%= formatted_project_path(project, :js) %>" title="delete the project '<%= project.name %>'"><%= image_tag( "blank.png", :title => "Delete project", :class=>"delete_item") %></a>
      <%= apply_behavior "a.delete_project_button:click", { :prevent_default => true, :external => true} do |page|
           page << "if (confirm('Are you sure that you want to ' + this.title + '?')) {"
           page << "  new Ajax.Request(this.href, {asynchronous:true,"
           page << "                               evalScripts:true, method:'delete'}); };"
         end -%>
      <a class="edit_project_button" id="<%= dom_id(project, 'editbutton') %>" href="<%= formatted_edit_project_path(project, :js) %>" title="delete the project '<%= project.name %>'"><%= image_tag( "blank.png", :title => "Edit project", :class=>"edit_item") %></a>
         <%= apply_behavior "a.edit_project_button:click", { :prevent_default => true, :external => true} do |page|
              page << "  this.up('.project').startWaiting();"
              page << "  new Ajax.Request( this.href, {asynchronous:true, evalScripts:true, method:'get'});"
             end
         -%>
    </div>
  </div>

  <div id="<%= dom_id(project, 'edit') %>" class="edit-form" style="display:none;">
  </div>
</div>
<% if controller.action_name == 'create' %>
<script>
   new Effect.Appear('<%= dom_id(project) %>');
</script>
<% end %>
