{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>{t}Add Vote{/t}</h3>
<div class="details">

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

{if $errors}
<ul class="error">
{if $errors.turing}<li> {t}Invalid turing image provided{/t}</li>{/if}
{if $errors.vote_delay}<li> {t vote_period=$settings.vote_period}You can vote once per %vote_period hours only{/t}</li>{/if}
{if $errors.comment}<li> {t}Comment is too small{/t}</li>{/if}
{if $errors.email}<li> {t}Please, enter a valid E-mail address{/t}</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>{t}Mood:{/t}</th>
  <td>
   <input type="radio" name="vote" {if $frm.vote == 3}checked{/if} value=3> <img src="{"`$theme`images/r3.gif"|encurl}" alt="{t}Very Good{/t}" title="{t}Very Good{/t}"> {t}Very Good{/t}<br>
   <input type="radio" name="vote" {if $frm.vote == 2}checked{/if} value=2> <img src="{"`$theme`images/r2.gif"|encurl}" alt="{t}Good{/t}" title="{t}Good{/t}"> {t}Good{/t}<br>
   <input type="radio" name="vote" {if $frm.vote == 1}checked{/if} value=1> <img src="{"`$theme`images/r1.gif"|encurl}" alt="{t}Bad{/t}" title="{t}Bad{/t}"> {t}Bad{/t}<br>
   <input type="radio" name="vote" {if $frm.vote == 0}checked{/if} value=0> <img src="{"`$theme`images/r0.gif"|encurl}" alt="{t}Very Bad{/t}" title="{t}Very Bad{/t}"> {t}Very Bad{/t}<br>
  </td>
</tr>
<tr>
  <th>{t}Comments:{/t}</th>
  <td>
   <input type="text" name="comment" value="{$frm.comment|escape:htmlall}" maxlength=255><br>
   {t}You can write short comment (max. 255 characters){/t}
  </td>
</tr>
{if $userinfo.logged}
<tr>
  <th>{t}Username:{/t}</th>
  <td>{$userinfo.username|escape:html}</td>
</tr>
{else}
<tr>
  <th>{t}E-mail:{/t}</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="{t}Vote{/t}" class=sbmt></td>
</tr>
</table>
</form>

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

</div>

{include file="footer.tpl"}