{{function name="selectOptions" aOptions=0 mOption=0}}
	{{foreach from=$aOptions item=sOption}}
		<option value="{{$sOption@key}}" {{if ( is_array( $mOption ) && in_array( $sOption@key, $mOption ) ) || ( $sOption@key == $mOption )}}selected="selected"{{/if}}>{{$sOption}}</option>
	{{/foreach}}
{{/function}}

<script type="text/javascript">
	$(document).ready(function(){
		$("form#comments-form").validate();
		$("form#comments-form #comments-rating").rules("add", {required: true});
		$("form#comments-form #comments-name").rules("add", {required: true});
		$("form#comments-form #comments-text").rules("add", {required: true});
	});
</script>
<h1>{{$lang.Comments}}</h1>
<form action="{{$aComment.sLinkName}}" method="post" id="comments-form" >
	<fieldset>
		<input type="hidden" name="sOption" value="saveComment" />
		<table class="details">
			<tr>
				<th class="name">{{$lang.Date}}</th><td class="value">{{$aComment.sDate}}</td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_comments_date}}" /></td>
			</tr>
			<tr>
				<th class="name">{{$lang.Enabled}}</th><td class="value"><select name="iStatus">{{selectOptions aOptions=$aYesNo mOption=$aComment.iStatus}}</select></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_comments_enabled}}" /></td>
			</tr>
			<tr>
				<th class="name">{{$lang.Accepted}}</th><td class="value"><select name="iAccepted">{{selectOptions aOptions=$aYesNo mOption=$aComment.iAccepted}}</select></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_comments_accepted}}" /></td>
			</tr>
			{{if isset( $aComment.iRating )}}
				<tr>
					<th class="name">{{$lang.Rating}}</th><td class="value"><select name="iRating" id="comments-rating" style="float:left;"><option value="0" id="rating0">{{$lang.No_rating}}</option>{{selectOptions aOptions=$aRatings mOption=$aComment.iRating}}</select></td><td class="help"></td>
				</tr>
			{{/if}}
			<tr>
				<th class="name">{{$lang.Name_and_surname}}</th><td class="value"><input type="text" name="sName" class="input" value="{{$aComment.sName}}" id="comments-name" alt="simple" maxlength="40" size="30" /></td><td class="help"></td>
			</tr>
			<tr>
				<th class="name">{{$lang.Comment_content}}</th><td class="value"><textarea cols="45" rows="7" name="sContent" id="comments-text" title="simple">{{$aComment.sContent}}</textarea></td><td class="help"></td>
			</tr>
			<tr>
				<th class="name">{{$lang.IP}}</th><td class="value"><a href="http://www.ripe.net/perl/whois?form_type=simple&amp;full_query_string=&amp;searchtext={{$aComment.sIp}}&amp;do_search=Search" target="_blank">{{$aComment.sIp}}</a></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_comments_IP}}" /></td>
			</tr>
			<tr class="actions">
				<td colspan="3" class="save"><input type="submit" class="submit" value="&laquo; {{$lang.return}}" onclick="location.href = '?p=comments-list'; return false;"> <input type="submit" value="{{$lang.Save_comment}}" class="submit" /></td>
			</tr>
		</table>
	</fieldset>
</form>