<div id="display_box">
  <div id="projects-empty-nd" style="<%= @no_projects ? 'display:block' : 'display:none'%>">
    <div class="message"><p>Currently there are no projects</p></div>
  </div>
  <%= render :partial => 'project_state_group', :object => @active_projects, :locals => { :state => 'active'} %>
  <%= render :partial => 'project_state_group', :object => @hidden_projects, :locals => { :state => 'hidden'} %>
  <%= render :partial => 'project_state_group', :object => @completed_projects, :locals => { :state => 'completed'} %>
</div>

<% @project = @new_project -%>
<div id="input_box">
  <div id="project_new_project_filler">
    <div id="project_new_project_container">
      
      <div id="toggle_project_new" class="hide_form">
        <a title="Hide new project form" accesskey="n">&laquo; Hide form</a>
        <%  apply_behavior '#toggle_project_new a:click', :prevent_default => true do |page|
              page << "TracksForm.toggle('toggle_project_new', 'project_new', 'project-form',
                                         '&laquo; Hide form', 'Hide new project form',
                                         'Create a new project &#187;', 'Add a project');"
            end
        %>
      </div>

      <div id="project_new" class="project_new" style="display:block">
        <% form_remote_tag(:url => projects_path, :method => :post,
          :html=> { :id=>'project-form', :name=>'project', :class => 'inline-form'},
          :before => "$('project_new_project_submit').startWaiting()",
          :complete => "$('project_new_project_submit').stopWaiting()",
          :condition => "!$('project_new_project_submit').isWaiting()") do -%>
        
          <div id="status"><%= error_messages_for('project') %></div>
        
          <label for="project_name">Name:</label><br />
          <%= text_field 'project', 'name', "tabindex" => 1  %><br />
        
          <label for="project_description">Description (optional):</label><br />
          <%= text_area 'project', 'description', "cols" => 30, "rows" => 4, "tabindex" => 2  %><br />
        
          <% unless @contexts.empty? -%>
            <label for="default_context_name">Default Context (optional):</label><br />
            <%= text_field_tag("project[default_context_name]", @project.default_context.name, :tabindex => 3) %>
            <%= render :partial => 'default_context_autocomplete' %>
            <br />
          <% end -%>
          
          <br/>
  
          <div class="submit_box">
            <div class="widgets">
              <button type="submit" class="positive" id="project_new_project_submit">
                <%= image_tag("accept.png", :alt => "") + 'Add Project' %>
              </button>
            </div>
          </div>
        
          <br/><br/>
          <input id="go_to_project" type="checkbox" tabindex="5" name="go_to_project"/><label for="go_to_project"> Take me to the new project page</label><br /> 
        
        <% end -%>
      </div>
    </div>
  </div>
</div>