{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}

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

<h3>Add Vote</h3>
<div class="details">

{if $frm.say == 'accepted'}
<div class="ok">Thank you for your vote. Vote has been successfully accepted.</div>
{elseif $frm.say == 'confirm'}
<div class="ok">Thank you for your vote. Please check your e-mail to confirm your vote.</div>
{elseif $frm.say == 'confirmed'}
<div class="ok">Thank you for your vote. Vote has been successfully confirmed.</div>
{elseif $frm.say == 'notconfirmed'}
<div class="error">Sorry, it seams you are using broken link or your vote was already confirmed.</div>
{else}                            

{if $errors}
<ul class="error">
{if $errors.turing}<li> Invalid turing image provided.</li>{/if}
{if $errors.vote_delay}<li> You can vote once per {$settings.vote_period} hours only.</li>{/if}
{if $errors.comment}<li> Comment is too small</li>{/if}
{if $errors.email}<li> Please, enter your valid email</li>{/if}
</ul>
{/if}

<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" {if $frm.vote == 3}checked{/if} value=3> <img src="{"`$theme`images/r3.gif"|encurl}" alt="Very Good" title="Very Good"> Very Good<br>
   <input type="radio" name="vote" {if $frm.vote == 2}checked{/if} value=2> <img src="{"`$theme`images/r2.gif"|encurl}" alt="Good" title="Good"> Good<br>
   <input type="radio" name="vote" {if $frm.vote == 1}checked{/if} value=1> <img src="{"`$theme`images/r1.gif"|encurl}" alt="Bad" title="Bad"> Bad<br>
   <input type="radio" name="vote" {if $frm.vote == 0}checked{/if} 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" value="{$frm.comment|escape:htmlall}" maxlength=255><br>
   You can write short comment (max. 255 characters)
  </td>
</tr>
{if $userinfo.logged}
<tr>
  <th>User</th>
  <td>{$userinfo.username|escape:html}</td>
</tr>
{else}
<tr>
  <th>E-Mail</th>
  <td>
   <input type="text" name="email" value="{$frm.email|default:$userinfo.email|escape:htmlall}">
   {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>

{/if} {* if $say is empty *}

</div>

{include file="footer.tpl"}