{assign var="pgLayout" value="file:layouts/blank.tpl"}
{include_php file="shared_handle:competition/winners"}
<h2>{$competition.current_prize.title|default:"Winners"}</h2>
<br />

{if $competition.current_prize and $competition.current_parameter}

	{if $smarty.request.debug and $acm->isDomainAdmin()}
	{display var=$competition}
	{/if}


	{* Scoring Method *}
	<b>{$competition.current_parameter.name|capitalize}</b> ({$competition.current_parameter.units}) - {$competition.current_parameter.basedOn|capitalize}{* - {$competition.current_parameter.polarity|capitalize} *}

	<br />
	<small>
	For the {if $competition.current_prize.frequency eq "once"}period{elseif $competition.current_prize.frequency eq "weekly"}week{elseif $competition.current_prize.frequency eq "monthly"}month{/if}
	of {$competition.startDate|date_format2:"m/d/Y"} to {$competition.endDate|date_format2:"m/d/Y"}
	</small>

	<br /><br />
	<table width="270" style="width:270px;"><tr><td>
	<table cellpadding="0" cellspacing="0">
	<tr>
		<td class="thinCell">#</td>
		<td class="thinCell" align="center">Name</td>
		<td class="thinCell"><img src="{$skinFolder}images/trophy_ico.gif" width="15" height="15" alt="{$smarty.capture.scoringMethod|strip_tags}" /></td>
		<td class="thinCell">Update</td>
	</tr>
	{foreach from=$competition.data item="userData" key="userId" name="compData"}
		{assign var="curIteration" value=$smarty.foreach.compData.iteration}
		{if $competition.current_prize.maxWinners gt 0 and $curIteration eq $competition.current_prize.maxWinners|math:"x+1"}
			</table>
			</div>
			<br />
			<h2 class="withBG">
				<div class="topRight hideShow">
					<a href="javascript:toggle('runnerUps', '', 'showHide');"><img id="runnerUps_img" src="./img/blank.gif" class="showHide_off" alt="show/hide" border="0" /></a>
				</div>
				Runner Ups
			</h2>
			<div id="runnerUps" style="display:none;">
			<table cellpadding="0" cellspacing="0">
		{/if}
		<tr>
			<td class="thinCell"><small>{$curIteration}</small></td>
			<td class="thinCell"><small class="mini">{$competition.users[$userId]}</small></td>
			<td class="thinCell"><small>{$userData.val|number_format:$competition.current_parameter.decimalPlaces}</small></td>
			<td class="thinCell"><small>{if $userData.doe}{$userData.doe|date_format2:"n/j/y"}{else}-Never-{/if}</small></td>
		</tr>
	{/foreach}
	</table>
	</div> 
	<div align="right"><small><i><a href="?pg=faq#comp">How is the competition scored?</a></i></small></div>
	</td></tr></table>

{/if}