<table class="data">
  <tr>
    <% if contest %>
      <th width="20%">Contest</th>
      <th width="20%">Opponent</th>
    <% else %>
      <th width="30%">Opponent</th>
    <% end %>
    <th width="20%">Date</th>
    <% unless defined? exclude_maps %>
      <th width="20%">Maps</th>
    <% end %>
    <th width="5%">Score</th>
    <% if matches.first and matches.first.contest.contest_type == Contest::TYPE_LADDER %>
      <th width="5%">Points</th>
    <% end %>
  </tr>

  <% matches.each do |match| %>
    <% match.friendly = friendly %>
    <tr>
      <% if contest %>
        <td>
          <%= namelink match.contest %>
        </td>
      <% end %>
      <td>
        <%= namelink (match.get_opponent.team) %>
      </td>
      <td>
        <%= shorttime match.match_time %>
      </td>
      <% unless defined? exclude_maps %>
        <td>
          <%= match.map1 %>, <%= match.map2 %>
        </td>
      <% end %>
      <td>
        <%= link_to match, :class => "bold #{match.score_color}" do %>
          <% if friendly == match.contester1.team %>
            <%= h match.score1 %> - <%= h match.score2 %>
          <% else %>
            <%= h match.score2 %> - <%= h match.score1 %>
          <% end %>
        <% end %>
      </td>
      <% if match.contest.contest_type == Contest::TYPE_LADDER %>
        <td>
          <% if match.get_friendly(:points) > 0 %>
            <%= image_tag "icons/up.gif" %>
          <% elsif match.get_friendly(:points) < 0 %>
            <%= image_tag "icons/down.gif" %>
          <% end %>
          <%= match.get_friendly(:points) %>
        </td>
      <% end %>
    </tr>
  <% end %>
</table>
