﻿<?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 match="/">
		<xsl:variable name="BrandID" select="normalize-space(AjaxRequest/Params/BrandID)"></xsl:variable>
		<xsl:variable name="Origin" select="normalize-space(AjaxRequest/Params/Origin)"></xsl:variable>
		<xsl:variable name="TemplateURL" select="normalize-space(AjaxRequest/TemplateURL)"></xsl:variable>
		<xsl:variable name="HostName" select="normalize-space(AjaxRequest/HostName)"></xsl:variable>
		<xsl:variable name="TournamentItemID" select="-99"></xsl:variable>

		<div class="margin15">
			<xsl:call-template name="BrandAddUser">
				<xsl:with-param name="BrandID" select="$BrandID"></xsl:with-param>
				<xsl:with-param name="Origin" select="$Origin"></xsl:with-param>
				<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
				<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
				<xsl:with-param name="TournamentItemID" select="$TournamentItemID"></xsl:with-param>
			</xsl:call-template>
		</div>

	</xsl:template>

	<xsl:template name="BrandAddUser">
		<xsl:param name="BrandID" select="'N/A'"></xsl:param>
		<xsl:param name="TournamentItemID" select="'N/A'"></xsl:param>
		<xsl:param name="Origin" select="'N/A'"></xsl:param>
		<xsl:param name="HostName" select="'N/A'"></xsl:param>
		<xsl:param name="TemplateURL" select="'N/A'"></xsl:param>
		<xsl:param name="EmailID" select="'N/A'"></xsl:param>
		<xsl:param name="UserName" select="'N/A'"></xsl:param>
        <xsl:param name="ReplacingDivID" select="'N/A'"></xsl:param>

		<xsl:variable name="tableWidth">
			<xsl:choose>
				<xsl:when test="$Origin = 'brandpromoter'">
					<xsl:text>60%</xsl:text>
				</xsl:when>
				<xsl:when test="$Origin = 'lspromoter'">
					<xsl:text>60%</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>100%</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
        <xsl:variable name="ReplacingDiv">
            <xsl:choose>
                <xsl:when test="$ReplacingDivID != ''">
                    <xsl:value-of select="$ReplacingDivID"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>divTournamentPlayerDetail</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        

		<table width="{$tableWidth}" class="findPlayerAreaFill padding10">
			<tr>
				<td style="width:43%;" class="textCenter">
					<input style="width:90%;" id="txtFirstName_AddUser" type="text" class="tounamentTextBox tournamentTextLarge" value="first name" maxlength="50"
					   onblur="SetTextAreaValue('txtFirstName_AddUser', 'first name', 'blur');if(this.value=='first name')this.style.color='#6D6E71';"
					   onkeyup="this.style.color='black';" onfocus="SetTextAreaValue('txtFirstName_AddUser', 'first name', 'focus');"></input>
				</td>
				<td style="width:43%;" class="textCenter">
					<input style="width:90%;" id="txtLastName_AddUser" type="text" class="tounamentTextBox tournamentTextLarge" value="last name" maxlength="50"
					   onblur="SetTextAreaValue('txtLastName_AddUser', 'last name', 'blur');if(this.value=='last name')this.style.color='#6D6E71';" onkeyup="this.style.color='black';"
					   onfocus="SetTextAreaValue('txtLastName_AddUser', 'last name', 'focus');"></input>
				</td>            
				<td rowspan="2" class="textLeft verticallyMiddle" style="width:20%;">
					<span style="line-height:70px;width:70px;height:70px;display:block;" id="divAddUser" class="greenButton onMouseOver"
						 onclick="tournament_RegisterPlayer('{$TournamentItemID}', '{$BrandID}', 'txtFirstName_AddUser', 'txtLastName_AddUser', 
                                                                'txtUserEmail_AddUser', 'txtUserZipCode_AddUser', 'txtPassword_AddUser', '{$Origin}', '{$ReplacingDiv}');">
						Add
					</span>
				</td>
			</tr>
            <tr>
                <td colspan="2" style="width:86%;" class="textCenter">
                    <input style="width:95%;" id="txtPassword_AddUser" type="text" class="tounamentTextBox tournamentTextLarge"
                           value="password"
                           maxlength="50"
                           onblur="SetTextAreaValue('txtPassword_AddUser', 'password', 'blur');if(this.value=='password')this.style.color='#6D6E71';
                                   "
                           onkeyup="this.style.color='black';"
                           onfocus="SetTextAreaValue('txtPassword_AddUser', 'password', 'focus');
                                    this.type='password';"></input>
                </td>
            </tr>
			<tr>
				<td colspan="2" style="width:86%;" class="textCenter">
					<input id="txtUserEmail_hidden" type="hidden" value="{$EmailID}"></input>
					<xsl:choose>
						<xsl:when test="$EmailID = '' or $EmailID = 'N/A'">
							<input style="width:95%;" id="txtUserEmail_AddUser" type="text" class="tounamentTextBox tournamentTextLarge" value="e-mail"
							  onblur="SetTextAreaValue('txtUserEmail_AddUser', 'e-mail', 'blur');if(this.value=='e-mail')this.style.color='#6D6E71';"
							  onkeyup="this.style.color='black';" onfocus="SetTextAreaValue('txtUserEmail_AddUser', 'e-mail', 'focus');"></input>
						</xsl:when>
						<xsl:when test="$Origin = 'tournament' and ($EmailID = '' or $EmailID = 'N/A')">
							<input style="width:95%;" id="txtUserEmail_AddUser" type="text" class="tounamentTextBox tournamentTextLarge" value="e-mail"
							   onblur="SetTextAreaValue('txtUserEmail_AddUser', 'e-mail', 'blur');checkForSimilarEmail('txtUserEmail_AddUser','txtUserEmail_hidden');if(this.value=='e-mail')this.style.color='#6D6E71';"
							   onkeyup="this.style.color='black';" onfocus="SetTextAreaValue('txtUserEmail_AddUser', 'e-mail', 'focus');"></input>
						</xsl:when>
						<xsl:otherwise>
							<input style="width:95%;color:black;" id="txtUserEmail_AddUser" readonly="readonly" type="text" class="tounamentTextBox tournamentTextLarge"
							  value="{$EmailID}" onblur="SetTextAreaValue('txtUserEmail_AddUser', 'e-mail', 'blur');if(this.value=='e-mail')this.style.color='#6D6E71';"
							  onkeyup="this.style.color='black';" onfocus="SetTextAreaValue('txtUserEmail_AddUser', 'e-mail', 'focus');"></input>
						</xsl:otherwise>
					</xsl:choose>
				</td>
				<td style="width:14%;">&#xa0;</td>
			</tr>
			<tr>
				<td style="width:43%;" class="textCenter">
					<xsl:choose>
						<xsl:when test="$Origin = 'tournament'">
							<input style="width:90%;color:black;" id="txtLoggedInUserName_AddUser" type="text" 
                                   class="tounamentTextBox tournamentTextLarge" value="{$UserName}"
								   readonly="readonly"></input>
						</xsl:when>
						<xsl:otherwise>
							<!--<input style="width:90%;" id="txtUserZipCode_AddUser" type="text" 
                                   class="tounamentTextBox tournamentTextLarge" value="zip code" maxlength="50"
							  onblur="SetTextAreaValue('txtUserZipCode_AddUser', 'zip code', 'blur');if(this.value=='zip code')this.style.color='#6D6E71';"
							  onkeyup="this.style.color='black';" onfocus="SetTextAreaValue('txtUserZipCode_AddUser', 'zip code', 'focus');"></input>-->
						</xsl:otherwise>
					</xsl:choose>
				</td>
				<td style="width:43%;">&#xa0;</td>
			</tr>
		</table>
	</xsl:template>
</xsl:stylesheet>
