<%= render :partial => 'abfrage_head' %>
<%= form_tag({:action => "naces"}) %>
<input type="hidden" name="origin" value="year" />
<p>
  <button type="submit">
    <%= image_tag('16-em-check.png',{:border => 0}) %>
  </button>
  <button type="button" onclick="window.location='<%= url_for :action => "index" %>'">
    <%= image_tag('16-em-cross.png',{:border => 0}) %>
  </button>
</p>

<table border="0">
  <tr>
    <td>Jahr:</td>

    <td><%=  select_year(@preselected_year, :start_year => Date.today.year, :end_year => 2007, :prompt => 'Alle')  %></td>
  </tr>
  <tr>
    <td>Bundesland:</td>
    <td id="bundeslaender">
        <% @bulaender.each do |bula| %>
          <%= check_box_tag 'bundesland[]', bula[0], (@preselected_bula || big_session[:abfrage][:bundeslaender].include?(bula[0])) %> <%=bula[1]%> <br />
        <%  end %>
        <button type="button" onclick="check_boxes(true)">Alle auswählen</button>
        <button type="button" onclick="check_boxes(false)">Alle abwählen</button>
    </td>
  </tr>
</table>
<script type="text/javascript" language="javascript">
  function check_boxes(value) {
    $('bundeslaender').childElements().each(function(el){el.checked=value});
  }
</script>
