<%
   var id = span.attr('for');
   var mode = get_pref('rate-mode-' + id);
   var size = get_pref('chart-size-' + id);
   var range_pref = get_pref('chart-range');
%>

<form action="#/rate-options" method="put" class="auto-submit">
  <input type="hidden" name="id" value="<%= id %>"/>
  <table class="form" width="100%">
    <tr>
      <td colspan="2">
        <h3>This time series</h3>
      </td>
    </tr>
    <tr>
      <th><label>Display:</label></th>
      <td>
        <%= fmt_radio('mode', 'Chart',         'chart', mode) %>
        <%= fmt_radio('mode', 'Current value',  'curr', mode) %>
        <% if (id != 'node-stats') { %>
             <%= fmt_radio('mode', 'Moving average',  'avg', mode) %>
        <% } %>
      </td>
    </tr>
    <tr>
      <th><label>Chart size:</label></th>
      <td>
        <%= fmt_radio('size', 'Small',   'small', size) %>
        <%= fmt_radio('size', 'Medium', 'medium', size) %>
        <%= fmt_radio('size', 'Large',   'large', size) %>
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <h3>All time series</h3>
      </td>
    </tr>
    <tr>
      <th><label>Chart range:</label></th>
      <td>
<%
   var range_type = get_chart_range_type(id);
   for (var i = 0; i < CHART_RANGES[range_type].length; ++i) {
      var data = CHART_RANGES[range_type][i];
      var range = data[0];
      var desc = data[1];
%>
    <%= fmt_radio('range', desc, range, range_pref) %>
<%
   }
%>
      </td>
    </tr>
  </table>
</form>
