<%= render :partial => 'abfrage_head' %>
<%= form_tag({:action => "filter"})%>
<input type="hidden" name="origin" value="bula" />

<table border="0">
  <tr>
    <td>Welche Bundesländer sollen betrachtet werden?</td>
    <td id="bundeslaender">
      <% @bulaender.each do |bula| %>
        <%= check_box_tag 'bula[]', bula[0].to_s, @preselected_bulas.include?(bula[0].to_i) %> <%= 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>

<p>
  <button type="submit">
    <%= image_tag('16-em-check.png',{:border => 0}) %>
  </button>
  <button type="button" onclick="window.location='<%= url_for :controller => :start, :action => "index" %>'">
    <%= image_tag('16-em-cross.png',{:border => 0}) %>
  </button>
</p>

<script type="text/javascript" language="javascript">
  function check_boxes(value) {
    $('bundeslaender').childElements().each(function(el){el.checked=value});
  }
</script>