{include file="header.tpl"}

{literal}
<script type="text/javascript"><!--
function checkVote()
{
  if (!document.vote.email) return true;

  status = checkEmail(document.vote.email.value);

  if (status > 0) {
    if (status == 1)
	    alert('Please, enter your E-Mail address!');
    if (status == 2)
	    alert('Please, enter a valid E-Mail address!');

    document.vote.email.focus();
    return false;
  }
  return true;
}
--></script>
{/literal}
<div class="goback" style="padding-left:8px;"><a href="javascript:history.go(-1)" class="staff">&laquo; Go Back</a></div>

{include file="program_details.tpl" listing=$listing group=$group}

<div class="details">
<div class="delim"></div>
<div class="votes_summary" style="padding-left:8px;">
<div class="summary mood3 clearfix">
 <div class="mood">Very Good</div>
 <div class="rate"><div style="width:{$listing.votes_summary.3.percent+1}%" title="{$listing.votes_summary.3.count} votes ({$listing.votes_summary.3.percent}%)"></div></div>
</div>
<div class="summary mood2 clearfix">
 <div class="mood">Good</div>
 <div class="rate"><div style="width:{$listing.votes_summary.2.percent+1}%" title="{$listing.votes_summary.2.count} votes ({$listing.votes_summary.2.percent}%)"></div></div>
</div>
<div class="summary mood1 clearfix">
 <div class="mood">Bad</div>
 <div class="rate"><div style="width:{$listing.votes_summary.1.percent+1}%" title="{$listing.votes_summary.1.count} votes ({$listing.votes_summary.1.percent}%)"></div></div>
</div>
<div class="summary mood0 clearfix">
 <div class="mood">Very Bad</div>
 <div class="rate"><div style="width:{$listing.votes_summary.0.percent+1}%" title="{$listing.votes_summary.0.count} votes ({$listing.votes_summary.0.percent}%)"></div></div>
</div>
</div>

{if $votes}
<table class="votes list">
<tr>
  <th style="text-align: center;">Rating</th>
  <th>Info</th>
  <th>Comment</th>
</tr>
{section name=v loop=$votes}
<tr class="{cycle values="row1,row2"}">
  <td style="text-align: center;">
   {if $votes[v].vote == 0}<img src="{"`$theme`images/r0.gif"|encurl}" alt="Very Bad" title="Very Bad">{/if}
   {if $votes[v].vote == 1}<img src="{"`$theme`images/r1.gif"|encurl}" alt="Bad" title="Bad">{/if}
   {if $votes[v].vote == 2}<img src="{"`$theme`images/r2.gif"|encurl}" alt="Good" title="Good">{/if}
   {if $votes[v].vote == 3}<img src="{"`$theme`images/r3.gif"|encurl}" alt="Very Good" title="Very Good">{/if}
  </td>
  <td>
   {if $votes[v].username}<b>{$votes[v].username}</b>{else}{$votes[v].email}{/if}<br />
   {$votes[v].ip}<br />
   {$votes[v].fdate}
  </td>
  <td>{$votes[v].comment}</td>
</tr>
{/section}
</table>

{paginator col=$pages.col cur=$pages.cur url="?a=details&lid=`$listing.id`&p=%s"|encurl}
{/if}

<a name="vote"></a>                        
<h3>Add Vote</h3>
<form method="post" name="vote" onsubmit="return checkVote()" action="">
<input type="hidden" name="a" value="add_vote">
<input type="hidden" name="action" value="save">
<input type="hidden" name="lid" value="{$listing.id}">
<table class="form">
<tr>
  <th>Mood</th>
  <td>
   <input type="radio" name="vote" value=3> <img src="{"`$theme`images/r3.gif"|encurl}" alt="Very Good" title="Very Good"> Very Good<br>
   <input type="radio" name="vote" checked value=2> <img src="{"`$theme`images/r2.gif"|encurl}" alt="Good" title="Good"> Good<br>
   <input type="radio" name="vote" value=1> <img src="{"`$theme`images/r1.gif"|encurl}" alt="Bad" title="Bad"> Bad<br>
   <input type="radio" name="vote" value=0> <img src="{"`$theme`images/r0.gif"|encurl}" alt="Very Bad" title="Very Bad"> Very Bad<br>
  </td>
</tr>
<tr>
  <th>Comments</th>
  <td>
   <input type="text" name="comment" maxlength=255><br>
   You can write short comment (max. 255 characters)
  </td>
</tr>
{if $userinfo.logged}
<tr>
  <th>Username</th>
  <td>{$userinfo.username}</td>
</tr>
{else}
<tr>
  <th>E-Mail</th>
  <td>
   <input type="text" name="email">
   {if $settings.vote_confirmation_require}we will send you your vote confirmation code{/if}
  </td>
</tr>
{/if}
{if $settings.use_turing}
<tr>
  <th><img src="{"?a=turing&`$sesname`=`$sesid`&r=`$rand`"|encurl}" alt="turing code"></th>
  <td><input type=text name="turing" maxlength=6 size=6></td>
</tr>
{/if}
<tr>
  <th></th>
  <td><input type="submit" value="Vote" class=sbmt></td>
</tr>
</table>
</form>
</div>
{include file="footer.tpl"}