﻿<?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="../../GenericTemplates/StringReplace.xslt"/>
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:call-template name="ActivityDashboardContent">
			<xsl:with-param name="ID" select="AjaxRequest/Params/ID"></xsl:with-param>
			<xsl:with-param name="Action" select="AjaxRequest/Action"></xsl:with-param>
			<xsl:with-param name="MasterPortalID" select="AjaxRequest/Params/MasterPortalID"></xsl:with-param>
			<xsl:with-param name="Level" select="AjaxRequest/Params/Level"></xsl:with-param>
			<xsl:with-param name="SettingsXML" select="AjaxRequest/Settings/."></xsl:with-param>
			<xsl:with-param name="ItemName" select="AjaxRequest/ActivityDashboardContentXML/ItemName"></xsl:with-param>
			<xsl:with-param name="ImageURL" select="AjaxRequest/ActivityDashboardContentXML/ImageURL"></xsl:with-param>
			<xsl:with-param name="DefaultImage" select="AjaxRequest/DefaultImage"></xsl:with-param>
			<xsl:with-param name="SelectedName" select="AjaxRequest/SelectedName"></xsl:with-param>
			<xsl:with-param name="ActiveTab" select="AjaxRequest/ActiveTab"></xsl:with-param>
			<xsl:with-param name="LoggedUserID" select="AjaxRequest/LoggedUserID">	</xsl:with-param>
			<xsl:with-param name="IsSecureConnection" select="AjaxRequest/IsSecureConnection"></xsl:with-param>
			<xsl:with-param name="HostName" select="AjaxRequest/HostName"></xsl:with-param>
			<xsl:with-param name="TemplateURL" select="AjaxRequest/TemplateURL"></xsl:with-param>
			<xsl:with-param name="PromoteKey" select="AjaxRequest/PromoteKey"></xsl:with-param>
			<xsl:with-param name="PermissionID" select="AjaxRequest/ActivityDashboardXML/Portal/PermissionID"></xsl:with-param>
		</xsl:call-template>
	</xsl:template>


	<xsl:template name="ActivityDashboardContent">
		<xsl:param name="ID" select="'N/A'"></xsl:param>
		<xsl:param name="Action" select="'N/A'"></xsl:param>
		<xsl:param name="MasterPortalID" select="'N/A'"></xsl:param>
		<xsl:param name="Level" select="'N/A'"></xsl:param>
		<xsl:param name="SettingsXML" select="'N/A'"></xsl:param>
		<xsl:param name="ItemName" select="'N/A'"></xsl:param>
		<xsl:param name="ImageURL" select="'N/A'"></xsl:param>
		<xsl:param name="DefaultImage" select="'N/A'"/>
		<xsl:param name="SelectedName" select="'N/A'"></xsl:param>
		<xsl:param name="DefaultTabHTML" select="'N/A'"></xsl:param>
		<xsl:param name="ActiveTab" select="'N/A'"></xsl:param>
		<xsl:param name="LoggedUserID" select="'N/A'"></xsl:param>
		<xsl:param name="IsSecureConnection" 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="PromoteKey" select="'N/A'"></xsl:param>
		<xsl:param name="PermissionID" select="'N/A'"></xsl:param>
		<xsl:variable name="SettingMasterID">
			<xsl:value-of select="$SettingsXML/MasterPortalItemID"/>
		</xsl:variable>
		<xsl:variable name="PortalID">
			<xsl:choose>
				<xsl:when test="$MasterPortalID = $SettingMasterID">
					<xsl:text>null</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$MasterPortalID"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="TargetAction">
			<xsl:choose>
				<xsl:when test="$Action = 'LoadActivityDashboard'">
					<xsl:text>LoadActivityDashboardContent</xsl:text>
				</xsl:when>
				<xsl:when test="$Action = 'LoadCoachAdminDashboard'">
					<xsl:text>LoadCoachAdminActivityDashboardContent</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$Action"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>


		<xsl:variable name="ImageSRC">
			<xsl:choose>
				<xsl:when test="$IsSecureConnection = 1 and $ImageURL!=''">
					<xsl:call-template name="replaceCharsInString">
						<xsl:with-param name="stringIn" select="$ImageURL"></xsl:with-param>
						<xsl:with-param name="charsIn">
							<xsl:text>http://</xsl:text>
						</xsl:with-param>
						<xsl:with-param name="charsOut">
							<xsl:text>https://</xsl:text>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:when>
				<xsl:when test="$ImageURL!=''">
					<xsl:value-of select="$ImageURL"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$DefaultImage"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="Protocol">
			<xsl:choose>
				<xsl:when test="$IsSecureConnection = 1">
					<xsl:text>https://</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>http://</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<div>
			<!--<xsl:choose>
				<xsl:when test="$TargetAction = 'LoadCoachAdminActivityDashboardContent'">
					<script>
						LoadCoachAdminActivityReport(<xsl:value-of select="$MasterPortalID"/>, <xsl:value-of select="$ID"/>
						, '<xsl:value-of select="$Level"/>', 'Div_ScoreCardFrame');
					</script>
				</xsl:when>
			</xsl:choose>-->

			<table class="tableMaster" cellpadding="0" cellspacing="0" >
				<tr>
					<td width="2%"></td>
					<td width="5%">
						<div id="div_PortalTopLogo">
							<xsl:choose>
								<xsl:when test="$PermissionID &gt;= 4">
									<xsl:choose>
										<xsl:when test=" $ImageURL!=''">
											<img src="{$ImageSRC}"
										 onload='setWidthAndHeightImage(this,"100");' class='marginTop5 onMouseOver'></img>
										</xsl:when>
										<xsl:otherwise>
											<div align="center" style="height:135px;" class="onMouseOver"
																	 onclick="ImageUploader_PopupCenter('{$Protocol}{$HostName}/upload/uploadimage.aspx?guid={$PromoteKey}&amp;cropRatio=1&amp;requiredHeight=100&amp;requiredWidth=0&amp;requiredFileName=Logo&amp;Key=UploadPathBrand', 'Upload_Image','530','390','{$ID}','UploadBrandLogo','div_PortalTopLogo',null,0);">
												<img id="img_UserImage_{$ID}" src="{$ImageSRC}"
													 onload="setWidthAndHeightImage(this, 135);"
													 style="display:none;border:0px;" align="absmiddle"
													 onmouseover="this.className='grayOut';document.getElementById('span_imageText').style.display ='block';"
													 onmouseout="this.setAttribute('class','');document.getElementById('span_imageText').style.display ='none';">
												</img>
												<span id="span_imageText" style="display:none;position:relative;top:-75px;color:gray" class="labelLifespaceItem "
													onmouseover="document.getElementById('img_UserImage_{$ID}').className='grayOut';document.getElementById('span_imageText').style.display ='block';"
													onmouseout="document.getElementById('img_UserImage_{$ID}').setAttribute('class','');document.getElementById('span_imageText').style.display ='none';">Change Photo</span>
											</div>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:when>
								<xsl:otherwise>
									<img src="{$ImageSRC}"
										 onload='setWidthAndHeightImage(this,"100");' class='marginTop5 onMouseOver'></img>
								</xsl:otherwise>
							</xsl:choose>



						</div>
					</td>
					<td width="58%" class="verticallyMiddle textLeft">
						<span  class="labelGoalTitle sentenceFont marginLeft5">
							<xsl:value-of select="$SelectedName"/>
						</span>
						<div class="publicationSummary marginLeft5">
							<xsl:value-of select="$ItemName"/>
						</div>
					</td>

					<td width="35%">
						<table class="tableMaster" cellpadding="2" cellspacing="1">
							<tr>
								<td width="20%" class="vertcallyMiddle">
									<div class="packageTitle marginRight5 textRight" style="padding-top:3px;">
										<!--Coach/Manager:-->
									</div>
								</td>
								<td class="vertcallyMiddle" style="padding-top:3px;">
									<table id="" class="tableMaster" cellpadding="0" cellspacing="1">
										<tr id="">
											<td class="verticallyMiddle">
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="4">
						<table class="tableMaster" cellpadding="0" cellspacing="0">
							<tr>
								<td width="1%" style="border-bottom:1px solid #5E5E5E;"></td>

								<xsl:variable name="SecCellPercentage">
									<xsl:choose>
										<xsl:when test="$Level='PortalSpecificClient' and count($SettingsXML/ProfileTabs/ClientPortalProfileTabs/Tab) = 1">
											<xsl:text>20%</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>85%</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<xsl:variable name="ThirdCellPercentage">
									<xsl:choose>
										<xsl:when test="$Level='PortalSpecificClient' and count($SettingsXML/ProfileTabs/ClientPortalProfileTabs/Tab) = 1">
											<xsl:text>79%</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>14%</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>

								<td width="{$SecCellPercentage}">
									<div class="goalTabsBackground marginTop10">
										<table class="tableMaster textCenter verticallyMiddle capitalFont" height="32px"
                                                cellSpacing="0" cellPadding="0" >
											<xsl:choose>
												<xsl:when test="$Level='AllPortals'">
													<xsl:for-each select="$SettingsXML/ProfileTabs/AllPortalsProfileTabs/Tab">
														<xsl:call-template name="ProfileMenuTabs">
															<xsl:with-param name="SettingsXML" select="$SettingsXML"></xsl:with-param>
															<xsl:with-param name="MasterPortalID" select="$MasterPortalID"></xsl:with-param>
															<xsl:with-param name="ID" select="$ID"></xsl:with-param>
															<xsl:with-param name="Level" select="$Level"></xsl:with-param>
															<xsl:with-param name="Action" select="$Action"></xsl:with-param>
															<xsl:with-param name="PortalID" select="$PortalID"></xsl:with-param>
															<xsl:with-param name="LoggedUserID" select="$LoggedUserID"></xsl:with-param>
														</xsl:call-template>
													</xsl:for-each>
												</xsl:when>
												<xsl:when test="$Level='AllPortalsClient'">
													<xsl:for-each select="$SettingsXML/ProfileTabs/ClientAllPortalsProfileTabs/Tab">
														<xsl:call-template name="ProfileMenuTabs">
															<xsl:with-param name="SettingsXML" select="$SettingsXML"></xsl:with-param>
															<xsl:with-param name="MasterPortalID" select="$MasterPortalID"></xsl:with-param>
															<xsl:with-param name="ID" select="$ID"></xsl:with-param>
															<xsl:with-param name="Level" select="$Level"></xsl:with-param>
															<xsl:with-param name="Action" select="$Action"></xsl:with-param>
															<xsl:with-param name="PortalID" select="$PortalID"></xsl:with-param>
															<xsl:with-param name="LoggedUserID" select="$LoggedUserID"></xsl:with-param>
														</xsl:call-template>
													</xsl:for-each>
												</xsl:when>
												<xsl:when test="$Level='PortalSpecificClient'">
													<xsl:for-each select="$SettingsXML/ProfileTabs/ClientPortalProfileTabs/Tab">
														<xsl:call-template name="ProfileMenuTabs">
															<xsl:with-param name="SettingsXML" select="$SettingsXML"></xsl:with-param>
															<xsl:with-param name="MasterPortalID" select="$MasterPortalID"></xsl:with-param>
															<xsl:with-param name="ID" select="$ID"></xsl:with-param>
															<xsl:with-param name="Level" select="$Level"></xsl:with-param>
															<xsl:with-param name="Action" select="$Action"></xsl:with-param>
															<xsl:with-param name="LoggedUserID" select="$LoggedUserID"></xsl:with-param>
														</xsl:call-template>
													</xsl:for-each>
												</xsl:when>
												<xsl:when test="$Level='PortalSpecific' or $Level='CoachesSpecific_Selected'">
													<xsl:for-each select="$SettingsXML/ProfileTabs/TeamPortalProfileTabs/Tab">
														<xsl:call-template name="ProfileMenuTabs">
															<xsl:with-param name="SettingsXML" select="$SettingsXML"></xsl:with-param>
															<xsl:with-param name="MasterPortalID" select="$MasterPortalID"></xsl:with-param>
															<xsl:with-param name="ID" select="$ID"></xsl:with-param>
															<xsl:with-param name="Level" select="$Level"></xsl:with-param>
															<xsl:with-param name="Action" select="$Action"></xsl:with-param>
															<xsl:with-param name="LoggedUserID" select="$LoggedUserID"></xsl:with-param>
														</xsl:call-template>
													</xsl:for-each>
												</xsl:when>
												<xsl:when test="$Level='AllCoaches'">
													<xsl:for-each select="$SettingsXML/ProfileTabs/AllCoachesProfileTabs/Tab">
														<xsl:call-template name="ProfileMenuTabs">
															<xsl:with-param name="SettingsXML" select="$SettingsXML"></xsl:with-param>
															<xsl:with-param name="MasterPortalID" select="$MasterPortalID"></xsl:with-param>
															<xsl:with-param name="ID" select="$ID"></xsl:with-param>
															<xsl:with-param name="Level" select="$Level"></xsl:with-param>
															<xsl:with-param name="Action" select="$Action"></xsl:with-param>
															<xsl:with-param name="PortalID" select="$PortalID"></xsl:with-param>
															<xsl:with-param name="LoggedUserID" select="$LoggedUserID"></xsl:with-param>
														</xsl:call-template>
													</xsl:for-each>
												</xsl:when>
												<xsl:when test="$Level='CoachesSpecific'">
													<xsl:for-each select="$SettingsXML/ProfileTabs/CoachRollupProfileTabs/Tab">
														<xsl:call-template name="ProfileMenuTabs">
															<xsl:with-param name="SettingsXML" select="$SettingsXML"></xsl:with-param>
															<xsl:with-param name="MasterPortalID" select="$MasterPortalID"></xsl:with-param>
															<xsl:with-param name="ID" select="$ID"></xsl:with-param>
															<xsl:with-param name="Level" select="$Level"></xsl:with-param>
															<xsl:with-param name="Action" select="$Action"></xsl:with-param>
															<xsl:with-param name="PortalID" select="$PortalID"></xsl:with-param>
															<xsl:with-param name="LoggedUserID" select="$LoggedUserID"></xsl:with-param>
														</xsl:call-template>
													</xsl:for-each>
												</xsl:when>
												<xsl:when test="$Level='AllUsers'">
													<xsl:for-each select="$SettingsXML/ProfileTabs/AllUsersProfileTabs/Tab">
														<xsl:call-template name="ProfileMenuTabs">
															<xsl:with-param name="SettingsXML" select="$SettingsXML"></xsl:with-param>
															<xsl:with-param name="MasterPortalID" select="$MasterPortalID"></xsl:with-param>
															<xsl:with-param name="ID" select="$ID"></xsl:with-param>
															<xsl:with-param name="Level" select="$Level"></xsl:with-param>
															<xsl:with-param name="Action" select="$Action"></xsl:with-param>
															<xsl:with-param name="PortalID" select="$PortalID"></xsl:with-param>
															<xsl:with-param name="LoggedUserID" select="$LoggedUserID"></xsl:with-param>
														</xsl:call-template>
													</xsl:for-each>
												</xsl:when>
												<xsl:when test="$Level='AllUsers_Selected'">
													<xsl:for-each select="$SettingsXML/ProfileTabs/AllUsersSelectedProfileTabs/Tab">
														<xsl:call-template name="ProfileMenuTabs">
															<xsl:with-param name="SettingsXML" select="$SettingsXML"></xsl:with-param>
															<xsl:with-param name="MasterPortalID" select="$SettingMasterID"></xsl:with-param>
															<xsl:with-param name="ID" select="$ID"></xsl:with-param>
															<xsl:with-param name="Level" select="$Level"></xsl:with-param>
															<xsl:with-param name="Action" select="$Action"></xsl:with-param>
															<xsl:with-param name="PortalID" select="$PortalID"></xsl:with-param>
															<xsl:with-param name="LoggedUserID" select="$LoggedUserID"></xsl:with-param>
														</xsl:call-template>
													</xsl:for-each>
												</xsl:when>
											</xsl:choose>
										</table>
									</div>
								</td>
								<td width="{$ThirdCellPercentage}" style="border-bottom:1px solid #5E5E5E;">
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</div>

		<div>

			<div class="col-md-12 col-sm-12" style="margin-top: 20px;">
			</div>
			<div  id="Div_ScoreCardFrame">
				<xsl:variable name="Version">
					<xsl:value-of select="$SettingsXML/BetaVersion"/>
				</xsl:variable>
				<xsl:choose>
					<xsl:when test="$ActiveTab = 'Scorecard'">
						<xsl:value-of select="$DefaultTabHTML" disable-output-escaping="yes"/>
					</xsl:when>
					<xsl:when test="$ActiveTab = 'CoachActivityRollUp'">
						<xsl:value-of select="$DefaultTabHTML" disable-output-escaping="yes"/>
						<!--<script>
							<xsl:text>LoadCoachAdminActivityReport(</xsl:text>
							<xsl:value-of select="$MasterPortalID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$ID"/>
							<xsl:text>, '</xsl:text>
							<xsl:value-of select="$Level"/>
							<xsl:text>', 'Div_ScoreCardFrame',</xsl:text>
							<xsl:value-of select="$LoggedUserID"/>
							<xsl:text>);</xsl:text>
						</script>-->
					</xsl:when>
					<xsl:when test="$ActiveTab = 'Opportunities'">
						<script>
							<xsl:text> LoadSalesActivityRollUp(</xsl:text>
							<xsl:value-of select="$MasterPortalID"></xsl:value-of>
							<xsl:text>, 'Div_ScoreCardFrame','</xsl:text>
							<xsl:value-of select="$ID"></xsl:value-of>
							<xsl:text>', 0, 20, 1, 0,'</xsl:text>
							<xsl:value-of select="$Level"/>
							<xsl:text>');</xsl:text>
						</script>
					</xsl:when>
					<xsl:when test="$ActiveTab = 'Admin'">
						<script>
							<xsl:choose>
								<xsl:when test="$Level='AllPortals'">
									<xsl:text> dashboardAdminMenu(</xsl:text>
									<xsl:value-of select="$MasterPortalID"></xsl:value-of>,
									<xsl:value-of select="$MasterPortalID"></xsl:value-of>
									<xsl:text>);</xsl:text>
								</xsl:when>
								<xsl:when test="$Level='PortalSpecific'">
									<xsl:text> dashboardAdminMenu(</xsl:text>
									<xsl:value-of select="$MasterPortalID"></xsl:value-of>,
									<xsl:value-of select="$ID"></xsl:value-of>
									<xsl:text>);</xsl:text>
								</xsl:when>
							</xsl:choose>
						</script>
					</xsl:when>
					<xsl:when test="$ActiveTab='UserDashboard'">
						<xsl:choose>
							<xsl:when test="$Level='CoachesSpecific'">
								<script>
									<xsl:text>LoadUserDashboard(</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$PortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>,'Div_ScoreCardFrame','</xsl:text>
									<xsl:value-of select="$SettingsXML/ProfileTabs/CoachRollupProfileTabs/Tab/DashboardKey"/>
									<xsl:text>');</xsl:text>
								</script>
							</xsl:when>
						</xsl:choose>
					</xsl:when>

					<xsl:when test="$ActiveTab='ManagerPrograms'">
						<xsl:choose>
							<xsl:when test="count($SettingsXML/ManagerPrograms/Tabs/Tab)&gt;0">
								<xsl:choose>

									<xsl:when test="$Level='PortalSpecific'">


										<script>
											<xsl:text>LoadUserDashboard(</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$ID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$LoggedUserID"/>
											<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
											<xsl:text>'ManagerPrograms');</xsl:text>
										</script>


									</xsl:when>
									<xsl:when test="$Level = 'AllPortals'">


										<script>
											<xsl:text>LoadUserDashboard(</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$ID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$LoggedUserID"/>
											<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
											<xsl:text>'ManagerPrograms');</xsl:text>
										</script>


									</xsl:when>
									<xsl:when test="$Level = 'CoachesSpecific'">
										<script>
											<xsl:text>LoadUserDashboard(</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$ID"/>
											<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
											<xsl:text>'ManagerPrograms');</xsl:text>
										</script>
									</xsl:when>
									<xsl:otherwise>
										<script>
											<xsl:text>LoadUserDashboard(</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$ID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$LoggedUserID"/>
											<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
											<xsl:text>'ManagerPrograms');</xsl:text>
										</script>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:when>

							<xsl:otherwise>
								<xsl:choose>
									<!--<xsl:when test="$Level='AllPortals'">
								<script>
									<xsl:choose>
										<xsl:when test="$Version='3.0'">
											<xsl:text>LoadPortalUserTasks_3_0('</xsl:text>
											<xsl:text>Div_ScoreCardFrame','</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="$LoggedUserID"></xsl:value-of>
											<xsl:text>','</xsl:text>
											<xsl:number value="1"/>
											<xsl:text>','</xsl:text>
											<xsl:text>Header</xsl:text>
											<xsl:text>');</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>LoadPortalUserTasks('</xsl:text>
											<xsl:text>Div_ScoreCardFrame','</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="$LoggedUserID"></xsl:value-of>
											<xsl:text>','</xsl:text>
											<xsl:number value="1"/>
											<xsl:text>','</xsl:text>
											<xsl:text>Header</xsl:text>
											<xsl:text>');</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</script>
							</xsl:when>-->
									<xsl:when test="$Level='PortalSpecific'">

										<script>
											<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
											<xsl:value-of select="$LoggedUserID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$ID"/>
											<xsl:text>,null);</xsl:text>
										</script>

									</xsl:when>
									<xsl:when test="$Level = 'AllPortals'">

										<script>
											<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
											<xsl:value-of select="$LoggedUserID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,null);</xsl:text>
										</script>

									</xsl:when>
									<xsl:otherwise>
										<script>
											<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
											<xsl:value-of select="$ID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>,null);</xsl:text>
										</script>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:when>


					<xsl:when test="$ActiveTab='tasks'">
						<xsl:choose>
							<xsl:when test="$Level='AllPortals'">
								<script>
									<xsl:choose>
										<xsl:when test="$Version >= 3">
											<xsl:text>LoadPortalUserTasks_3_0('</xsl:text>
											<xsl:text>Div_ScoreCardFrame','</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>',null,'</xsl:text>
											<xsl:number value="1"/>
											<xsl:text>','</xsl:text>
											<xsl:text>Header</xsl:text>
											<xsl:text>');</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>LoadPortalUserTasks('</xsl:text>
											<xsl:text>Div_ScoreCardFrame','</xsl:text>
											<xsl:value-of select="$MasterPortalID"/>
											<xsl:text>',null,'</xsl:text>
											<xsl:number value="1"/>
											<xsl:text>','</xsl:text>
											<xsl:text>Header</xsl:text>
											<xsl:text>');</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</script>
							</xsl:when>
							<xsl:when test="$Level='PortalSpecific'">
								<script>
									<xsl:choose>
										<xsl:when test="$Version >= 3">
											<xsl:text>LoadPortalUserTasks_3_0('</xsl:text>
											<xsl:text>Div_ScoreCardFrame','</xsl:text>
											<xsl:value-of select="$ID"/>
											<xsl:text>',null,'</xsl:text>
											<xsl:number value="1"/>
											<xsl:text>','</xsl:text>
											<xsl:text>Header</xsl:text>
											<xsl:text>');</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>LoadPortalUserTasks('</xsl:text>
											<xsl:text>Div_ScoreCardFrame','</xsl:text>
											<xsl:value-of select="$ID"/>
											<xsl:text>',null,'</xsl:text>
											<xsl:number value="1"/>
											<xsl:text>','</xsl:text>
											<xsl:text>Header</xsl:text>
											<xsl:text>');</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</script>
							</xsl:when>
						</xsl:choose>
					</xsl:when>
				</xsl:choose>
			</div>
		</div>
	</xsl:template>


	<xsl:template name="ProfileMenuTabs">
		<xsl:param name="SettingsXML" select="'N/A'"></xsl:param>
		<xsl:param name="MasterPortalID" select="'N/A'"></xsl:param>
		<xsl:param name="ID" select="'N/A'"></xsl:param>
		<xsl:param name="Level" select="'N/A'"></xsl:param>
		<xsl:param name="Action" select="'N/A'"></xsl:param>
		<xsl:param name="PortalID" select="'N/A'"></xsl:param>
		<xsl:param name="LoggedUserID" select="'N/A'"></xsl:param>
		<xsl:variable name="Version">
			<xsl:value-of select="$SettingsXML/BetaVersion"/>
		</xsl:variable>
		<xsl:variable name="MenuTabClass">
			<xsl:choose>
				<xsl:when test="position() = 1">
					<xsl:text>selectedMenuGoalTabs</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>defaultMenuGoal</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="TDIDs">
			<xsl:choose>
				<xsl:when test="Name = 'Scorecard'">
					<xsl:text>cell_Scoreboard_Ad</xsl:text>
				</xsl:when>
				<xsl:when test="Name = 'CoachActivityRollUp'">
					<xsl:text>cell_Activity_Ad</xsl:text>
				</xsl:when>
				<xsl:when test="Name = 'Opportunities'">
					<xsl:text>cell_Opportunities_Ad</xsl:text>
				</xsl:when>
				<xsl:when test="Name = 'Admin'">
					<xsl:text>cell_Admin_Ad</xsl:text>
				</xsl:when>
				<xsl:when test="Name='Numbers'">
					<xsl:text>cell_Numbers_Ad</xsl:text>
				</xsl:when>
				<xsl:when test="Name='Pipeline'">
					<xsl:text>cell_Pipeline_Ad</xsl:text>
				</xsl:when>
				<xsl:when test="Name='Activities'">
					<xsl:text>cell_Activities_Ad</xsl:text>
				</xsl:when>
				<xsl:when test="Name='ManagerPrograms'">
					<xsl:text>cell_ManagerPrograms_Ad</xsl:text>
				</xsl:when>
				<xsl:when test="Name = 'UserDashboard'">
					<xsl:text>cell_</xsl:text>
					<xsl:value-of select="DashboardKey"/>
				</xsl:when>
				<xsl:when test="Name = 'tasks'">
					<xsl:text>cell_Tasks</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="OnClickFunction">
			<xsl:choose>
				<xsl:when test="Name = 'CoachActivityRollUp'">
					<xsl:text>LoadCoachAdminActivityReport(</xsl:text>
					<xsl:value-of select="$MasterPortalID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$ID"/>
					<xsl:text>, '</xsl:text>
					<xsl:value-of select="$Level"/>
					<xsl:text>', 'Div_ScoreCardFrame',</xsl:text>
					<xsl:value-of select="$LoggedUserID"/>
					<xsl:text>);</xsl:text>
				</xsl:when>
				<!--<xsl:when test="Name = 'AllPortalsReport' or Name = 'ClientPortalReport' or Name = 'TeamPortalReport'">
					document.getElementById('Div_ScoreCardFrame').innerHTML = '';
				</xsl:when>-->
				<xsl:when test="Name = 'Scorecard'">
					document.getElementById('Div_ScoreCardFrame').innerHTML = '';
					<xsl:choose>
						<xsl:when test="$Level='AllPortals' or $Level='AllPortalsClient'">
							<xsl:text>LoadScoreCard_3_0(</xsl:text>
							<xsl:value-of select="$MasterPortalID"></xsl:value-of>
							<xsl:text>,null,null,null,'Div_ScoreCardFrame');</xsl:text>
						</xsl:when>
						<xsl:when test="$Level='PortalSpecific' or $Level='PortalSpecificClient' or $Level = 'CoachesSpecific_Selected'">
							<xsl:text>LoadScoreCard_3_0(</xsl:text>
							<xsl:value-of select="$MasterPortalID"></xsl:value-of>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$ID"/>
							<xsl:text>,null,null,'Div_ScoreCardFrame');</xsl:text>
						</xsl:when>

						<xsl:otherwise>
							<xsl:text>LoadActivityDashboard_ScoreCardFrame('</xsl:text>
							<xsl:value-of select="$MasterPortalID"></xsl:value-of>
							<xsl:text>','Div_ScoreCardFrame','</xsl:text>
							<xsl:value-of select="$Level"></xsl:value-of>
							<xsl:text>','</xsl:text>
							<xsl:value-of select="$ID"/>
							<xsl:text>','Monthly');</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:when test="Name = 'Opportunities'">
					<xsl:text> LoadSalesActivityRollUp(</xsl:text>
					<xsl:value-of select="$MasterPortalID"></xsl:value-of>
					<xsl:text>, 'Div_ScoreCardFrame','</xsl:text>
					<xsl:value-of select="$ID"></xsl:value-of>
					<xsl:text>', 0, 20, 1, 0,'</xsl:text>
					<xsl:value-of select="$Level"/>
					<xsl:text>');</xsl:text>
				</xsl:when>
				<xsl:when test="Name = 'Admin'">
					<xsl:choose>
						<xsl:when test="$Level='AllPortals'">
							<xsl:text> dashboardAdminMenu(</xsl:text>
							<xsl:value-of select="$MasterPortalID"></xsl:value-of>,
							<xsl:value-of select="$MasterPortalID"></xsl:value-of>
							<xsl:text>);</xsl:text>
						</xsl:when>
						<xsl:when test="$Level='PortalSpecific'">
							<xsl:text> dashboardAdminMenu(</xsl:text>
							<xsl:value-of select="$MasterPortalID"></xsl:value-of>,
							<xsl:value-of select="$ID"></xsl:value-of>
							<xsl:text>);</xsl:text>
						</xsl:when>
					</xsl:choose>
				</xsl:when>
				<xsl:when test="Name='Numbers'">
					<xsl:text>	LoadDashboar_3_0(</xsl:text>
					<xsl:value-of select="$MasterPortalID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$PortalID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$ID"/>
					<xsl:text>, null, 'Div_ScoreCardFrame', 'MyNumbersDashboard', null, 1,null, null);</xsl:text>
				</xsl:when>
				<xsl:when test="Name='Pipeline'">
					<xsl:text>	LoadDashboar_3_0(</xsl:text>
					<xsl:value-of select="$MasterPortalID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$PortalID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$ID"/>
					<xsl:text>, null, 'Div_ScoreCardFrame', 'portal_LoadMyPipeline', null, 1,null, null);</xsl:text>
				</xsl:when>
				<xsl:when test="Name='Activities'">
					<xsl:text>	LoadDashboar_3_0(</xsl:text>
					<xsl:value-of select="$MasterPortalID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$PortalID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$ID"/>
					<xsl:text>, null, 'Div_ScoreCardFrame', 'MyActivityDashboard', null, 1,null, null);</xsl:text>
				</xsl:when>
				<xsl:when test="Name='ManagerPrograms'">
					<xsl:choose>
						<xsl:when test="count($SettingsXML/ManagerPrograms/Tabs/Tab)&gt;0">
							<xsl:choose>
								<xsl:when test="$Level='PortalSpecific'">
									<xsl:text>LoadUserDashboard(</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$LoggedUserID"/>
									<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
									<xsl:text>'ManagerPrograms');</xsl:text>
								</xsl:when>
								<xsl:when test="$Level = 'AllPortals'">
									<xsl:text>LoadUserDashboard(</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$LoggedUserID"/>
									<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
									<xsl:text>'ManagerPrograms');</xsl:text>
								</xsl:when>
								<xsl:when test="$Level = 'CoachesSpecific'">
									<xsl:text>LoadUserDashboard(</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
									<xsl:text>'ManagerPrograms');</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>LoadUserDashboard(</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$LoggedUserID"/>
									<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
									<xsl:text>'ManagerPrograms');</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="$Level='PortalSpecific'">
									<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
									<xsl:value-of select="$LoggedUserID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>,null);</xsl:text>
								</xsl:when>
								<xsl:when test="$Level = 'AllPortals'">
									<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
									<xsl:value-of select="$LoggedUserID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,null);</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>,null);</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>

					<!--<xsl:choose>
						<xsl:when test="$Level='PortalSpecific'">


							<script>
								<xsl:text>LoadUserDashboard(</xsl:text>
								<xsl:value-of select="$MasterPortalID"/>
								<xsl:text>,</xsl:text>
								<xsl:value-of select="$ID"/>
								<xsl:text>,</xsl:text>
								<xsl:value-of select="$LoggedUserID"/>
								<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
								<xsl:text>'ManagerPrograms');</xsl:text>
							</script>


						</xsl:when>
						<xsl:when test="$Level = 'AllPortals'">


							<script>
								<xsl:text>LoadUserDashboard(</xsl:text>
								<xsl:value-of select="$MasterPortalID"/>
								<xsl:text>,</xsl:text>
								<xsl:value-of select="$ID"/>
								<xsl:text>,</xsl:text>
								<xsl:value-of select="$LoggedUserID"/>
								<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
								<xsl:text>'ManagerPrograms');</xsl:text>
							</script>


						</xsl:when>
						<xsl:otherwise>
							<script>
								<xsl:text>LoadUserDashboard(</xsl:text>
								<xsl:value-of select="$MasterPortalID"/>
								<xsl:text>,</xsl:text>
								<xsl:value-of select="$ID"/>
								<xsl:text>,</xsl:text>
								<xsl:value-of select="$LoggedUserID"/>
								<xsl:text>,'Div_ScoreCardFrame',</xsl:text>
								<xsl:text>'ManagerPrograms');</xsl:text>
							</script>
						</xsl:otherwise>
						-->
					<!--<xsl:when test="$Level='CoachesSpecific'">
							xsl:when test="$Level='CoachesSpecific'">
							<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
							<xsl:value-of select="$ID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$MasterPortalID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$MasterPortalID"/>
							<xsl:text>,null);</xsl:text>-->
					<!--
						-->
					<!--</xsl:when>
						<xsl:when test="$Level='AllPortals'">
							<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
							<xsl:value-of select="$LoggedUserID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$MasterPortalID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$MasterPortalID"/>
							<xsl:text>,null);</xsl:text>
						</xsl:when>
						<xsl:when test="$Level='PortalSpecific'">
							<xsl:text>loadManagerPrograms('Div_ScoreCardFrame',</xsl:text>
							<xsl:value-of select="$LoggedUserID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$MasterPortalID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$ID"/>
							<xsl:text>,null);</xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>alert("This case is not handled");</xsl:text>
						</xsl:otherwise>-->
					<!--
					</xsl:choose>-->
				</xsl:when>
				<xsl:when test="Name = 'tasks'">

					<xsl:choose>
						<xsl:when test="$Level='AllPortals'">
							<xsl:choose>
								<xsl:when test="$Version >= 3">
									<xsl:text>LoadPortalUserTasks_3_0('</xsl:text>
									<xsl:text>Div_ScoreCardFrame','</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>',null,'</xsl:text>
									<xsl:number value="1"/>
									<xsl:text>','</xsl:text>
									<xsl:text>Header</xsl:text>
									<xsl:text>');</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>LoadPortalUserTasks('</xsl:text>
									<xsl:text>Div_ScoreCardFrame','</xsl:text>
									<xsl:value-of select="$MasterPortalID"/>
									<xsl:text>',null,'</xsl:text>
									<xsl:number value="1"/>
									<xsl:text>','</xsl:text>
									<xsl:text>Header</xsl:text>
									<xsl:text>');</xsl:text>
								</xsl:otherwise>
							</xsl:choose>

						</xsl:when>
						<xsl:when test="$Level='PortalSpecific'">
							<xsl:choose>
								<xsl:when test="$Version >= 3">
									<xsl:text>LoadPortalUserTasks_3_0('</xsl:text>
									<xsl:text>Div_ScoreCardFrame','</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>',null,'</xsl:text>
									<xsl:number value="1"/>
									<xsl:text>','</xsl:text>
									<xsl:text>Header</xsl:text>
									<xsl:text>');</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>LoadPortalUserTasks('</xsl:text>
									<xsl:text>Div_ScoreCardFrame','</xsl:text>
									<xsl:value-of select="$ID"/>
									<xsl:text>',null,'</xsl:text>
									<xsl:number value="1"/>
									<xsl:text>','</xsl:text>
									<xsl:text>Header</xsl:text>
									<xsl:text>');</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
					</xsl:choose>

				</xsl:when>
				<xsl:when test="Name = 'UserDashboard'">
					<xsl:choose>
						<xsl:when test="$Level='CoachesSpecific'">
							<xsl:text>LoadUserDashboard(</xsl:text>
							<xsl:value-of select="$MasterPortalID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$PortalID"/>
							<xsl:text>,</xsl:text>
							<xsl:value-of select="$ID"/>
							<xsl:text>,'Div_ScoreCardFrame','</xsl:text>
							<xsl:value-of select="DashboardKey"/>
							<xsl:text>');</xsl:text>
						</xsl:when>
					</xsl:choose>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>

		<td width="10.625%" id="{$TDIDs}" class="textCenter verticallyMiddle {$MenuTabClass} padding2"
                    name="GoalMenuAction" onClick="{$OnClickFunction} goal_HightlightSelectedLink('{$TDIDs}','defaultMenuGoal','selectedMenuGoalTabs','GoalMenuAction',0);">
			<span id="span_Goals" class="onMouseOver" >

				<xsl:choose>
					<xsl:when test="DisplayName and DisplayName != ''">
						<xsl:value-of select="DisplayName"/>
					</xsl:when>
					<xsl:when test="Name = 'goals'">
						<xsl:text>Programs</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="Name"/>
					</xsl:otherwise>
				</xsl:choose>
			</span>
		</td>
	</xsl:template>
</xsl:stylesheet>
