﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">

	<xsl:output method="xml" indent="yes"/>

	<xsl:template name="ListOfTournaments">

		<xsl:param name="ItemID" select="'N/A'"></xsl:param>
		<xsl:param name="templateURL" select="'N/A'"></xsl:param>
		<xsl:param name="HostName" select="'N/A'"></xsl:param>
		<xsl:param name="Authenticated" select="'N/A'"></xsl:param>

		<table id="divActiveHostList" style="margin-top:15px;" class="tableMaster" cellpadding="4" cellspacing="0">
			<tr>
				<td>
					<div class="padding5 onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:140px;"
						 onmouseover="document.getElementById('img_Save1').src='{$templateURL}Web/Images/Ver_2_0/icon_add_over.png';"
						 onmouseout="document.getElementById('img_Save1').src='{$templateURL}Web/Images/Ver_2_0/icon_Add.png';"
						 onclick="DisplayAddTournament('{$ItemID}', 'Start', 'div_Planner_AddTournament');">
						<img id="img_Save1" class="marginRight5" align="absmiddle"
							 src="{$templateURL}Web/Images/Ver_2_0/icon_Add.png" style="padding-left:5px;"></img>
						<span class="capitalFont">Add Tournament</span>
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<xsl:text></xsl:text>
				</td>
			</tr>
			<xsl:if test="count(AjaxRequest/Tournaments/Tournament/TournamentID) = 0">
				<tr>
					<td>
						There are no Tournaments
					</td>
				</tr>
			</xsl:if>
			<xsl:if test="count(AjaxRequest/Tournaments/Tournament/TournamentID) &gt; 0">

				<tr class="labelGoalTopicsText">
					<td width="25%">
						Host Name
					</td>
					<td width="33%">
						Tournament Name
					</td>
					<td width="24%">
						Tournament Date
					</td>
					<td width="18%">
						Admin
					</td>
				</tr>
				<tr>
					<td colspan="4">
						<div id="div_resize_TournamentList">
							<table id="TournamentContent" class="tableMaster" cellpadding="4" cellspacing="0" style="table-layout:fixed;">
								<xsl:for-each select="AjaxRequest/Tournaments/Tournament">

									<xsl:variable name="rowBackground">
										<xsl:choose>
											<xsl:when test="position() mod 2">
												<xsl:text>background:transparent;</xsl:text>
											</xsl:when>
											<xsl:otherwise>
												<xsl:text>background:#D8D8D8;</xsl:text>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:variable>

									<tr style="{$rowBackground}">
										<td width="25%" style="word-wrap:break-word">
											<a href="http://{$HostName}/{brandkey}" target="_blank" class="decorationNone">
												<span class="templateMemoText">
													<xsl:value-of select="brandkey"/>
												</span>
											</a>
										</td>
										<td width="33%" style="word-wrap:break-word">
											<a href="http://{$HostName}/TournamentAdmin/{TournamentItemID}" target="_blank" class="decorationNone">
												<span class="templateMemoText">
													<xsl:value-of select="Name"/>
												</span>
											</a>
										</td>
										<td width="22%" class="templateMemoText">
											<xsl:value-of select="TournamentDate"/>
											<xsl:text> </xsl:text>
											<xsl:value-of select="TournamentTime"/>
										</td>
										<td width="18%">
											<select id="ddlAction_{normalize-space(TournamentItemID)}" class="smallDropdown" style="width:115px;"
												onchange="selectFromTournamentList('ddlAction_{normalize-space(TournamentItemID)}', '{TournamentItemID}', '{$ItemID}', '2');">
												<option value="-99">--Select Action--</option>
												<option value="1">Delete Tournament</option>
												<!--<option value="2">Add Tournament</option>-->
											</select>
										</td>
									</tr>
								</xsl:for-each>
							</table>
						</div>
					</td>
				</tr>
			</xsl:if>
			<tr>
				<td height="10px;">

				</td>
			</tr>
			<xsl:if test="count(AjaxRequest/Tournaments/Tournament/TournamentID) &gt; 0">
				<tr>
					<td>
						<div class="padding5 onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:140px;"
						onmouseover="document.getElementById('img_Save2').src='{$templateURL}Web/Images/Ver_2_0/icon_add_over.png';"
						onmouseout="document.getElementById('img_Save2').src='{$templateURL}Web/Images/Ver_2_0/icon_Add.png';"
						onclick="DisplayAddTournament('{$ItemID}', 'Start', 'div_Planner_AddTournament');">
							<img id="img_Save2" class="marginRight5" align="absmiddle"
								 src="{$templateURL}Web/Images/Ver_2_0/icon_Add.png" style="padding-left:5px;"></img>
							<span class="capitalFont">Add Tournament</span>
						</div>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
</xsl:stylesheet>