﻿<?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:include href="../../../Version_2_0/PopUpHeader.xslt"/>
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:variable name="DateOfBirthMasterData" select="AjaxRequest/DateOfBirth"></xsl:variable>
		<xsl:variable name="BrandID" select="AjaxRequest/Params/BrandID"></xsl:variable>
		<xsl:variable name="ItemID" select="AjaxRequest/Params/SourceID"></xsl:variable>
		<xsl:variable name="ClubName" select="AjaxRequest/Brand/PortalItem"></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="Origin" select="normalize-space(AjaxRequest/Params/Origin)"></xsl:variable>

		<xsl:call-template name="ClubLogin">
			<xsl:with-param name="DateOfBirthMasterData" select="$DateOfBirthMasterData"></xsl:with-param>
			<xsl:with-param name="Origin" select="$Origin"></xsl:with-param>
			<xsl:with-param name="BrandID" select="$BrandID"></xsl:with-param>
			<xsl:with-param name="ClubName" select="$ClubName"></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="Mode" select="AjaxRequest/Params/Mode"></xsl:with-param>
			<xsl:with-param name="Email" select="AjaxRequest/User/UserData/Email"></xsl:with-param>
		</xsl:call-template>
	</xsl:template>

	<xsl:template name="ClubLogin">
		<xsl:param name="DateOfBirthMasterData" select="'N/A'"></xsl:param>
		<xsl:param name="Origin" select="'N/A'"></xsl:param>
		<xsl:param name="Mode" select="'N/A'"></xsl:param>
		<xsl:param name="BrandID" select="'N/A'"></xsl:param>
		<xsl:param name="ClubName" 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="IsRegistrationComplete" select="'N/A'"></xsl:param>		
		<xsl:param name="LoginRegisterMode">
			<xsl:number value="2"/>
		</xsl:param>
		<xsl:param name="Email">
			<xsl:text></xsl:text>
		</xsl:param>

		<xsl:variable name="LoginTabClass">
			<xsl:choose>
				<xsl:when test="$LoginRegisterMode = 2">
					<xsl:text>notSelectedMenuTab</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>selectedMenuTab</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="RegisterTabClass">
			<xsl:choose>
				<xsl:when test="$LoginRegisterMode = 2">
					<xsl:text>selectedMenuTab</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>notSelectedMenuTab</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="LoginTabVisiblity">
			<xsl:choose>
				<xsl:when test="$LoginRegisterMode = 2">
					<xsl:text>display:none;</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>display:block;</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="RegisterTabVisibility">
			<xsl:choose>
				<xsl:when test="$LoginRegisterMode = 2">
					<xsl:text>display:block;</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>display:none;</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>		

		<xsl:variable name="LoginTabDisplayStyle">
			<xsl:choose>
				<xsl:when test="$Mode = 'CompleteRegistrationPopup' or $IsRegistrationComplete = 0">
					<xsl:text>display:none;</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>display:table-cell;</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="EmailDisplayStyle">
			<xsl:choose>
				<xsl:when test="$Mode = 'CompleteRegistrationPopup' or $IsRegistrationComplete = 0">
					<xsl:text>display:none;</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>display:block;</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>


		<table class="tableMaster TournamentClubBackground paddingTop20" cellpadding="0" cellspacing="0">
			<xsl:if test="$Mode = 'CompleteRegistrationPopup' or $IsRegistrationComplete = 0">
				<tr>
					<td colspan="4" class="textCenter">
						<div class="labelErrorVerion_2_0 padding10">
							Complete your registration.
						</div>
					</td>
				</tr>
			</xsl:if>			
			<tr>
				<td width="10px" style="border-bottom:1px solid black;">
					&#xa0;
				</td>
				<td id="tdUserSignUP" width="18%" class="textCenter padding10 capitalFont onMouseOver {$RegisterTabClass}"
									onclick="document.getElementById('tabUserSignUp').style.display='block';
							 document.getElementById('divUserLogin').style.display='none';												 
							 chooseSelectedMenuTab('tdUserSignUP', 'tdUserLogin', 'selectedMenuTab', 'notSelectedMenuTab');
							 document.getElementById('span_PopUpHeaderTitleText').innerHTML='Join The Party Pong Club – It’s Free!';">
					<span>Sign Up</span>
				</td>
				<td id="tdUserLogin" width="18%" style="{$LoginTabDisplayStyle}" class="textCenter padding10 capitalFont onMouseOver {$LoginTabClass}"
					onclick="document.getElementById('tabUserSignUp').style.display='none';
							 document.getElementById('divUserLogin').style.display='block';
							 chooseSelectedMenuTab('tdUserLogin', 'tdUserSignUP', 'selectedMenuTab', 'notSelectedMenuTab');
							 document.getElementById('span_PopUpHeaderTitleText').innerHTML='Login to Party Pong Club';">
					<span style="color:red;font-weight:bold;">Login</span>
				</td>
				<td style="border-bottom:1px solid black;">
					&#xa0;
				</td>
			</tr>
		</table>
		<table id="tabUserSignUp" width="96%" style="background:white;{$RegisterTabVisibility}" class="marginLeft10" cellpadding="0" cellspacing="0">
			<tr>
				<td colspan="2">
					<div id="divRegistration" style="color:red;display:none;" class="discussionText marginTop10"></div>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<div class="marginTop10 marginBottom10 labelGoalTopicsText">
						Please fill out the required fields
					</div>
				</td>
			</tr>
			<tr>
				<td width="50%">
					<div class="labelGoalActionsText">
						First Name*:
					</div>
					<div class="marginBottom15">
						<input id="txtFName"  type="text" style="width:85%;" tabindex="1" maxlength="50"></input>
					</div>
					<div class="labelGoalActionsText" style="{$EmailDisplayStyle}">
						<span style="color:red;">Valid</span>&#xa0;Email Address*:
					</div>
					<div class="labelGoalActionsText marginBottom15" style="{$EmailDisplayStyle}">
						<input id="txtEmail"  type="text" style="width:85%;" tabindex="3" maxlength="50" value="{$Email}"></input>
					</div>
					<!--<div class="labelGoalActionsText">
						I Am*:
					</div>
					<div class="marginBottom15">
						<input id="rdbMale" type="radio"  name="sex" value="male" tabindex="5"/>
						<span>Male</span>
						<input id="rdbFemale" type="radio" class="marginLeft20" name="sex" value="female" tabindex="6"/>
						<span>Female</span>
					</div>-->
					<div class="labelGoalActionsText">
						Zip Code*:
					</div>
					<div class="marginBottom15">
						<input id="txtZipCode" type="text" style="width:85%;" tabindex="5" maxlength="50"></input>
					</div>
					<div class="labelGoalActionsText">
						Password*:
					</div>
					<div class="marginBottom15">
						<input id="txtPassword" type="password" style="width:85%;" tabindex="9" maxlength="50"></input>
					</div>
				</td>
				<td>
					<div class="labelGoalActionsText">
						Last Name*:
					</div>
					<div class="marginBottom15">
						<input id="txtLName" type="text" style="width:85%;" tabindex="2" maxlength="50"></input>
					</div>
					<div class="labelGoalActionsText" style="{$EmailDisplayStyle}">
						Confirm&#xa0;<span style="color:red;">Valid</span>&#xa0;Email Address*:
					</div>
					<div class="marginBottom15" style="{$EmailDisplayStyle}">
						<input id="txtCEmail" type="text" style="width:85%;" tabindex="4" maxlength="50" value="{$Email}"></input>
					</div>
					<div class="labelGoalActionsText">
						Birthday*:
					</div>
					<div class="marginBottom20">
						<xsl:call-template name="BirthdayDropDown">
							<xsl:with-param name="DateOfBirthMasterData" select="$DateOfBirthMasterData"></xsl:with-param>
						</xsl:call-template>
					</div>
					<div class="labelGoalActionsText">
						Confirm Password*:
					</div>
					<div class="marginBottom15">
						<input id="txtCPassword" type="password" style="width:85%;" tabindex="10" maxlength="50"></input>
					</div>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<div class="marginBottom5" style="height:30px;">
						<div style="float:left;">
							<input id="chkAgree" type="checkbox" class="verticallyMiddle" tabindex="11"></input>
						</div>
						<div class="verticallyMiddle marginLeft5 textJustify" style="float:left;width:85%;;">
							By checking this box, I hereby agree to the
							<a href="http://www.partypongclub.com/TermsAndConditions" target="_blank">terms and conditions</a>
							set forth by The <xsl:value-of select="$ClubName"></xsl:value-of> Membership Program
						</div>
					</div>
					<center>
						<div class="TournamentButtonGray marginBottom10 marginTop10 onMouseOver"
							 style="width:150px;line-height:30px;" onclick="register_SaveUser_tournament('txtFName', 
												 'txtLName', 'txtEmail', 'txtCEmail', 'txtPassword', 'txtCPassword', 'ddlMonth',
												 'ddlDay', 'ddlYear', 'txtOrigin', 'SaveNewUserVersion2',
												 'txtFacebookUserID', 'txtFBPicURL', 'txtFBEmailId','chkAgree','txtZipCode');" tabindex="12">
							<span>Submit</span>

							<xsl:choose>
								<xsl:when test="$Mode= 'CompleteRegistrationPopup' or $IsRegistrationComplete = 0">
									<input id="txtOrigin" type="text" sourceID="{$BrandID}" mode="{$Mode}" style="display:none;"></input>
								</xsl:when>
								<xsl:otherwise>
									<input id="txtOrigin" type="text" sourceID="{$BrandID}" mode="{$Origin}" style="display:none;"></input>
								</xsl:otherwise>
							</xsl:choose>

							<input id="txtFacebookUserID" type="text" style="display:none;"/>
							<input id="txtFBEmailId" type="text" style="display:none;"/>
							<input id="txtFBPicURL" type="text" style="display:none;"/>
						</div>
					</center>
				</td>
			</tr>
		</table>
		<div id="divUserLogin" style="{$LoginTabVisiblity};margin-top:35px;" align="center">

			<input type="hidden" id="loginPopup_Version_2_0_Mode" value="{$Origin}"></input>
			<input type="hidden" id="loginPopup_Version_2_0_SourceID" value="{$BrandID}"></input>

			<iframe id="frmFaceBookConnect" style="display: block; width: 80%; height: 330px;"
				src="http://{$HostName}/LoginPopup.aspx?ID={$BrandID}" scrolling="no" marginwidth="0" marginheight="0" frameborder="0">
			</iframe>
		</div>

	</xsl:template>
	<xsl:template name="BirthdayDropDown">
		<xsl:param name="DateOfBirthMasterData" select="'N/A'"></xsl:param>
		<xsl:param name="Day" select="'N/A'"></xsl:param>
		<xsl:param name="Month" select="'N/A'"></xsl:param>
		<xsl:param name="Year" select="'N/A'"></xsl:param>

		<select id="ddlMonth" class="textCenter" style="width:70px;" tabindex="6" onchange="checkClubMemberAge('ddlDay', 'ddlMonth','ddlYear');">
			<option value="month">Month</option>

			<xsl:for-each select="$DateOfBirthMasterData/Months/Month">
				<xsl:choose>
					<xsl:when test="ID = $Month">
						<option value="{ID}" selected="selected">
							<xsl:value-of select="Name"/>
						</option>
					</xsl:when>
					<xsl:otherwise>
						<option value="{ID}">
							<xsl:value-of select="Name"/>
						</option>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
		</select>

		<select id="ddlDay" class="textCenter" style="width:70px;" tabindex="7" onchange="checkClubMemberAge('ddlDay', 'ddlMonth','ddlYear');">
			<option value="day">Day</option>
			<xsl:for-each select="$DateOfBirthMasterData/Days/Day">
				<xsl:choose>
					<xsl:when test=". = $Day">
						<option value="{.}" selected="selected">
							<xsl:value-of select="."/>
						</option>
					</xsl:when>
					<xsl:otherwise>
						<option value="{.}">
							<xsl:value-of select="."/>
						</option>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
		</select>

		<select id="ddlYear" class="textCenter" style="width:70px;" tabindex="8" onchange="checkClubMemberAge('ddlDay', 'ddlMonth','ddlYear');">
			<option value="year">Year</option>
			<xsl:for-each select="$DateOfBirthMasterData/Years/Year">
				<xsl:choose>
					<xsl:when test=". = $Year">
						<option value="{.}" selected="selected">
							<xsl:value-of select="."/>
						</option>
					</xsl:when>
					<xsl:otherwise>
						<option value="{.}">
							<xsl:value-of select="."/>
						</option>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
		</select>
	</xsl:template>
</xsl:stylesheet>
