<div id="replay"><%= link_to '录像下载', @duel.replay %></div>
<style type="text/css">
  <!--

  .STYLE3 {color: #00FF00; font-size:12px;}
  .STYLE4 {color: #990000; font-size:12px;}
  .STYLE6 {color: #CCCCCC}
  -->
  .card
  {
    float:left; padding-left:10px; padding-bottom:9px;
  }
  .card img
  {
    width:40px; height:50px; border:0px;
  }
  .user{  width:330px; font-size:20px; color:#ffcc66; float:left; cursor:pointer;  line-height:40px;padding-left: 12px;font-weight: bold;}
  .user_act{  width:330px; font-size:20px; color:#ffcc66; float:left; cursor:pointer; background-color:#111111; line-height:40px;padding-left: 12px;font-weight: bold;}
  #cards1{background-color:#111111; overflow:hidden; padding:12px;}
  #cards2{background-color:#111111; overflow:hidden; padding:12px;  display:none}
</style>
<script>
  function show(i){
    if (i==1)
    {
      $('#cards2').hide(500);
      $('#cards1').show(500);
      $('#user2').attr("class","user");
      $('#user1').attr("class","user_act");
    }
    else
    {
      $('#cards1').hide(500);
      $('#cards2').show(500);
      $('#user1').attr("class","user");
      $('#user2').attr("class","user_act");
    }
  }
</script>
<div style="color: white; width:750px;" align="left">
  <div class="user_act" id="user1" onClick="show(1)">
    <%= @duel.user1.name %> 
    <% if @duel.winner == @duel.user1 %>
      <span class="STYLE3">WINNER</span>
    <% else %>
      <span class="STYLE4">LOSER</span>
    <% end %>
    <span class="STYLE2"><% if @duel.user1_public or @current_user == @duel.user1 %><%= link_to image_tag('deck_download.png', :border=>false, :style => 'float:right;padding:12px 12px 0 0'), "/duels/#{@duel.id}/user1_deck.ydk" %><% end %> </span>
    <% if @current_user == @duel.user1 %>
      <%= form_for(@duel, :html => {:style => "display:inline"}) do |f| %>
        <span style="font-size:12px;color:white;float:right;padding-right:24px">公开卡组<%= f.check_box :user1_public, :onclick=>"submit()" %></span>
      <% end %>
    <% end %>  
  </div>
  <div class="user" id="user2" onClick="show(2)" > 
    <%= @duel.user2.name %> 
    <% if @duel.winner == @duel.user2 %>
      <span class="STYLE3">WINNER</span>
    <% else %>
      <span class="STYLE4">LOSER</span>
    <% end %>
    <% if @duel.user2_public or @current_user == @duel.user2 %><%= link_to image_tag('deck_download.png', :border=>false, :style => 'float:right;padding:12px 12px 0 0'), "/duels/#{@duel.id}/user2_deck.ydk" %><% end %>
    <% if @current_user == @duel.user2 %>
      <%= form_for(@duel, :html => {:style => "display:inline"}) do |f| %>
        <%= f.check_box :user2_public, :onclick=>"submit()" %> <span style="font-size:12px;color:white">公开卡组</span>
      <% end %>
    <% end %>  
  </div>
  <div style="clear:both"/>
  <div id="cards1">
    <% if @duel.user1_public or @current_user == @duel.user1 %>
      <p><b>主卡组:</b> </p>
      <% @duel.user1_main.each do |card| %>
        <div class="card">
          <%= link_to image_tag(card.image, :title => card.name), card %>
        </div>
      <% end %>

      <div style="clear:both"/>
      <p><b>额外:</b> </p>
      <% @duel.user1_extra.each do |card| %>
        <div class="card">
          <%= link_to image_tag(card.image, :title => card.name), card %>
        </div>
      <% end %>
    <% else %>
      卡组未公开
    <% end %>
  </div>
</div>
<div style="clear:both"/>
<div style="color: white; width:700px; " align="left">
  <div id="cards2">
    <% if @duel.user2_public or @current_user == @duel.user2 %>
      <p><b>主卡组:</b> </p>
      <% @duel.user2_main.each do |card| %>
        <div class="card">
          <%= link_to image_tag(card.image, :title => card.name, :width => 54, :height => 81), card %>
        </div>
      <% end %>
      <div style="clear:both"/>
      <p><b>额外:</b> </p>
      <% @duel.user2_extra.each do |card| %>
        <div class="card">
          <%= link_to image_tag(card.image, :title => card.name, :width => 54, :height => 81), card %>
        </div>
      <% end %>
    <% else %>
      卡组未公开
    <% end %>
  </div>
</div>