<div class="wide" id="matches">
  <h1 class="center">
    <%= link_to (h @contester.team.name), team_url(@contester.team, :teamTab => "matches", :anchor => "contest_#{@contester.contest.id}") %>
  </h1>
  <h4 class="center">
    <%= namelink @contester.contest %>
  </h4>
  <% if @contester.team.logo %>
    <%= image_tag @contester.team.logo.url, :class => "centered" %>
  <% end %>
</div>

<div class="wide2" id="matchesTab">
  <ul id="matchesTab-nav" class="tabs">
    <li><a href="#results">Results</a></li>
    <li><a href="#upcoming">Upcoming</a></li>
    <li><a href="#info>">Info</a></li>
  </ul>

  <div class="box tabs">
    <div class="tab" id="results">
      <%= render :partial => "matches/list", :locals => {:matches => @results, :friendly => @contester.team, :contest => false} %>
    </div>

    <div class="tab" id="results">
      <h3>
        Upcoming
      </h3>

      <table class="data">
        <tr>
          <th>Opponent</th>
          <th>Date</th>
          <th>Maps</th>
          <th>Server</th>
        </tr>

        <% @matches.each do |match| %>
          <% match.friendly = @contester.team %>
          <tr>
            <td><%= namelink match.get_opponent %></td>
            <td><%= link_to shorttime(match.match_time), match %></td>
            <td><%= namelink match.map1 %>, <%= namelink match.map2 %></td>
            <td><%= namelink match.server %></td>
          </tr>
        <% end %>
      </table>
    </div>

    <div class="tab" id="info">
      <h3 class="center">
        Rank
      </h3>

      <%= cascade @contester, ["total", "win", "loss", "draw"] %>

      <% if !@contester.active %>
        <p>
          <b>INACTIVE</b>
        </p>
      <% end %>
    </div>
  </div>
</div>

<div class="box wide clear">
  <h3 class="center">
    Members
  </h3>

  <%= render :partial => "teamers/list", :locals => {:teamers => @members, :blacklist => nil, :comment => false} %>
</div>

<% if @contester.can_update? cuser %>
  <%= link_to 'Edit', edit_contester_path(@contester) %> |
<% end %>

<%= link_to 'Back', @contester.contest %>

<script type="text/javascript">
  var tabber1 = new Yetii({id: 'matchesTab'});
</script>
