<script type="text/javascript">
	$(document).ready(function(){
		$("form#polls-form").validate();
		$("form#polls-form #polls-name").rules("add", {required: true});
	});
</script>
<h1>{{$lang.Poll}}</h1>
<form action="?p={{$_GET.p}}" method="post" name="form" id="polls-form" >
	<fieldset>
		<input type="hidden" name="iPollId" value="{{$aPoll.iPollId}}" />
		<table class="details">
			<thead>
				<tr>
					<th class="name">{{$lang.Poll_question}}</th><td class="value"><input id="polls-name" type="text" name="sQuestion" value="{{$aPoll.sQuestion}}" size="80" maxlength="255" alt="simple" class="input" /> <a href="#" id="new-answer-item-button"><img title="{{$lang.Add_answer}}" alt="{{$lang.Add_answer}}" src="templates/admin/images/ico/add.png" /></a></td><td class="votes"></td>
				</tr>
				<tr class="answer-item" id="new-answer-item" style="display:none;">
					<th class="name">{{$lang.Poll_answer}} </th><td class="value"><input type="text" name="aAnswers[]" value="" size="80" maxlength="255" class="input" /> <a href="#" class="delete-answer-item-button"><img title="{{$lang.Delete_answer}}" alt="{{$lang.Delete_answer}}" src="templates/admin/images/ico/delete.png" /></a></td><td class="votes"></td>
				</tr>
			</thead>
			<tbody>
				{{foreach from=$aPoll.aPollAnswers item=aAnswer}}
					<tr class="answer-item">
						<th class="name">{{$lang.Poll_answer}} {{$aAnswer@iteration}}</th><td class="value"><input type="text" name="aAnswers[{{$aAnswer.iAnswerId}}]" value="{{$aAnswer.sText}}" size="80" maxlength="255" class="input" /> <a href="#" class="delete-answer-item-button"><img title="{{$lang.Delete_answer}}" alt="{{$lang.Delete_answer}}" src="templates/admin/images/ico/delete.png" /></a></td><td class="votes">{{$lang.Poll_votes}}: {{$aAnswer.iVotes}}</td>
					</tr>
				{{/foreach}}
			</tbody>
		</table>
		<div class="save float"><div class="save floatcontainer">
			<input type="submit" class="submit" value="&laquo; {{$lang.return}}" onclick="location.href = '?p=polls-list'; return false;"> <input type="submit" class="submit" value="{{$lang.Save}} &raquo;" name="sOption" />
		</div></div>
	</fieldset>
</form>