

%if not thing.text:
  <p class="error">
    ${_("sorry.  That title is too long to fit on a t-shirt.")}
  </p>
%else:
<script type="text/javascript">
  function update_shirt(input) {
    $(input).parents("form").each(function() {
      $(this).find(".shirt-container .main").removeClass()
              .addClass("main")
              .addClass($(this).find("[name=style]").val())
              .addClass($(this).find("[name=color]").val());
    });
  }
  $(function() {
     update_shirt($("form.shirt input:first"));
  });

</script>
<div class="shirt preload">
  <div class="shirt-container">
    %for color in thing.colors:
      %for style in thing.styles:
       <div class="main ${color} ${style}">
       </div>
      %endfor
    %endfor
  </div>
</div>
     
<form class="shirt" method="post" action="/post/shirt"
      onsubmit="return post_form(this, 'shirt')">
  <input type="hidden" name="name" value="${thing.link._fullname}" />
  <h2>
    ${_("Your reddit headline shirt")}
  </h2>
  <p>
    For $21.99, this custom design will be printed on a 100% cotton
    American Apparel
    shirt&#32;<a href="http://store.xkcd.com/reddit">(comfy like all
    reddit schwag)</a>.  
  </p>
  <p>
    You'll quickly be the envy of your peers and win the affection of
    whomever you desire.
  </p>

  <div class="shirt-container">
    <div class="left">
      <h4>${_("Color")}</h4>
      <select name="color" onchange="update_shirt(this)">
        %for v in thing.colors:
        <option value="${v}" id="radio-${v}"
                ${"selected" if v == thing.default_color else ''}>${v}</option>
        %endfor
      </select>
      <h4>${_("Size")}</h4>
      <select name="size">
        %for v in thing.sizes:
          <option value="${v}" id="radio-${v}" 
                 ${"selected" if v == thing.default_size else ''}>
            ${v}</option>
        %endfor
      </select>
      <h4>${_("Style")}</h4>
      <select name="style" onchange="update_shirt(this)">
        %for v in thing.styles:
        <option value="${v}" id="radio-${v}"
                 ${"selected" if v == thing.default_style else ''}>${v}</option>
        %endfor
      </select>
      <h4>${_("Qty:")}
        <input type="text" name="quantity" maxlength="2" size="2" value="1"/>
      </h4>
      <input type="submit" name="sumbit" value="buyyit!" />
    </div>    
    <div style="float:left; clear: left" class="status">&nbsp;</div>
    <div class="main ${thing.default_color}">
      %for cls in ("", "big"):
        <div class="caption ${cls}">
          <div id="layout${cls}">
            %for text in thing.text:
              ${text}<br/>
            %endfor
          </div>
          <div class="byline">
            submitted by ${thing.link.author.name}<br/>
            ${thing.link._date.strftime("%B %e, %Y")}
          </div>
        </div>
      %endfor
    </div>
  </div>
</form>
%endif
