<% #main %>
<% poll.question %><br /><br />
<form method="post" action="<% response.action %>">
<table border="0" cellspacing="2" cellpadding="2">
<% poll.loop skin="$Choice#main" %>
<tr>
<td colspan="2">
   <br />
   <button type="submit" name="vote" value="1">vote</button> 
   <% poll.link result <% gettext "Results" %> %>
   <p class="small"><br />
   <% gettext "Created by {0} on {1}" <% poll.creator %> 
   <% poll.created short %> %>
   <% if <% poll.created %> is <% poll.modified %> then "" else 
      <% gettext "Last modified by {0} on {1}" <% poll.modifier %> 
      <% poll.modified short %> prefix="<br />" %>
   %></p>
</td>
</tr>
</table>
</form>

<% #results %>
<% poll.question %><br />
<% poll.loop skin="$Choice#result" %>
<p class="small"><br />
   <% gettext Total suffix=: %> 
   <% ngettext "{0} vote" "{0} votes" <% poll.votes %> %>
</p>
<div class="small">
   <% if <% poll.status %> is open then "" else
      <% if <% poll.closed %> is null then "" else  
         <% gettext "This poll was closed by {0} on {1}"
         <% poll.modifier %> <% poll.closed short %> prefix="<br />" %> 
      %>
   %>
</div>

<% #listItem %>
<a name="<% poll.id %>" id="<% poll.id %>"></a>
<div class="listSeparator"> </div>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<% if <% poll.status %> is closed then 
   '<td rowspan="2" width="10" align="center" valign="top" class="listFlag">
      c<br />l<br />o<br />s<br />e<br />d
    </td>
    <td rowspan="2" width="5"></td>'
%>
<td colspan="3" class="small">
   <strong><% gettext Macro suffix=: %></strong> <% poll.macro %>
   <div class="ample"><strong><% gettext Status suffix=: %></strong> 
   <% ngettext "{0} vote" "{0} votes" <% poll.votes %> %>
</td>
</tr>
<tr valign="top">
<td>
   <div class="storytitle"><% poll.question %></div>
   <div class="storyDate"><% poll.creator link %>, 
   <% poll.created short %></div>
</td>
<td width="10" nowrap="nowrap"> </td>
<td align="right" class="small">
   <% poll.link . <% gettext Vote %> prefix="... " suffix="<br />" %>
   <% poll.link results text="results" prefix="... " suffix="<br />" %>
   <% poll.link edit prefix="... " suffix="<br />" %>
   <% poll.link rotate prefix="... " suffix="<br />" %>
   <% poll.link delete prefix="... " %>
</td>
</tr>
</table>

<% #edit %>
<script type="text/javascript">
$(function() {
   var index = $(".choice").length + 1;
   $("#add").click(function() {
      var choice = $(".choice:last").clone();
      choice.find(".small").text('<% gettext Choice %> #' + index + ':');
      choice.find("input").val("");
      $(".choice:last").after(choice);
      $(".choice:last").find("input").focus();
      index += 1;
      return false;
   });
});
</script>
<p class="storyTitle"><% response.title %></p>
<form method="post" action="<% response.action %>">
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td>
   <span class="small"><% gettext Question suffix=: %></span><br />
   <% poll.input question cols="30" rows="3" class="formText" %>
</td>
</tr>
<% poll.input choices %>
<tr>
   <td class="small" colspan="2"><a href="" id="add"><% gettext "Add choice" %></a></td>
</tr>
<tr>
<td class="small"><br />
   <% poll.creator link prefix='Created by ' suffix=' on ' %>
   <% poll.created short %>
   <% if <% poll.created %> is <% poll.modified %> then "" else 
      <% gettext "Last modified by {0} on {1}" <% poll.modifier link %> 
      <% poll.modified short %> prefix="<br />" %>
   %></td>
</tr>
<tr>
<td>
   <button type="submit" name="save" value="<% poll.status default=closed %>">
      <strong><% gettext Save %></strong>
   </button>
   <button type="submit" name="save" value="<% if <% poll.status %> is open then closed else open %>">
      <% if <% poll.status %> is open then <% gettext Close %> else <% gettext Open %> %>
   </button>
   <a href="" class="cancel"><% gettext Cancel %></a>
</td>
</tr>
</table>
</form>
