﻿<?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:import href ="AddTournament.xslt"/>
	<xsl:import href ="TournamentSetUp.xslt"/>
	<xsl:import href ="TournamentShare.xslt"/>
	<xsl:import href ="TournamentFinish.xslt"/>

	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:variable name="ItemID" select="normalize-space(AjaxRequest/Params/ItemID)"></xsl:variable>
		<xsl:variable name="HostName" select="normalize-space(AjaxRequest/HostName)"></xsl:variable>
		<xsl:variable name="templateURL" select ="normalize-space(AjaxRequest/TemplateURL)"></xsl:variable>
		<xsl:variable name="GoalStep" select="normalize-space(AjaxRequest/Params/GoalStep)"></xsl:variable>
		<xsl:variable name="TournamentItemID" select="normalize-space(AjaxRequest/Params/TournamentItemID)"></xsl:variable>
		<xsl:variable name="TournamentName" select="normalize-space(AjaxRequest/Params/TournamentName)"></xsl:variable>
		<xsl:variable name="HostID" select="normalize-space(AjaxRequest/Params/HostID)"></xsl:variable>
		<xsl:variable name="PortalName" select="normalize-space(AjaxRequest/Brand/Detail/BrandKey)"></xsl:variable>		

		<table class="tableMaster" cellpadding="0" cellspacing="0">

			<xsl:call-template name ="Header">
				<xsl:with-param name="templateURL" select="$templateURL"></xsl:with-param>
				<xsl:with-param name="HeaderText">
					<xsl:choose>
						<xsl:when test="$GoalStep='Start'">
							<xsl:text>Add A Tournament</xsl:text>
						</xsl:when>
						<xsl:when test="$GoalStep='SetUp'">
							<xsl:text>Setup Your Tournament Details</xsl:text>
						</xsl:when>
						<xsl:when test="$GoalStep='Share'">
							<xsl:text>Share</xsl:text>
						</xsl:when>
						<xsl:when test="$GoalStep='Finish'">
							<xsl:text>All Set</xsl:text>
						</xsl:when>
					</xsl:choose>
				</xsl:with-param>
			</xsl:call-template>

			<xsl:choose>
				<xsl:when test ="$GoalStep='Start'">			
					<xsl:call-template name="StartTournamentPopUp">
						<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
						<xsl:with-param name ="ItemID" select="$ItemID"></xsl:with-param>
						<xsl:with-param name="templateURL" select="$templateURL"></xsl:with-param>
					</xsl:call-template>
				</xsl:when>
				<xsl:when test ="$GoalStep='SetUp'">				
					<xsl:call-template name="TournamentSetUpPopUp">
						<xsl:with-param name ="ItemID" select="$ItemID"></xsl:with-param>
						<xsl:with-param name="templateURL" select="$templateURL"></xsl:with-param>
						<xsl:with-param name="TournamentItemID" select="$TournamentItemID"></xsl:with-param>
						<xsl:with-param name="TournamentName" select="$TournamentName"></xsl:with-param>
						<xsl:with-param name="HostID" select="$HostID"></xsl:with-param>
					</xsl:call-template>
				</xsl:when>
				<xsl:when test ="$GoalStep='Share'">				
					<xsl:call-template name="TournamentSharePopUp">
						<xsl:with-param name ="ItemID" select="$ItemID"></xsl:with-param>
						<xsl:with-param name ="templateURL" select="$templateURL"></xsl:with-param>
						<xsl:with-param name="TournamentItemID" select="$TournamentItemID"></xsl:with-param>
						<xsl:with-param name="TournamentName" select="$TournamentName"></xsl:with-param>
						<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
						<xsl:with-param name="HostID" select="$HostID"></xsl:with-param>
						<xsl:with-param name="PortalName" select="$PortalName"></xsl:with-param>
					</xsl:call-template>
				</xsl:when>
				<xsl:when test="$GoalStep='Finish'">					
					<xsl:call-template name ="TournamentFinishPopUp">
						<xsl:with-param name ="ItemID" select="$ItemID"></xsl:with-param>
						<xsl:with-param name ="templateURL" select="$templateURL"></xsl:with-param>
						<xsl:with-param name="TournamentItemID" select="$TournamentItemID"></xsl:with-param>
						<xsl:with-param name="HostID" select="$HostID"></xsl:with-param>
						<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
						<xsl:with-param name="PortalName" select="$PortalName"></xsl:with-param>
					</xsl:call-template>
				</xsl:when>
			</xsl:choose>

		</table>
	</xsl:template>

	<xsl:template name="Header">
		<xsl:param name="templateURL" select="'N/A'"></xsl:param>
		<xsl:param name="HeaderText" select="'N/A'"></xsl:param>

		<tr>
			<td class="startGoalHeader1">
				<span class="popUpHeadLineTitle marginLeft25">
					<xsl:value-of select="$HeaderText"/>
				</span>
			</td>
			<td class="startGoalHeader1 onMouseOver verticallyTop textRight">
				<img align="right" onmouseout="this.src='{$templateURL}Web/Images/Ver_2_0/BT_closePopup.png'"
					 onmouseover="this.src='{$templateURL}Web/Images/Ver_2_0/BT_closePopup_hover.png'"
					 onclick="closePopupWhiteLayerContainer();"
					 src="{$templateURL}Web/Images/Ver_2_0/BT_closePopup.png" style="margin-top:-5px;margin-right:-8px;"/>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="startGoalHeader2">
			</td>
		</tr>

	</xsl:template>

</xsl:stylesheet>
