{% load i18n %}
{% get_calendar as calendar %}
<div class="calendar">
  <div class="pagination">
    <div style="margin-bottom: 5px; float: left;">
      <strong>{{ selected_month|date:"F Y" }}</strong>
    </div>
    <div style="margin-bottom: 5px; float:right;">
      <a title="{% trans "previous month" %}" href="?calendar_month={{ prev.month }}&calendar_year={{ prev.year }}"><span class="sprite left_big"></span></a>
      <a title="{% trans "next month" %}" href="?calendar_month={{ next.month }}&calendar_year={{ next.year }}"><span class="sprite right_big"></span></a>
    </div>
  </div>
  <table width="100%">
    <tbody>
      <tr>
        {% for no, date in calendar.weekdays %}
          <th>{{ date|date:"D" }}</th>
        {% endfor %}
      </tr>
      {% for week in calendar.data %}
        <tr>
          {% for day in week %}
            {% ifequal day.month calendar.month %}
              {% ifequal selected_day day %}
                <td class="selected"><a href="/time/{{ day|date:"Y/m/d" }}"><strong>{{ day.day }}</strong></a></td>
              {% else %}
                <td class="{% ifequal day today %}current{% endifequal %}"><a href="/time/{{ day|date:"Y/m/d" }}">{{ day.day }}</a></td>
              {% endifequal %}
            {% else %}
              <td class="invalid">{{ day.day }}</td>
            {% endifequal %}
          {% endfor %}
        </tr>
      {% endfor %}
    </tbody>
  </table>
  <div class="pagination">
  <form action="" method="GET">
    <select name="calendar_month" id="month">
    {% for no, date in calendar.months %}
      {% ifequal no calendar.month %}
        <option selected="selected" value="{{ no }}">{{ date|date:"F" }}</option>
      {% else %}
        {% ifequal no today.month %}
          <option style="font-weight: bold;" value="{{ no }}">{{ date|date:"F" }}</option>
        {% else %}
          <option value="{{ no }}">{{ date|date:"F" }}</option>
        {% endifequal %}
      {% endifequal %}
    {% endfor %}
    </select>
    <select name="calendar_year" id="year">
      {% for no, name in calendar.years %}
        {% ifequal no calendar.year %}
          <option style="font-weight: bold;" selected="selected" value="{{ no }}">{{ name }}</option>
        {% else %}
          {% ifequal no today.year %}
            <option style="font-weight: bold;" value="{{ no }}">{{ name }}</option>
          {% else %}
            <option value="{{ no }}">{{ name }}</option>
          {% endifequal %}
        {% endifequal %}
      {% endfor %}
    </select>
    <input class="submit" type="submit" value="{% trans "Show" %}" name="show">
  </form>
  </div>
</div>