﻿<?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="TemplateContainer.xslt"/>
	<xsl:import href="CommunityContainer.xslt"/>
	<xsl:import href="AsynchronousContainer/AsynchronousGoal.xslt"/>
	<xsl:import href="AsynchronousContainer/AsynchronousDashBoard.xslt"/>
	<xsl:import href="PublicationContainer.xslt"/>
	<xsl:import href="AsynchronousContainer/AsynchronousCommunity.xslt"/>
	<xsl:import href="AsynchronousContainer/AsynchronousDiscussion.xslt"/>

	<xsl:import href="GenericTemplates/LoginPopup.xslt"/>

	<xsl:import href="AsynchronousContainerVersion12/AsynchronousDashBoardVersion12.xslt"/>
	<xsl:import href="AsynchronousContainerVersion12/AsynchronousGoalVersion12.xslt"/>

	<xsl:import href="AsynchronousContainerVersion12/AsynchronousClientPortalRightContent.xslt"/>
	<xsl:import href="AsynchronousContainerVersion12/AsynchronousClientPortalQuickButtons.xslt"/>

	<xsl:import href="AsynchronousContainer/AsynchronousWorkout.xslt"/>

	<xsl:import href="Version_2_0/SuperPageWorkingArea.xslt"/>

	<xsl:import href="Version_2_0/LoadGoalAsynchronouslyVersion2.xslt"/>

	<xsl:template match="/">

		<xsl:variable name="LifeSpaceLLCID">
			<xsl:text>666</xsl:text>
		</xsl:variable>

		<xsl:call-template name="InitializeRightContent">
			<xsl:with-param name="ItemID" select="normalize-space(AjaxRequest/Params/ItemID)"/>
			<xsl:with-param name="ItemType" select="normalize-space(AjaxRequest/Params/ItemType)"/>
			<xsl:with-param name="TemplateURL" select ="normalize-space(AjaxRequest/TemplateURL)"/>
			<xsl:with-param name="HostName" select ="normalize-space(AjaxRequest/HostName)"/>
			<xsl:with-param name="ItemName" select="normalize-space(AjaxRequest/Params/ItemName)"/>
			<xsl:with-param name="PermissionID" select="normalize-space(AjaxRequest/Params/PermissionID)"/>
			<xsl:with-param name="ParentID" select="normalize-space(AjaxRequest/Params/ParentID)"/>
			<xsl:with-param name="ParentName" select="normalize-space(AjaxRequest/Params/ParentName)"/>
			<xsl:with-param name="ImageURL" select="normalize-space(AjaxRequest/Params/ImageURL)"/>
			<xsl:with-param name="Authenticated" select="normalize-space(AjaxRequest/Params/Authenticated)"/>
			<xsl:with-param name="LoginPopUpURL" select="normalize-space(AjaxRequest/LoginPopUpURL)"/>
			<xsl:with-param name="CommunityGroupUser" select="normalize-space(AjaxRequest/Params/CommunityGroupUser)"/>
			<xsl:with-param name="LifeSpaceLLCID" select="normalize-space($LifeSpaceLLCID)"/>
			<xsl:with-param name="Version" select="normalize-space(AjaxRequest/Params/Version)"/>
			<xsl:with-param name="OrderBy" select="normalize-space(AjaxRequest/Params/OrderBy)"/>
			<xsl:with-param name="ActivateStatus" select="normalize-space(AjaxRequest/Params/ActivateStatus)"></xsl:with-param>
			<xsl:with-param name="TemplateItemID" select="normalize-space(AjaxRequest/Params/TemplateItemID)"></xsl:with-param>
			<xsl:with-param name="TotalTemplates" select="normalize-space(AjaxRequest/Params/CommunityMetaData/TotalTemplates)"></xsl:with-param>
			<xsl:with-param name="TotalPublications" select="normalize-space(AjaxRequest/Params/CommunityMetaData/TotalPublications)"></xsl:with-param>
			<xsl:with-param name="TotalDiscussions" select="normalize-space(AjaxRequest/Params/CommunityMetaData/TotalDiscussions)"></xsl:with-param>
			<xsl:with-param name="TotalContents" select="normalize-space(AjaxRequest/Params/CommunityMetaData/TotalContents)"></xsl:with-param>
			<xsl:with-param name="ContentHtml" select="AjaxRequest/Params/TemplateData/ContentHtml"/>
			<xsl:with-param name="InstructionsHtml" select="AjaxRequest/Params/TemplateData/InstructionsHtml"/>
			<xsl:with-param name="MyCommunityHTML" select="AjaxRequest/Params/TemplateData/MyCommunityHTML"/>
			<xsl:with-param name="RelatedTemplatesHtml" select="AjaxRequest/Params/TemplateData/RelatedTemplatesHtml"/>
			<xsl:with-param name="SourceID" select="normalize-space(AjaxRequest/Params/SourceID)"/>
			<xsl:with-param name="IsFollowingGoal" select="normalize-space(AjaxRequest/Params/IsFollowingGoal)"/>
			<xsl:with-param name="Debug" select="normalize-space(AjaxRequest/Params/Debug)"/>
			<xsl:with-param name="PublicationHtml" select="AjaxRequest/Params/PublicationHtml"/>
			<xsl:with-param name="ParentType" select="AjaxRequest/Params/ParentType"/>
			<xsl:with-param name="DisplayShareIT" select="AjaxRequest/CheckBoxes/ShareIt"/>
			<xsl:with-param name="PortalTypeID" select="AjaxRequest/Modules/PortalTypeID"/>
			<xsl:with-param name="ClientUserID" select="normalize-space(AjaxRequest/Params/ClientUserID)"/>
			<xsl:with-param name="LifeSpaceItemColorStyle" select="normalize-space(AjaxRequest/Params/LifeSpaceItemColorStyle)"/>
			<xsl:with-param name="LifeSpaceFromColor" select="normalize-space(AjaxRequest/Params/LifeSpaceFromColor)"/>
			<xsl:with-param name="IsCoach" select="normalize-space(AjaxRequest/Params/IsCoach)"/>
			<xsl:with-param name="CommunityAdmin" select="normalize-space(AjaxRequest/UserRoles/.)"/>
			<xsl:with-param name="BlogPostsHTML" select="AjaxRequest/Params/TemplateData/BlogPostsHTML"></xsl:with-param>
			<xsl:with-param name="ArticlesHTML" select="AjaxRequest/Params/TemplateData/ArticlesHTML"></xsl:with-param>
			<xsl:with-param name="RoleName">
				<xsl:choose>
					<xsl:when test="normalize-space(AjaxRequest/UserRoles/Role[RoleName = 'Brand Admin'])">
						<xsl:text>True</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:text>False</xsl:text>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
			<xsl:with-param name="ProPackageID" select="AjaxRequest/ProPackageID"/>
			<xsl:with-param name="BrandID" select="AjaxRequest/BrandID"></xsl:with-param>
			<xsl:with-param name="DataFilter" select="normalize-space(AjaxRequest/Params/DataFilter)"></xsl:with-param>
			<xsl:with-param name="MBrandItemID" select="normalize-space(AjaxRequest/Params/MBrandItemID)"></xsl:with-param>
		</xsl:call-template>
	</xsl:template>


	<xsl:template name="InitializeRightContent">
		<xsl:param name="ItemID" select="'N/A'"/>
		<xsl:param name="ItemType" select="'N/A'"/>
		<xsl:param name="ItemName" select="'N/A'"/>
		<xsl:param name="PermissionID" select="'N/A'"/>
		<xsl:param name="ParentName" select="'N/A'"/>
		<xsl:param name="ImageURL" select="'N/A'"/>
		<xsl:param name="TemplateURL" select ="'N/A'"/>
		<xsl:param name="HostName" select ="'N/A'"/>
		<xsl:param name="Authenticated" select="'N/A'"/>
		<xsl:param name="LoginPopUpURL" select="'N/A'"/>
		<xsl:param name="CommunityGroupUser" select="'N/A'"/>
		<xsl:param name="LifeSpaceLLCID" select="'N/A'"/>
		<xsl:param name="Version" select="'N/A'"/>
		<xsl:param name="OrderBy" select="'N/A'"/>
		<xsl:param name="ActivateStatus" select="'N/A'"/>
		<xsl:param name="TemplateItemID" select="'N/A'"/>
		<xsl:param name="TotalTemplates" select="'N/A'"/>
		<xsl:param name="TotalPublications" select="'N/A'"/>
		<xsl:param name="TotalDiscussions" select="'N/A'"/>
		<xsl:param name="TotalContents" select="'N/A'"/>
		<xsl:param name="ContentHtml" select="'N/A'"/>
		<xsl:param name="InstructionsHtml" select="'N/A'"/>
		<xsl:param name="RelatedTemplatesHtml" select="'N/A'"/>
		<xsl:param name="SourceID" select="'N/A'"/>
		<xsl:param name="IsFollowingGoal" select="'N/A'"/>
		<xsl:param name="Debug" select="'N/A'"/>
		<xsl:param name="PublicationHtml" select="'N/A'"/>
		<xsl:param name="ParentType" select="'N/A'"/>
		<xsl:param name="DisplayShareIT" select="'N/A'"/>
		<xsl:param name="PortalTypeID" select="'N/A'"/>
		<xsl:param name="StatusID" select="'N/A'"/>
		<xsl:param name="ClientUserID" select="'N/A'"/>
		<xsl:param name="IsCoach" select="'N/A'"/>
		<xsl:param name="RoleName" select="'N/A'"/>
		<xsl:param name="ParentID" select="'N/A'"/>
		<xsl:param name="StatusMaster" select="'N/A'"></xsl:param>
		<xsl:param name="LifeSpaceItemColorStyle" select="'N/A'"></xsl:param>
		<xsl:param name="LifeSpaceFromColor" select="'N/A'"></xsl:param>
		<xsl:param name="OwnerID" select="'N/A'"></xsl:param>
		<xsl:param name="OwnerName" select="'N/A'"></xsl:param>
		<xsl:param name="CommunityAdmin" select="'N/A'"></xsl:param>
		<xsl:param name="MyCommunityHTML" select="'N/A'"></xsl:param>
		<xsl:param name="BlogPostsHTML" select="'N/A'"></xsl:param>
		<xsl:param name="ArticlesHTML" select="'N/A'"></xsl:param>
		<xsl:param name="VolumeLevel">
			<xsl:number value="-99"/>
		</xsl:param>
		<xsl:param name="PromoteKey" select="'N/A'"></xsl:param>
		<xsl:param name="LoggedInUserID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalType">
			<xsl:number value="0"/>
		</xsl:param>
		<xsl:param name="ShareActiveYN" select="'N/A'"></xsl:param>
		<xsl:param name="OpenTo" select="'N/A'"></xsl:param>
		<xsl:param name="ChallengeStartStatus" select="'N/A'"></xsl:param>
		<xsl:param name="PortalModules" select="'N/A'"></xsl:param>
		<xsl:param name="ProPackageID" select="'N/A'"></xsl:param>
		<xsl:param name="BrandID" select="'N/A'"></xsl:param>
		<xsl:param name="DataFilter" select="'N/A'"></xsl:param>
		<xsl:param name="MBrandItemID" select="'N/A'"></xsl:param>


		<div id="divRightNavigationBar">
			
			<xsl:choose>
				<xsl:when test="$ItemType = 'Home' or $ItemType = 'LifeSpace' or ($ItemType = 'None' and $ItemID = 0) 
                            or $ItemType = 'Goal' or $ItemType = 'Project' or $ItemType = 'Template' or $ItemType = 'Community' 
                            or $ItemType = 'LSPublication' or $ItemType = 'Discussion' or $ItemType = 'NoteBook'
                            or $ItemType = 'Action' or $ItemType = 'WorkOut' or $ItemType = 'Survey'">

					<input type ="hidden" id="defaultTopicID" value="-1"/>
					<input type ="hidden" id="defaultDate" value=""/>
					<input type ="hidden" id="defaultPlannerItemDate" value=""/>
					<input type ="hidden" id="currentPlannerItemID" value=""/>

					<!--<xsl:if test="$GoalType != 2 or not($GoalType)">
						<xsl:if test="($MBrandItemID &gt;0 and ($DataFilter = 'exclude' or $DataFilter = 'Exclude' or $ItemType = 'Goal')) or ($MBrandItemID &lt;= 0)">
							<div id="div_SuperPage_WelcomeMessage_Container"></div>
							<script language="javascript" type="text/javascript">
								loadLifespaceTutorialSmartbar("div_SuperPage_WelcomeMessage_Container");
							</script>
						</xsl:if>
					</xsl:if>-->

					<div id="divDashBoardContainer" class="superPageLifeSpaceHeader" style="margin-left:24px;margin-right:24px;">
						<xsl:choose>
							<xsl:when test="$ItemType = 'Goal' or $ItemType = 'Project'">
								<xsl:choose>
									<xsl:when test="($OpenTo = 3) and normalize-space($Authenticated) = 'False'">
										<div id="divAuthenticationMessage">
											<span class="labelError">
												You must be logged in to view this item
											</span>
										</div>
									</xsl:when>
									<xsl:when test="($OpenTo = 3) and normalize-space($Authenticated) = 'True' and $PermissionID &lt; 0">
										<div id="divAuthorizationMessage">
											<xsl:choose>
												<xsl:when test="$RoleName = 'True'">
													<span class="labelError">
														You do not have sufficient rights to view this item
													</span>
													<input type="button" class="button" value="Take Ownership"
                                                           onClick="return shareIT_addBrandAdmintoShareIT({$ItemID},'Goal');"></input>
												</xsl:when>
												<xsl:otherwise>
													<span class="labelError">
														You do not have sufficient rights to view this item
													</span>
												</xsl:otherwise>
											</xsl:choose>
										</div>
									</xsl:when>
									<xsl:when test="$OpenTo = 2 or $OpenTo = 1 
                                              or (($OpenTo = 3) and normalize-space($Authenticated) = 'True' and $PermissionID &gt; 0)">
										<xsl:call-template name="LoadGoalAsynchronouslyVersion2">
											<xsl:with-param name="ItemID" select="$ItemID"/>
											<xsl:with-param name="ItemType" select="$ItemType"/>
											<xsl:with-param name="TemplateURL" select="$TemplateURL"/>
											<xsl:with-param name="HostName" select="$HostName"/>
											<xsl:with-param name="ItemName" select="$ItemName"/>
											<xsl:with-param name="PermissionID" select="$PermissionID"/>
											<xsl:with-param name="ParentName" select="$ParentName"/>
											<xsl:with-param name="ImageURL" select="$ImageURL"/>
											<xsl:with-param name="Authenticated" select="$Authenticated"></xsl:with-param>
											<xsl:with-param name="LoginPopUpURL" select="$LoginPopUpURL"></xsl:with-param>
											<xsl:with-param name="Version" select="$Version"/>
											<xsl:with-param name="IsFollowingGoal" select="$IsFollowingGoal"/>
											<xsl:with-param name="ActivateStatus" select="$ActivateStatus"></xsl:with-param>
											<xsl:with-param name="TemplateItemID" select="$TemplateItemID"></xsl:with-param>
											<xsl:with-param name="DisplayShareIT" select="$DisplayShareIT"></xsl:with-param>
											<xsl:with-param name="StatusID" select="$StatusID"></xsl:with-param>
											<xsl:with-param name="ParentID" select="$ParentID"></xsl:with-param>
											<xsl:with-param name="StatusMaster" select="$StatusMaster"></xsl:with-param>
											<xsl:with-param name="LifeSpaceItemColorStyle" select="$LifeSpaceItemColorStyle"></xsl:with-param>
											<xsl:with-param name="LifeSpaceFromColor" select="$LifeSpaceFromColor"></xsl:with-param>
											<xsl:with-param name="IsCoach" select="$IsCoach"></xsl:with-param>
											<!--RoleName='True' when User = 'Brand Admin'-->
											<xsl:with-param name="RoleName" select="$RoleName"></xsl:with-param>
											<xsl:with-param name="OwnerID" select="$OwnerID"></xsl:with-param>
											<xsl:with-param name="OwnerName" select="$OwnerName"></xsl:with-param>
											<xsl:with-param name="ParentType" select="$ParentType"/>
											<xsl:with-param name="CommunityAdmin" select="$CommunityAdmin"/>
											<xsl:with-param name="GoalType" select="$GoalType"></xsl:with-param>
											<xsl:with-param name="ShareActiveYN" select="$ShareActiveYN"></xsl:with-param>
											<xsl:with-param name="ChallengeStartStatus" select="$ChallengeStartStatus"></xsl:with-param>
										</xsl:call-template>
									</xsl:when>
								</xsl:choose>
							</xsl:when>
							<xsl:when test="$ItemType = 'Home' or ($ItemType = 'None' and $ItemID = 0)">
								<xsl:choose>
									<xsl:when test="$Authenticated = 'False'">
										<div id="divAuthenticationMessage">
											<span class="labelError">
												You must be logged in to view this item
											</span>
										</div>
										<xsl:call-template name ="LoginPopup"></xsl:call-template>

										<script language="javascript" type="text/javascript">
											showLoginPopupFrameDiv("<xsl:value-of select="$LoginPopUpURL"/>");
										</script>
									</xsl:when>
									<xsl:otherwise>
										<xsl:call-template name="SuperPageWorkingArea">
											<xsl:with-param name="ItemID" select="$ItemID"></xsl:with-param>
											<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
											<xsl:with-param name="Authenticated" select="$Authenticated"></xsl:with-param>
											<xsl:with-param name="LoginPopUpURL" select="$LoginPopUpURL"></xsl:with-param>
											<xsl:with-param name="CommunityGroupUser" select="$CommunityGroupUser"></xsl:with-param>
											<xsl:with-param name="LifeSpaceLLCID" select="$LifeSpaceLLCID"></xsl:with-param>
											<xsl:with-param name="ItemType" select="$ItemType"/>
											<xsl:with-param name="Version" select="$Version"/>
											<xsl:with-param name="OrderBy" select="$OrderBy"/>
											<xsl:with-param name="Debug" select="$Debug"/>
											<xsl:with-param name="PermissionID" select="$PermissionID"/>
											<xsl:with-param name="DisplayShareIT" select="$DisplayShareIT"></xsl:with-param>
											<xsl:with-param name="CommunityAdmin" select="$CommunityAdmin"/>
											<xsl:with-param name="DataFilter" select="$DataFilter"/>
											<xsl:with-param name="MBrandItemID" select="$MBrandItemID"/>
										</xsl:call-template>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:when>
							<xsl:when test="$ItemType = 'Template'">
								<xsl:call-template name="TemplateContainer">
									<xsl:with-param name="ContentHtml" select="$ContentHtml"></xsl:with-param>
									<xsl:with-param name="InstructionsHtml" select="$InstructionsHtml"></xsl:with-param>
									<xsl:with-param name="RelatedTemplatesHtml" select="$RelatedTemplatesHtml"></xsl:with-param>
									<xsl:with-param name="SourceID" select="$SourceID"></xsl:with-param>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test="$ItemType = 'Community'">
								<xsl:call-template name="CommunityContainer">
									<xsl:with-param name="ContentHtml" select="$ContentHtml"></xsl:with-param>
									<xsl:with-param name="InstructionsHtml" select="$InstructionsHtml"></xsl:with-param>
									<xsl:with-param name="RelatedTemplatesHtml" select="$RelatedTemplatesHtml"></xsl:with-param>
									<xsl:with-param name="CommunityGroupUser" select="$CommunityGroupUser"></xsl:with-param>
									<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
									<xsl:with-param name="Authenticated" select="$Authenticated"></xsl:with-param>
									<xsl:with-param name="TotalTemplates" select="$TotalTemplates"></xsl:with-param>
									<xsl:with-param name="TotalPublications" select="$TotalPublications"></xsl:with-param>
									<xsl:with-param name="TotalDiscussions" select="$TotalDiscussions"></xsl:with-param>
									<xsl:with-param name="TotalContents" select="$TotalContents"></xsl:with-param>
									<xsl:with-param name="Version" select="$Version"/>
									<xsl:with-param name="MyCommunityHTML" select="$MyCommunityHTML"></xsl:with-param>
									<xsl:with-param name="ItemName" select="$ItemName"></xsl:with-param>
									<xsl:with-param name="BlogPostsHTML" select="$BlogPostsHTML"></xsl:with-param>
									<xsl:with-param name="ArticlesHTML" select="$ArticlesHTML"></xsl:with-param>
									<xsl:with-param name="VolumeLevel" select="$VolumeLevel"></xsl:with-param>
									<xsl:with-param name="PromoteKey" select="$PromoteKey"></xsl:with-param>
									<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
									<xsl:with-param name="LoggedInUserID" select="$LoggedInUserID"></xsl:with-param>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test="$ItemType = 'LSPublication'">
								<xsl:call-template name="PublicationContainer">
									<xsl:with-param name="PublicationHtml" select="$PublicationHtml"></xsl:with-param>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test="$ItemType = 'Discussion' or $ItemType = 'Survey' or $ItemType = 'Action' or $ItemType = 'WorkOut' or $ItemType = 'NoteBook'">
								<xsl:choose>
									<xsl:when test="normalize-space($Authenticated) = 'False'">
										<div id="divAuthenticationMessage">
											<span class="labelError">
												You must be logged in to view this item
											</span>
										</div>
										<xsl:call-template name ="LoginPopup"></xsl:call-template>
										<script language="javascript" type="text/javascript">
											showLoginPopupFrameDiv("<xsl:value-of select="$LoginPopUpURL"/>");
										</script>
									</xsl:when>
									<xsl:when test="$ItemType = 'Discussion' or $ItemType = 'Survey' or $ItemType = 'Action' or $ItemType = 'WorkOut' or $ItemType = 'NoteBook'">
										<xsl:choose>
											<xsl:when test="normalize-space($Authenticated) = 'False'">
												<div id="divAuthenticationMessage">
													<span class="labelError">
														You must be logged in to view this item
													</span>
												</div>
												<xsl:call-template name ="LoginPopup"></xsl:call-template>
												<script language="javascript" type="text/javascript">
													showLoginPopupFrameDiv("<xsl:value-of select="$LoginPopUpURL"/>");
												</script>
											</xsl:when>
											<xsl:when test="$PermissionID &lt; 0  and normalize-space($Authenticated) = 'True' and $ItemType != 'Discussion'">
												<div id="divAuthorizationMessage">
													<span class="labelError">
														You do not have sufficient rights to view this item
													</span>
												</div>
											</xsl:when>
											<xsl:when test="($PermissionID &gt; 0 and normalize-space($Authenticated) = 'True')
                                               or ($ItemType = 'Discussion' and normalize-space($Authenticated) = 'True' and $ParentType !='Goal')">
												<xsl:call-template name="LoadDiscussionAsynchronously">
													<xsl:with-param name="ItemID" select="$ItemID"></xsl:with-param>
													<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
													<xsl:with-param name="ItemType" select="$ItemType"></xsl:with-param>
													<xsl:with-param name="PermissionID" select="$PermissionID"/>
													<xsl:with-param name="ParentType" select="$ParentType"/>
													<xsl:with-param name="ParentID" select="$ParentID"></xsl:with-param>
												</xsl:call-template>
											</xsl:when>
										</xsl:choose>
									</xsl:when>
								</xsl:choose>
							</xsl:when>
						</xsl:choose>
					</div>
				</xsl:when>
				<xsl:otherwise>
					<div id="divDashBoardContainer">
						<xsl:choose>
							<xsl:when test="$ItemType = 'Portal'">
								<xsl:choose>
									<xsl:when test="normalize-space($Authenticated) = 'False'">
										<div id="divAuthenticationMessage">
											<span class="labelError">
												You must be logged in to view this item
											</span>
										</div>
										<xsl:call-template name ="LoginPopup"></xsl:call-template>
										<script language="javascript" type="text/javascript">
											showLoginPopupFrameDiv("<xsl:value-of select="$LoginPopUpURL"/>");
										</script>
									</xsl:when>
									<xsl:when test="$PermissionID &lt; 0 and normalize-space($Authenticated) = 'True'">
										<div id="divAuthorizationMessage">
											<xsl:choose>
												<xsl:when test="$RoleName = 'True'">
													<span class="labelError">
														You do not have sufficient rights to view this item
													</span>
													<input type="button" class="button" value="Take Ownership"
                                                           onClick="return shareIT_addBrandAdmintoShareIT({$ItemID},'Portal');"></input>
												</xsl:when>
												<xsl:otherwise>
													<span class="labelError">
														You do not have sufficient rights to view this item
													</span>
												</xsl:otherwise>
											</xsl:choose>
										</div>
									</xsl:when>
									<xsl:when test="$PermissionID &gt; 0 and normalize-space($Authenticated) = 'True'">
										<div id="div_ClientPortalQuickButtonsContainer" style="margin-bottom:2px;">
											<xsl:call-template name ="ClientPortalQuickButtons">
												<xsl:with-param name="ItemID" select="$ItemID"/>
												<xsl:with-param name="ItemType" select="$ItemType"/>
												<xsl:with-param name="TemplateURL" select="$TemplateURL"/>
												<xsl:with-param name="ItemName" select="$ItemName"/>
												<xsl:with-param name="PortalTypeID" select="$PortalTypeID"/>
												<xsl:with-param name="ClientUserID" select="$ClientUserID"/>
												<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
												<xsl:with-param name="PortalModules" select="$PortalModules"></xsl:with-param>
												<xsl:with-param name="BrandID" select="$BrandID"></xsl:with-param>
                                                <xsl:with-param name="ProPackageID" select="$ProPackageID"></xsl:with-param>
											</xsl:call-template>
										</div>
										<div id="div_ClientPortalContentContainer">
											<xsl:call-template name ="ClientPortalRightContent">
												<xsl:with-param name="ItemID" select="$ItemID"/>
												<xsl:with-param name="ItemType" select="$ItemType"/>
												<xsl:with-param name="TemplateURL" select="$TemplateURL"/>
												<xsl:with-param name="ItemName" select="$ItemName"/>
												<xsl:with-param name="PortalTypeID" select="$PortalTypeID"/>
												<xsl:with-param name="ClientUserID" select="$ClientUserID"/>
												<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
												<xsl:with-param name="ProPackageID" select="$ProPackageID"></xsl:with-param>
											</xsl:call-template>
										</div>
									</xsl:when>
								</xsl:choose>
							</xsl:when>


							<xsl:when test="$ItemType = 'WorkOut'">
								<xsl:call-template name="Workout">
									<xsl:with-param name="ItemID" select="$ItemID"></xsl:with-param>
									<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
									<xsl:with-param name="ItemType" select="$ItemType"></xsl:with-param>
									<xsl:with-param name="PermissionID" select="$PermissionID"/>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test="$ItemType = 'None' and $ItemID &gt; 0">
								<div>
									This data request is no longer valid
								</div>
							</xsl:when>
							<xsl:otherwise>
								<div>
									Item Type [ <xsl:value-of select="$ItemType"/> ] is not currently supported
								</div>
							</xsl:otherwise>
						</xsl:choose>
					</div>
					<div id="divOperations" style="display: none; margin-top: 20px; ">
					</div>
				</xsl:otherwise>
			</xsl:choose>
		</div>
	</xsl:template>

</xsl:stylesheet>
