{stored_object name=$smarty.session.session_id|truncate:10:"" type="newcomp" from="newcomp" assign="newcomp"}

{if $smarty.request.confirmReset}{stored_object name=$smarty.session.session_id|truncate:10:"" type="signup" destroy="true"}{/if}

{include_php file="shared_handle:newcomp.prepareInvitation"}
{include_php file="shared_handle:newcomp.review"}

<h1 class="underline">Create a Competition: Review</h1>

	{toc_prev assign="prev"}
	{if not $competitionErrors}
		{toc_next assign="next"}
	{/if}

<form name="compStartForm" method="post" style="margin:0px;">
<input type="hidden" name="pg" value="{toc_next}">
<input type="hidden" name="no_expire" value="true">

<div>
	<br />
	You are almost done! Before sending off your invitations,
	please review each item below to make sure everything is correct and then click 'Next'.
</div>

<br />

<h2 class="withBG">
	<div class="topRight hideShow">
		<a href="javascript:toggle('parameters', 'hideReviewParameters', 'showHide');"><img id="parameters_img" src="./img/blank.gif" class="showHide_{if $newcomp.hideReviewParameters}off{else}on{/if}" alt="show/hide" border="0" /></a></div>
	Your Competition Parameters:</h2>
	<input type="hidden" id="hideReviewParameters" name="newcomp[hideReviewParameters]" value="{$newcomp.hideReviewParameters|default:"0"}" />

<div id="parameters" style="margin:15px;" style="display:{if $newcomp.hideReviewParameters eq 1}none{else}block{/if};">
	<table style="margin-left:35px;">
	<tr>
		<td align="right"><div>Comptition Title:</div></td>
		<td><div><b>{$newcomp.title}</b></div></td>
	</tr>
	<tr>
		<td align="right"><div>Type:</div></td>
		<td><div><b>{$newcomp.type|niceText}, {$newcomp.style}</b></div></td>
	</tr>
	<tr>
		<td align="right"><div>Term:</div></td>
		<td><div><b>{$newcomp.startDate|date_format2:"M j, Y"}</b> to <b>{$newcomp.endDate|date_format2:"M j, Y"}</b> ({math equation="(b - a) / 86400" a=$newcomp.startDate|default:"0" b=$newcomp.endDate|default:"0" assign="numDays"}{$numDays|number_format:"0"} days)</div></td>
	</tr>
	<tr>
		<td align="right"><div>Pot:</div></td>
		<td><div><b>${$newcomp.individualPotAmount|number_format:"2"}</b> {if $newcomp.potMethod eq "Per-competitor Donations"}(each) {/if}by <b>{$newcomp.potMethod}</b></div></td>
	</tr>
	<tr>
		<td align="right"><div>Scoring:</div></td>
		<td><div>Based on <b>{$newcomp.scoringMethod}</b> or, in the event of a tie, <b>{$newcomp.tieBreakerMethod}</b></div></td>
	</tr>
	</table>
</div>

<div align="right">
	<br />
	<a class="button" href="?pg=newcomp/start">Change/Update Your Competition Parameters Now</a>
	<br /><br />
</div>

<h2 class="withBG">
	<div class="topRight hideShow">
		<a href="javascript:toggle('letter', 'hideReviewLetter', 'showHide');"><img id="letter_img" src="./img/blank.gif" class="showHide_{if $newcomp.hideReviewLetter}off{else}on{/if}" alt="show/hide" border="0" /></a></div>
	Your Invitation Letter:</h2>

<input type="hidden" id="hideReviewLetter" name="newcomp[hideReviewLetter]" value="{if $newcomp.hideReviewLetter !== "0"}1{else}0{/if}" />

<div id="letter" align="left" style="display:{if $newcomp.hideReviewLetter !== "0"}none{else}block{/if};margin:10px;padding:17px;" class="notepaperBG">
	{eval var=$invitationLetter|nl2br}
</div>

<div align="right">
	<br />
	<a class="button" href="?pg=newcomp/create-invitation">Change/Update Your Invitation Letter Now</a>
	<br /><br />
</div>

<h2 class="withBG">
	<div class="topRight hideShow">
		<a href="javascript:toggle('invitations', 'hideReviewInvitations', 'showHide');"><img id="invitations_img" src="./img/blank.gif" class="showHide_{if $newcomp.hideReviewInvitations}off{else}on{/if}" alt="show/hide" border="0" /></a></div>
	Who You're Inviting:</h2>
	<input type="hidden" id="hideReviewInvitations" name="newcomp[hideReviewInvitations]" value="{$newcomp.hideReviewInvitations|default:"0"}" />

<div id="invitations" style="margin:15px;display:{if $newcomp.hideReviewInvitations eq "1"}none{else}block{/if};">
	<table cellpadding="3" style="margin-left:35px;">
	<tr>
		<td><b>Name</b></td>
		<td><b>E-mail Address</b></td>
		<td><b>Relation</b></td>
	</tr>
	{section name="x" loop=$newcomp.invite.name}
		{if not ($newcomp.invite.name[x] or $newcomp.invite.email[x] or $newcomp.invite.relation[x])}{php}continue;{/php}{/if}
	<tr>
		<td>{$newcomp.invite.name[x]}</td>
		<td>{$newcomp.invite.email[x]}</td>
		<td>{$newcomp.invite.relation[x]}</td>
	</tr>
	{/section}
	</table>
</div>

<div align="right">
	<br />
	<a class="button" href="?pg=newcomp/send-invitation#invitations">Change/Update Your Invitations</a>
	<br /><br />
</div>

<div class="hBox" style="text-align:right;margin:0px;"">
	{if $prev.pageName}<input type="image" src="{$skinFolder}images/btn_back.gif" class="btn_image" onclick="pg.value='{$prev.pageName}';">&nbsp; {/if}
	{if $next.pageName}<input type="image" src="{$skinFolder}images/btn_next.gif" class="btn_image" onclick="pg.value='{$next.pageName}';">{/if}	
</div>

{stored_object_fill_form object=$newcomp name="newcomp"}

</form>
