{*
  Template for the matchs detailview
  $Id: show_matchs.tpl,v 1.00 2006/10/25 20:14:18
*}

<script language="JavaScript" type="text/javascript" src="javascript/look.js"></script>

  
<div id="pagecontent">
<!-- content begin -->

	<table width="90%" border="0" cellspacing="0" cellpadding="5">
	<form action="show_matchs.php" id="edi" name="edi" method="get">
	<input type="hidden" name="competition" id="compet" value="{$competition.id}" />
		  <tr>
			<td class="title-classement" width="20%" nowrap>{$dateday}</td>
			<td class="title-classement" colspan="6" align="right">
				<select class="title-classement" name="season" onchange="submit();">
					<option value="0">---{$lang.season}---</option>
					{foreach item=myseason from=$seasonselect}
					{assign var="nextyear" value="`$myseason.season+1`"}
					{if $competition.oneyear}
						<option value="{$myseason.id_season}" {if $myseason.id_season == $season}Selected{/if}>{$lang.season} {$myseason.season}</option>
					{else}
						{if $competition.range == 3}
							<option value="{$myseason.id_season}" {if $myseason.id_season == $season}Selected{/if}>{$lang.season} {$myseason.season}</option>
						{else}
							<option value="{$myseason.id_season}" {if $myseason.id_season == $season}Selected{/if}>{$lang.season} {$myseason.season} / {$nextyear}</option>
						{/if}
					{/if}
					{/foreach}
				</select>
				<select class="title-classement" name="day" onchange="submit();">
				{if $numdays is odd}
				{math equation="$numdays/2" assign=startnumday}
				{counter start=$startnumday direction=down print=false name=arcount assign=arcount}
				{else}
				{math equation="($numdays+1)/2" assign=startnumday}
				{counter start=$startnumday direction=down print=false name=arcount assign=arcount}
				{/if}
				{counter start=0 print=false name=daycount}
				
				{section name="loopday" start=0 loop=$numdays}
				{counter assign=counterday name=counterday}
				{if $competition.type == 1}
					{if $counterday == $numdays and $competition.ar == 0}		
						<option value="{$counterday}"{if $counterday == $day} selected{/if}>{$lang.final_game}</option>
					{elseif $arcount == 0 and $numdays is odd}
						<option value="{$counterday}"{if $counterday == $day} selected{/if}>{$lang.final_game}</option>
					{elseif $arcount == 0 and $numdays is even}
						{if $counterday is odd}
						<option value="{$counterday}"{if $counterday == $day} selected{/if}>{$lang.final_game} {$lang.firstleg}</option>
						{else}
						<option value="{$counterday}"{if $counterday == $day} selected{/if}>{$lang.final_game} {$lang.secondleg}</option>
						{/if}
					{else}
						{if !$competition.ar}
						<option value="{$counterday}"{if $counterday == $day} selected{/if}>1/{math equation="pow(2, ($numdays-$counterday+1))/2"} {$lang.final_game}</option>
						{else}
						
							{if $counterday is odd}
							<option value="{$counterday}"{if $counterday == $day} selected{/if}>1/{math equation="pow(2, ($numdays-$counterday-$arcount+1))/2"} {$lang.final_game} {$lang.firstleg}</option>
							{else}
							<option value="{$counterday}"{if $counterday == $day} selected{/if}>1/{math equation="pow(2, ($numdays-$counterday-$arcount+2))/2"} {$lang.final_game} {$lang.secondleg}</option>
							{counter name=arcount direction=down}
							
							{/if}
						{/if}
					{/if}
				{else}
				<option value="{$counterday}"{if $counterday == $day} selected{/if}>{$lang.matchday} {$counterday}</option>
				{/if}
				{/section}		
				</select>
			</td>
		  </tr>
</form>
		  <tr id="barre-classement">
			<td><b>{$lang.matchdate}</b></td>
			<td align="right"><b>{$lang.dom}</b></td>
			<td colspan="3" align="center"><b>{$lang.score}</b></td>
			<td align="left"><b>{$lang.ext}</b></td>
			<td align="center"><b>{$lang.spectators}</b></td>
		  </tr>
	  
	  {counter start=0 print=false name=matchcount}
	  {foreach item=match from=$matchs}
	  {assign var="numgoals" value="`$numgoals+$match.buts_dom+$match.buts_ext`"}
	  {assign var="numspectators" value="`$numspectators+$match.spectators`"}
	  	  <tr>
			<td class="td-classement">{$match.date_day|date_format:"%d/%m/%Y"} - {$match.date_day|date_format:"%HH%M"}</td>
			<td{if $match.buts_dom > $match.buts_ext} class="td-classement-winner"{else} class="td-classement"{/if} align="right">{$match.domclubname}</td>
			<td class="td-classement" align="center">{$match.buts_dom}</td>
			<td class="td-classement" align="center">
			{if $showstats}<a title="{$lang.bmatch}" href="show_stats.php?id={$match.id}"><img alt="{$lang.bmatch}" src="images/confrontation.gif" width="12" height="12" border="0"></a>{/if}
			{if $showmatch}<a title="{$lang.matchreport}" href="show_match.php?id={$match.id}"><img alt="{$lang.matchreport}" src="images/match.gif" width="12" height="12" border="0"></a>{/if}
			</td>
			<td class="td-classement" align="center">{$match.buts_ext}</td>
			<td{if $match.buts_ext > $match.buts_dom} class="td-classement-winner"{else} class="td-classement"{/if} align="left">{$match.extclubname}</td>
			<td class="td-classement" align="right">{if $match.spectators}{$match.spectators}{else}---{/if}</td>
		  </tr>
	  {counter assign=count name=matchcount}		
	  {/foreach}
	  
	  <tr id="barre-classement">
		<td colspan="7">{if $numgoals}<b>{$lang.numgoals} :</b> {$numgoals} {/if}{if $numspectators}<b>{$lang.numspectators} :</b> {$numspectators}{/if}</td>	
	  </tr>
	</table>
</div>
<!-- /content -->
