﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:import href="WizardButtons.xslt"/>

	<xsl:template match="/">
		<xsl:variable name="TemplatePathURL" select="normalize-space(LifeSpaces/TemplateURL)" />
		<xsl:variable name="HostName" select="normalize-space(LifeSpaces/HostName)" />
        <xsl:variable name="MasterPortalItemID" select="normalize-space(LifeSpaces/MasterPortalItemID)" />

		<div id="divCommunityWizardLayout" style="width: 100%;">
			<xsl:variable name="communityXMLInitialValue">
				&lt;CommunityWizard&gt;
				<xsl:for-each select="LifeSpaces/LifeSpace">
					<xsl:for-each select="Communities/Community">
						<xsl:if test="VolumeLevel = '3'">
							&lt;Community&gt;
							&lt;LifeSpaceID&gt;
							<xsl:value-of select="../../ItemID"/>
							&lt;/LifeSpaceID&gt;
							&lt;CommunityID&gt;
							<xsl:value-of select="ItemID"/>
							&lt;/CommunityID&gt;
							&lt;/Community&gt;
						</xsl:if>
					</xsl:for-each>
				</xsl:for-each>
				&lt;/CommunityWizard&gt;
			</xsl:variable>
			<input id="communityWizardXML" type="hidden" value="{$communityXMLInitialValue}" ></input>

			<div style="margin-top: 20px; margin-bottom: 30px;">
				<table class="tableMaster" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td align="top">
							<span class="superPageLSMessage">
								Get inspired.
							</span>
							<span class="superPageLSMessageBold">
								Get involved.
							</span>
							<div class="templateMemoText" style="margin-top:5px;">
								Simply check off the different communities you’d like to be a part of. You’ll get updated when coaches and experts
								are discussing topics related to your goals and interests.
							</div>
						</td>
					</tr>
				</table>
			</div>
			<table class="tableMaster" cellspacing="0" cellpadding="0">
				<xsl:for-each select="LifeSpaces/LifeSpace">
					<xsl:if test="position() mod 4 = 1">
						<tr>
							<td width="25%" style="padding-right:10px;">
								<xsl:call-template name="MyPlanCommunities">
									<xsl:with-param name="TemplatePathURL" select="normalize-space($TemplatePathURL)"></xsl:with-param>
									<xsl:with-param name="HostName" select="normalize-space($HostName)"></xsl:with-param>
									<xsl:with-param name="Item" select="normalize-space(Item)"></xsl:with-param>
									<xsl:with-param name="FromColorStyle" select="normalize-space(FromColorStyle)"></xsl:with-param>
									<xsl:with-param name="ColorStyle" select="normalize-space(ColorStyle)"></xsl:with-param>
									<xsl:with-param name="ItemID" select="normalize-space(ItemID)"></xsl:with-param>
									<xsl:with-param name="Communities" select="Communities/."></xsl:with-param>
								</xsl:call-template>
							</td>
							<td width="25%" style="padding-right:10px;">
								<xsl:call-template name="MyPlanCommunities">
									<xsl:with-param name="TemplatePathURL" select="normalize-space($TemplatePathURL)"></xsl:with-param>
									<xsl:with-param name="HostName" select="normalize-space($HostName)"></xsl:with-param>
									<xsl:with-param name="Item" select="normalize-space(following-sibling::LifeSpace[1]/Item)"></xsl:with-param>
									<xsl:with-param name="FromColorStyle" select="normalize-space(following-sibling::LifeSpace[1]/FromColorStyle)"></xsl:with-param>
									<xsl:with-param name="ColorStyle" select="normalize-space(following-sibling::LifeSpace[1]/ColorStyle)"></xsl:with-param>
									<xsl:with-param name="ItemID" select="normalize-space(following-sibling::LifeSpace[1]/ItemID)"></xsl:with-param>
									<xsl:with-param name="Communities" select="following-sibling::LifeSpace[1]/Communities/."></xsl:with-param>
								</xsl:call-template>
							</td>
							<td width="25%" style="padding-right:10px;">
								<xsl:call-template name="MyPlanCommunities">
									<xsl:with-param name="TemplatePathURL" select="normalize-space($TemplatePathURL)"></xsl:with-param>
									<xsl:with-param name="HostName" select="normalize-space($HostName)"></xsl:with-param>
									<xsl:with-param name="Item" select="normalize-space(following-sibling::LifeSpace[2]/Item)"></xsl:with-param>
									<xsl:with-param name="FromColorStyle" select="normalize-space(following-sibling::LifeSpace[2]/FromColorStyle)"></xsl:with-param>
									<xsl:with-param name="ColorStyle" select="normalize-space(following-sibling::LifeSpace[2]/ColorStyle)"></xsl:with-param>
									<xsl:with-param name="ItemID" select="normalize-space(following-sibling::LifeSpace[2]/ItemID)"></xsl:with-param>
									<xsl:with-param name="Communities" select="following-sibling::LifeSpace[2]/Communities/."></xsl:with-param>
								</xsl:call-template>
							</td>
							<td width="25%">
								<xsl:call-template name="MyPlanCommunities">
									<xsl:with-param name="TemplatePathURL" select="normalize-space($TemplatePathURL)"></xsl:with-param>
									<xsl:with-param name="HostName" select="normalize-space($HostName)"></xsl:with-param>
									<xsl:with-param name="Item" select="normalize-space(following-sibling::LifeSpace[3]/Item)"></xsl:with-param>
									<xsl:with-param name="FromColorStyle" select="normalize-space(following-sibling::LifeSpace[3]/FromColorStyle)"></xsl:with-param>
									<xsl:with-param name="ColorStyle" select="normalize-space(following-sibling::LifeSpace[3]/ColorStyle)"></xsl:with-param>
									<xsl:with-param name="ItemID" select="normalize-space(following-sibling::LifeSpace[3]/ItemID)"></xsl:with-param>
									<xsl:with-param name="Communities" select="following-sibling::LifeSpace[3]/Communities/."></xsl:with-param>
								</xsl:call-template>
							</td>
						</tr>
					</xsl:if>
				</xsl:for-each>
			</table>
			<table class="tableMaster" cellpadding="0" cellspacing="0">
				<tr>
					<td width="85%" align="left">
						<div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray textCenter"
                            style="width:130px;height:30px;display:table-cell;"
                            onmouseover="document.getElementById('img_SuperPage').src='{$TemplatePathURL}Web/Images/Ver_2_0/BT_arrow_hover.png';"
                            onmouseout="document.getElementById('img_SuperPage').src='{$TemplatePathURL}Web/Images/Ver_2_0/BT_arrow.png';">
							<a href="http://{$HostName}/Home.aspx"  style="text-decoration:none;">
								<img id="img_SuperPage" style="padding-left:8px;border:0px;" src="{$TemplatePathURL}Web/Images/Ver_2_0/BT_arrow.png" align="absmiddle"
                                     class="marginRight5"></img>
								<span id="span_Next" class="spanBrowseGradientTextGray">Go To SuperPage</span>
							</a>
						</div>
					</td>
					<td width="15%" align="right">
						<div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray textCenter"
                            style="width:100px;height:30px;display:table-cell;"
                            onmouseover="document.getElementById('img_Next').src='{$TemplatePathURL}Web/Images/Ver_2_0/BT_arrow_hover.png';"
                            onmouseout="document.getElementById('img_Next').src='{$TemplatePathURL}Web/Images/Ver_2_0/BT_arrow.png';">
							<a href="http://{$HostName}/Community" class="decorationNone">
								<img id="img_Next" style="padding-left:8px;border:0px;" src="{$TemplatePathURL}Web/Images/Ver_2_0/BT_arrow.png" align="absmiddle"
                                     class="marginRight5"></img>
								<span id="span_Next" class="spanBrowseGradientTextGray">CONTINUE</span>
							</a>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</xsl:template>


	<xsl:template name="MyPlanCommunities">
		<xsl:param name="TemplatePathURL" select="'N/A'" />
		<xsl:param name="HostName" select="'N/A'" />
		<xsl:param name="Item" select="'N/A'"></xsl:param>
		<xsl:param name="ItemID" select="'N/A'"/>
		<xsl:param name="ColorStyle" select="'N/A'"/>
		<xsl:param name="FromColorStyle" select="'N/A'"/>
		<xsl:param name="Communities" select="'N/A'"></xsl:param>


		<xsl:variable name="LifeSpaceColor">
			<xsl:choose>
				<xsl:when test="FromColorStyle">
					<xsl:text>background-color: </xsl:text>
					<xsl:value-of select="$FromColorStyle"></xsl:value-of>
					<xsl:text>;</xsl:text>
					<xsl:text>background: -webkit-gradient(linear, left top, left bottom, from(</xsl:text>
					<xsl:value-of select="$FromColorStyle"/>
					<xsl:text>), to(</xsl:text>
					<xsl:value-of select="$ColorStyle"></xsl:value-of>
					<xsl:text>));</xsl:text>
					<xsl:text>background: -moz-linear-gradient(top,  </xsl:text>
					<xsl:value-of select="$FromColorStyle"/>
					<xsl:text>,  </xsl:text>
					<xsl:value-of select="$ColorStyle"></xsl:value-of>
					<xsl:text>);</xsl:text>
					<xsl:text>-webkit-linear-gradient: (top left, </xsl:text>
					<xsl:value-of select="$FromColorStyle"/>
					<xsl:text> 0%, </xsl:text>
					<xsl:value-of select="$ColorStyle"></xsl:value-of>
					<xsl:text> 100%); </xsl:text>
					<xsl:text>background: -webkit-gradient(linear, left top, left bottom, color-stop(0, </xsl:text>
					<xsl:value-of select="$FromColorStyle"/>
					<xsl:text>), color-stop(1, </xsl:text>
					<xsl:value-of select="$ColorStyle"></xsl:value-of>
					<xsl:text>));</xsl:text>
					<xsl:text>background-image: -ms-linear-gradient(top left, </xsl:text>
					<xsl:value-of select="$FromColorStyle"/>
					<xsl:text> 0%, </xsl:text>
					<xsl:value-of select="$ColorStyle"></xsl:value-of>
					<xsl:text> 100%);</xsl:text>
					<xsl:text>background-image: -o-linear-gradient(top left, </xsl:text>
					<xsl:value-of select="$FromColorStyle"/>
					<xsl:text> 0%, </xsl:text>
					<xsl:value-of select="$ColorStyle"></xsl:value-of>
					<xsl:text> 100%);</xsl:text>
					<xsl:text>filter:  progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='</xsl:text>
					<xsl:value-of select="$FromColorStyle"/>
					<xsl:text>', endColorstr='</xsl:text>
					<xsl:value-of select="$ColorStyle"></xsl:value-of>
					<xsl:text>');</xsl:text>
					<xsl:text>-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='</xsl:text>
					<xsl:value-of select="$FromColorStyle"/>
					<xsl:text>', endColorstr='</xsl:text>
					<xsl:value-of select="$ColorStyle"></xsl:value-of>
					<xsl:text>')";</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>background-color: #5C6F7C;</xsl:text>
					<xsl:text>background: -webkit-gradient(linear, left top, left bottom, from(#5C6F7C), to(#425968));</xsl:text>
					<xsl:text>background: -moz-linear-gradient(top,  #5C6F7C,  #425968);</xsl:text>
					<xsl:text>-webkit-linear-gradient: (top left, #5C6F7C 0%, #425968 100%); </xsl:text>
					<xsl:text>background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #5C6F7C), color-stop(1, #425968));</xsl:text>
					<xsl:text>background-image: -ms-linear-gradient(top left, #5C6F7C 0%, #425968 100%);</xsl:text>
					<xsl:text>background-image: -o-linear-gradient(top left, #5C6F7C 0%, #425968 100%);</xsl:text>
					<xsl:text>filter:  progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#5C6F7C', endColorstr='#425968');</xsl:text>
					<xsl:text>-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#5C6F7C', endColorstr='#425968')";</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:if test="$ItemID &gt; 0">
			<div>
				<div style="{$LifeSpaceColor} padding:6px;">
					<img alt="" class="verticallyMiddle" id="img_LifeSpaceIcon_{position()}" BORDER="0"
						 src="{$TemplatePathURL}Web/Images/Ver_2_0/icon_{$Item}_SM.png"></img>
					<span class="VisionLSText verticallyMiddle" style="margin-left:5px;">
						<xsl:value-of select="$Item"/>
					</span>
				</div>
				<img style="width:100%;" alt="" id="img_LifeSpace_{position()}" src="{$TemplatePathURL}Web/Images/Ver_2_0/{$Item}.jpg" BORDER="0"></img>
			</div>
			<img alt="" width="100%" border="0" src="{$TemplatePathURL}Web/Images/Ver_2_0/dropshadow_150.png" />
			<table style="margin-top:10px;margin-bottom:20px;" class="tableMaster" cellpadding="0" cellspacing="0">
				<xsl:for-each select="$Communities/Community">
					<tr>
						<td width="20px">
							<xsl:choose>
								<xsl:when test="VolumeLevel = '3'">
									<input id="chk_LifeSpace_Community_{ItemID}" type="checkbox" name="cbCommunity"
											onclick="UpdateNotificationVolume(this, '{ItemID}','');"
										   checked="true"></input>
								</xsl:when>
								<xsl:otherwise>
									<input id="chk_LifeSpace_Community_{ItemID}" type="checkbox" name="cbCommunity"
								onclick="UpdateNotificationVolume(this, '{ItemID}','');"></input>
								</xsl:otherwise>
							</xsl:choose>
						</td>
						<td>
							<a style="color:#58595B;" class="selectedGoalMenuTabsText decorationNone" href="http://{$HostName}/{PromoteKey}" target="_blank" >
								<xsl:value-of select="Item"/>
							</a>							
						</td>
					</tr>
				</xsl:for-each>
			</table>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>
