<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %>
<fieldset id="date-range" class="collapsible">
<legend onclick="toggleFieldset(this);" class="icon icon-expanded"><%= l(:label_date_range) %></legend>
<div>
<% period = session[controller_name].try(:[], :period) %>
<div class="div-left">
<%= radio_button_tag 'period_type', '1', !@free_period, :onclick => '$("#from,#to").attr("disabled", true);$("#period").removeAttr("disabled");' %>
<%= select_tag 'period', options_for_period_select(period),
      :onfocus => '$("period_type_1").checked = true;',
      :onchange => "javascript: openReportPopup();",
      :disabled => @free_period %>
</div>
<div class="div-right">
<%= radio_button_tag 'period_type', '2', @free_period, :onclick => '$("#from,#to").removeAttr("disabled");$("#period").attr("disabled", true);' %>
<span onclick="$('period_type_2').checked = true;">
<%= l(:label_date_from_to, :start => ( date_field_tag('from', @from, {:id => 'from', :size => 10, :disabled => !@free_period}) +
          calendar_for('from')), :end => ( date_field_tag('to', @to, {:id => 'to', :size => 10, :disabled => !@free_period}) +
          calendar_for('to'))).html_safe %>
</span>
</div>
<div style="clear:both"></div>
</div>
</fieldset>