{% load almanac_tags %}
<td class="sg-datebox {% ifnotequal day.day.moonphase None %}sg-moonphase{{day.day.moonphase}}{% endifnotequal %}">
  <h2 class="sg-dateline">{{day.day.date|date:"D"}} &nbsp;&nbsp;<span class="sg-date">{{day.day.date|date:"n/j"}}</span></h2>
  {% ifnotequal day.day.moonphase None %}
  <h3 class="sg-moonphase sg-moonphase{{day.day.moonphase}}a">
    <img class="sg-moonphase-icon" src="http://penobscotbaypress.com/media/images/moon/moonphase_{{day.day.moonphase}}.jpg" width="27px" height="27px"/>
  </h3>
  <p>{{day.day.get_moonphase_display}}</p>
  <p> {% bold_afternoon_time day.day.moonphase_time "%-I:%M"%}</p>
  {% endifnotequal %}
</td>
<td class="sg-setbox">
  <table class="sg-list"> 
    <tr><td>Moonset</td><td>{% bold_afternoon_time day.day.moonset "%-I:%M"%}</td></tr>
    <tr><td>Sunrise</td><td>{% bold_afternoon_time day.day.sunrise "%-I:%M"%}</td></tr>
    <tr><td>Moonrise</td><td>{% bold_afternoon_time day.day.moonrise "%-I:%M"%}</td></tr>
    <tr><td>Sunset</td><td>{% bold_afternoon_time day.day.sunset "%-I:%M"%}</td></tr>
  </table>
</td>
<td class="sg-tidebox">
  <table class="sg-list">
    <tr><td>{{day.tide_1.get_state_display}}</td><td>{% bold_afternoon_time day.tide_1.time "%-I:%M"%}</td><td>{{day.tide_1.level|floatformat}}'</td></tr>
    <tr><td>{{day.tide_2.get_state_display}}</td><td class="time">{% bold_afternoon_time day.tide_2.time "%-I:%M"%}</td><td>{{day.tide_2.level|floatformat}}'</td></tr>
    <tr><td>{{day.tide_3.get_state_display}}</td><td class="time">{% bold_afternoon_time day.tide_3.time "%-I:%M"%}</td><td>{{day.tide_3.level|floatformat}}'</td></tr>
    <tr>{% if day.tide_4 %}<td>{{day.tide_4.get_state_display}}</td><td class="time">{% bold_afternoon_time day.tide_4.time "%-I:%M"%}</td><td>{{day.tide_4.level|floatformat}}'</td>{% else %}<td></td><td></td><td></td>{% endif %}</tr>
  </table>
</td>
