{assign var="pgLayout" value="file:./layouts/lite.tpl"}
{include_php file="shared_handle:company/survey"}

<h2 class="withBG">{$survey.surveyName|default:"Unnamed Survey"}</h2>
<div style="margin-left:20px;"><small>
	May be taken: <i>{$survey.frequency}</i><br />
	Logged in as: <i>{$user->firstName} {$user->lastName} ({$user->username})</i><br />	
</small></div>

<form name="surveyForm" action="index.php" method="post">
<input type="hidden" name="pg" value="{$page.name}" />
<input type="hidden" name="no_expire" value="true" />
<input type="hidden" name="id" value="{$smarty.request.id}" />

{if !$survey.takenId AND $survey.instructions}<blockquote><small>{$survey.instructions}</small></blockquote>{/if}

<ol id="surveyQuestionList">
	{foreach name="questions" from=$survey.questions item="question"}
	<li>{$question.question}{assign var="qid" value=$question.id}
	<dl>{assign var="i" value=$smarty.foreach.questions.iteration}
		{if $question.A != ""}<dt><input id="q{$i}A" type="radio" name="q[{$qid}]" value="A" {if $smarty.post.q.$qid eq "A"}checked="checked" {/if}/> <a href="javascript://" onclick="document.getElementById('q{$i}A').checked = true;">{$question.A}</a></dt>{/if}
		{if $question.B != ""}<dt><input id="q{$i}B" type="radio" name="q[{$qid}]" value="B" {if $smarty.post.q.$qid eq "B"}checked="checked" {/if}/> <a href="javascript://" onclick="document.getElementById('q{$i}B').checked = true;">{$question.B}</a></dt>{/if}
		{if $question.C != ""}<dt><input id="q{$i}C" type="radio" name="q[{$qid}]" value="C" {if $smarty.post.q.$qid eq "C"}checked="checked" {/if}/> <a href="javascript://" onclick="document.getElementById('q{$i}C').checked = true;">{$question.C}</a></dt>{/if}
		{if $question.D != ""}<dt><input id="q{$i}D" type="radio" name="q[{$qid}]" value="D" {if $smarty.post.q.$qid eq "D"}checked="checked" {/if}/> <a href="javascript://" onclick="document.getElementById('q{$i}D').checked = true;">{$question.D}</a></dt>{/if}
		{if $question.E != ""}<dt><input id="q{$i}E" type="radio" name="q[{$qid}]" value="E" {if $smarty.post.q.$qid eq "E"}checked="checked" {/if}/> <a href="javascript://" onclick="document.getElementById('q{$i}E').checked = true;">{$question.E}</a></dt>{/if}
	</dl></li>
	{/foreach}
</ol>

<div class="underline"></div>
<div style="text-align:center;margin-top:10px;">{if !$survey.takenId AND $survey.dateAvailable eq "now"}<input type="submit" name="surveyAction" value="Submit Responses" />{else}{if $survey.takenId}<input type="button" onclick="location.replace('index.php?pg=surveyReview&takenId={$survey.takenId}')" value="Review Responses &amp; Feedback" />{/if}<input type="button" onclick="location.replace('index.php?pg=surveyHistory');" value="{if $survey.frequency eq "Once"}No Longer Available (One time survey){elseif $survey.dateAvailable}Not available again until {$survey.dateAvailable|date_format2:"m/d/y"}{/if}" />{/if}</div>
</form>
