<div class="wt_add_ticket_block">
<h2><%=l(:wt_add_ticket)%></h2>
<select onchange="if (this.value != '') {
        jQuery.ajax({
                url: this.value,
                data: {asynchronous: true, method: 'get'},
                success: function (response) {
                        jQuery('#input_tickets').replaceWith(response);}
                })
        return false;}">
  <option value=''><%=l(:wt_select_project)%></option>
  <option disabled="disabled">---</option>
  <%
     Project.project_tree(@select_projects) do |prj, level|
       next unless prj.active?
       next if !User.current.allowed_to?(:log_time, prj)
       members = Member.
               where(["user_id=:u and project_id=:p",{:u=>User.current.id, :p=>prj.id}]).
               all
       next if members.size==0
       name_prefix = (level > 0 ? '&nbsp;' * 2 * level + '&#187; ': '').html_safe
  %>
      <option value="<%= url_for(:action=>"ajax_add_tickets_input_select", :prj=>prj.id) %>">
        <%= name_prefix + prj.name %>
      </option>
  <%
     end
  %>
</select>
<div id="input_tickets" style="display: inline-block;_display: inline;">
  <%=l(:wt_input_ticket_numbers)%>
  <form action="">
    <input type="text"
           id="input_ids"
           size=32
           onKeyPress="if(checkEnter(event)) {
                   tickets_inputed('<%=url_for(@link_params.merge(:action=>"ajax_add_tickets_insert"))%>');
                   return false;
                   }
                   return event;"
    />
    <input type="button"
           value="<%=l(:button_apply)%>"
           onclick="tickets_inputed('<%=url_for(@link_params.merge(:action=>"ajax_add_tickets_insert"))%>');"
    />
  </form>
</div>
</div>
<script>
    $('#input_ids').focus();
</script>