﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
	<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

	<xsl:template match="/">
		<xsl:variable name="AjaxRequest" select="AjaxRequest/."></xsl:variable>
		<xsl:variable name="MasterPortalItemID" select="AjaxRequest/Params/MasterPortalItemID"></xsl:variable>
		<xsl:variable name="AllPortal" select="$AjaxRequest/UserBrands"></xsl:variable>
		<xsl:variable name="Goals" select="$AjaxRequest/Goals"></xsl:variable>
		<xsl:variable name="User" select="$AjaxRequest/Users"></xsl:variable>
		<xsl:variable name="PeriodKeyXML" select="$AjaxRequest/PeriodKeyXML"></xsl:variable>
		<xsl:variable name="TemplateItemID" select="$AjaxRequest/Params/TemplateItemID"></xsl:variable>
		<xsl:variable name="GoalItemID" select="$AjaxRequest/Params/GoalItemID"></xsl:variable>
		<xsl:variable name="DBRange" select="$AjaxRequest/Params/DBRange"></xsl:variable>
		<xsl:variable name="DefaultMetric" select="$AjaxRequest/Metrics/Metric[(InputType != 'Label' and InputType != 'None') or not(InputType)]/MetricKey"></xsl:variable>
		<xsl:variable name="DefaultMetricDisplay" select="$AjaxRequest/Metrics/Metric[(InputType != 'Label' and InputType != 'None') or not(InputType)]/MetricKeyDisplay"></xsl:variable>
		<xsl:variable name="DefaultMetricID" select="$AjaxRequest/Metrics/Metric[(InputType != 'Label' and InputType != 'None') or not(InputType)]/PortalMetricID"></xsl:variable>
		<xsl:variable name="Action" select="$AjaxRequest/Action"></xsl:variable>
		<xsl:variable name="GoalPortalItemID" select="$AjaxRequest/GoalPortalItemID"></xsl:variable>
		<xsl:variable name="LoggedInUserID" select="$AjaxRequest/LoggedInUserID"></xsl:variable>
		<xsl:variable name="GoalResponsible" select="$AjaxRequest/GoalResponsible/."></xsl:variable>
		<xsl:variable name="DivID" select="$AjaxRequest/Params/divID"></xsl:variable>
		<xsl:variable name="Classification" select="AjaxRequest/Params/Classification"></xsl:variable>
		<xsl:variable name="AllowGoalAddition" select="AjaxRequest/Params/AllowGoalAddition"></xsl:variable>
		<xsl:variable name="IsGoalCoach">
			<xsl:choose>
				<xsl:when test="$GoalResponsible/Responsible[ID = $LoggedInUserID and Role='Coach']">
					<xsl:number value="1"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:number value="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="UserID">
			<xsl:choose>
				<xsl:when test="$AjaxRequest/Params/UserID != ''" >
					<xsl:value-of select="$AjaxRequest/Params/UserID"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>null</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="PortalItemID">
			<xsl:choose>
				<xsl:when test="not($AjaxRequest/Params/PortalItemID) or $AjaxRequest/Params/PortalItemID!=''" >
					<xsl:value-of select="$AjaxRequest/Params/PortalItemID"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>null</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="FilterLoadFunc">
			<xsl:choose>
				<xsl:when test="$Action = 'LoadMyNumbersDashboard_3_0_Goal'">
					<xsl:text>LoadMyNumbersDashboard_3_0_Goal(</xsl:text>
					<xsl:value-of select="$MasterPortalItemID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$GoalItemID"/>
					<xsl:text> ,'</xsl:text>
					<xsl:value-of select="$AjaxRequest/Params/divID"/>
					<xsl:text>');</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>LoadMyNumbersDashboard_3_0_Data(</xsl:text>
					<xsl:value-of select="$AjaxRequest/Params/MasterPortalItemID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$PortalItemID"/>
					<xsl:text>,</xsl:text>
					<xsl:value-of select="$UserID"/>
					<xsl:text> ,'</xsl:text>
					<xsl:value-of select="$AjaxRequest/Params/divID"/>
					<xsl:text>');</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="GoalPickListDisplay">
			<xsl:choose>
				<xsl:when test="$Action = 'LoadMyNumbersDashboard_3_0_Goal'">
					<xsl:text>display:none;</xsl:text>
				</xsl:when>
				<xsl:otherwise></xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="GoalUserPickListDisplay">
			<xsl:choose>
				<xsl:when test="$Action = 'LoadMyNumbersDashboard_3_0_Goal' and $IsGoalCoach = 1">
					<xsl:text></xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>display:none;</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="GoalCount">
			<xsl:value-of select="	count($Goals/Items/Item[SuccessKey = 'Number'])"></xsl:value-of>
		</xsl:variable>
		<xsl:variable name="ShowDashboard">
			<xsl:choose>
				<xsl:when test="$GoalItemID !=''">
					<xsl:text>Yes</xsl:text>
				</xsl:when>
				<xsl:when test="$GoalCount &gt; 0">
					<xsl:text>Yes</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>No</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="scoreCardFilter">
			<xsl:text>
			portal_LoadMyScoreboard_3_0('divMyNumberDBCompiledNumbers', 'Monthly', </xsl:text>
			<xsl:value-of select="$MasterPortalItemID"/>
			<xsl:text>,'optMyNumbersDBPortal_ScoreCard', 'optMyNumberGoals_ScoreCard', 'optMyNumbersDBUser_ScoreCard','optMyNumbersDBTemplate','optMyNumbersDBDateRange_ScoreCard');</xsl:text>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="$ShowDashboard='Yes'">
				<div class="col-sm-12 col-md-12 RiteTxt A" style="padding:10px 0;">
					<div class="col-md-12 dropdown_txt pull-left">
						<div id="divTotalFilter">
							<div class="col-md-3 col-sm-3 col-xs-6 margnbtm5" style="{$GoalPickListDisplay}">
								<select class="form-control" id="optMyNumberGoals" onchange="{$FilterLoadFunc} getSelectedAlternalteDropdown('optMyNumberGoals', 'optMyNumberGoals_ScoreCard');">
									<xsl:choose>
										<xsl:when test="count($Goals/Items/Item[SuccessKey = 'Number']) &gt; 0">
											<xsl:for-each select="$Goals/Items/Item[SuccessKey = 'Number']">
												<xsl:choose>
													<xsl:when test="$GoalItemID=ItemID">
														<option value="{ItemID}" selected="">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:when>
													<xsl:otherwise>
														<option value="{ItemID}">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</xsl:when>
										<xsl:when test="$Action = 'LoadMyNumbersDashboard_3_0_Goal'">
											<option value="{$GoalItemID}"></option>
										</xsl:when>
										<xsl:otherwise>
											<option value="-99"></option>
										</xsl:otherwise>
									</xsl:choose>
								</select>
							</div>
							<div class="col-md-3 col-sm-3 col-xs-6 margnbtm5">
								<select class="form-control" id="optMyNumbersDBDateRange" onchange="{$FilterLoadFunc} getSelectedAlternalteDropdown('optMyNumbersDBDateRange', 'optMyNumbersDBDateRange_ScoreCard');">
									<xsl:for-each select="$PeriodKeyXML/PeriodKey">
										<xsl:choose>
											<xsl:when test="$DBRange=PeriodKey">
												<option value="{PeriodKey}" selected="">
													<xsl:value-of select="DateRange"/>
												</option>
											</xsl:when>
											<xsl:otherwise>
												<option value="{PeriodKey}">
													<xsl:value-of select="DateRange"/>
												</option>
											</xsl:otherwise>
										</xsl:choose>

									</xsl:for-each>
								</select>
							</div>

							<div  class="valueSD1 col-md-3 col-sm-3 col-xs-6">
								<xsl:choose>
									<xsl:when test="$Action != 'LoadMyNumbersDashboard_3_0_Goal'">
										<select class="form-control" id="optMyNumbersDBPortal" onchange="{$FilterLoadFunc} getSelectedAlternalteDropdown('optMyNumbersDBPortal', 'optMyNumbersDBPortal_ScoreCard');">
											<xsl:if test="$AjaxRequest/Params/PortalItemID = '' or ItemID = $MasterPortalItemID">
												<option value="{$MasterPortalItemID}">
													All
												</option>
											</xsl:if>
											<xsl:for-each select="$AllPortal/Brand[ItemID != $MasterPortalItemID]">
												<xsl:choose>
													<xsl:when test="$AjaxRequest/Params/SelectedPortalItemID=ItemID">
														<option value="{ItemID}" selected="">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:when>
													<xsl:when test="$AjaxRequest/Params/PortalItemID=ItemID">
														<option value="{ItemID}" selected="">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:when>
													<xsl:otherwise>
														<option value="{ItemID}" >
															<xsl:value-of select="Item"/>
														</option>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</select>
									</xsl:when>
									<xsl:otherwise>
										<select id="optMyNumbersDBPortal" style="display:none;">
											<option value="{$GoalPortalItemID}">
											</option>
										</select>
										<!--<input type="hidden" id="optMyNumbersDBPortal"  value="{$GoalPortalItemID}" />-->
									</xsl:otherwise>
								</xsl:choose>


							</div>

							<div class="" style="{$GoalUserPickListDisplay} float:left">
								<select class="form-control" id="optMyNumbersDBUser" onchange="{$FilterLoadFunc} getSelectedAlternalteDropdown('optMyNumbersDBUser', 'optMyNumbersDBUser_ScoreCard');">
									<xsl:choose>
										<xsl:when test="$Action = 'LoadMyNumbersDashboard_3_0_Goal' and $IsGoalCoach = 1">
											<xsl:if test="count($GoalResponsible/Responsible[Role='Participant' or Participant = 1]) &gt; 1">
												<option value="-99">
													--Select--
												</option>
											</xsl:if>
											<xsl:for-each select="$GoalResponsible/Responsible[Role='Participant' or Participant = 1]">
												<xsl:choose>
													<xsl:when test="$UserID = ID">
														<option value="{ID}" 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>
										</xsl:when>
										<xsl:otherwise>
											<xsl:choose>
												<xsl:when test="$UserID = 'null'">
													<option value="{$LoggedInUserID}">
														<xsl:text>Me</xsl:text>
													</option>
												</xsl:when>
												<xsl:otherwise>
													<option value="{$UserID}">
														<xsl:text>Me</xsl:text>
													</option>
												</xsl:otherwise>
											</xsl:choose>

										</xsl:otherwise>
									</xsl:choose>
								</select>
							</div>
						</div>
						<div id="divScoreCardFilter" style="display:none">
							<div class="col-md-3 col-sm-3 col-xs-6 margnbtm5" style="{$GoalPickListDisplay}">
								<select class="form-control" id="optMyNumberGoals_ScoreCard" onchange="{$scoreCardFilter} getSelectedAlternalteDropdown('optMyNumberGoals_ScoreCard', 'optMyNumberGoals');">
									<xsl:choose>
										<xsl:when test="count($Goals/Items/Item[SuccessKey = 'Number']) &gt; 0">
											<xsl:for-each select="$Goals/Items/Item[SuccessKey = 'Number']">
												<xsl:choose>
													<xsl:when test="$GoalItemID=ItemID">
														<option value="{ItemID}" selected="">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:when>
													<xsl:otherwise>
														<option value="{ItemID}">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</xsl:when>
										<xsl:when test="$Action = 'LoadMyNumbersDashboard_3_0_Goal'">
											<option value="{$GoalItemID}"></option>
										</xsl:when>
										<xsl:otherwise>
											<option value="-99"></option>
										</xsl:otherwise>
									</xsl:choose>

								</select>
							</div>

							<div class="col-md-3 col-sm-3 col-xs-6 margnbtm5">
								<select class="form-control" id="optMyNumbersDBDateRange_ScoreCard" onchange="{$scoreCardFilter} getSelectedAlternalteDropdown('optMyNumbersDBDateRange_ScoreCard', 'optMyNumbersDBDateRange');">
									<xsl:for-each select="$PeriodKeyXML/PeriodKey">
										<xsl:choose>
											<xsl:when test="$DBRange=PeriodKey">
												<option value="{PeriodKey}" selected="">
													<xsl:value-of select="DateRange"/>
												</option>
											</xsl:when>
											<xsl:otherwise>
												<option value="{PeriodKey}">
													<xsl:value-of select="DateRange"/>
												</option>
											</xsl:otherwise>
										</xsl:choose>

									</xsl:for-each>
								</select>
							</div>

							<div  class="valueSD1 col-md-3 col-sm-3 col-xs-6">
								<xsl:choose>
									<xsl:when test="$Action != 'LoadMyNumbersDashboard_3_0_Goal'">
										<select class="form-control" id="optMyNumbersDBPortal_ScoreCard" onchange="{$scoreCardFilter} getSelectedAlternalteDropdown('optMyNumbersDBPortal_ScoreCard', 'optMyNumbersDBPortal');">
											<xsl:if test="$AjaxRequest/Params/PortalItemID = '' or ItemID = $MasterPortalItemID">
												<option value="{$MasterPortalItemID}">
													All
												</option>
											</xsl:if>
											<xsl:for-each select="$AllPortal/Brand[ItemID != $MasterPortalItemID]">
												<xsl:choose>
													<xsl:when test="$AjaxRequest/Params/SelectedPortalItemID=ItemID">
														<option value="{ItemID}" selected="">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:when>
													<xsl:when test="$AjaxRequest/Params/PortalItemID=ItemID">
														<option value="{ItemID}" selected="">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:when>
													<xsl:otherwise>
														<option value="{ItemID}" >
															<xsl:value-of select="Item"/>
														</option>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</select>
									</xsl:when>
									<xsl:otherwise>
										<select id="optMyNumbersDBPortal_ScoreCard" style="display:none">
											<option value="{$GoalPortalItemID}"></option>
										</select>
										<!--<input type="hidden" id="optMyNumbersDBPortal_ScoreCard"  value="{$GoalPortalItemID}"/>-->
									</xsl:otherwise>
								</xsl:choose>
							</div>
							<div class="" style="{$GoalUserPickListDisplay} float:left">
								<select class="form-control" id="optMyNumbersDBUser_ScoreCard" onchange="{$scoreCardFilter} getSelectedAlternalteDropdown('optMyNumbersDBUser_ScoreCard', 'optMyNumbersDBUser');">
									<xsl:choose>
										<xsl:when test="$Action = 'LoadMyNumbersDashboard_3_0_Goal' and $IsGoalCoach = 1">
											<xsl:if test="count($GoalResponsible/Responsible[Role='Participant' or Participant = 1]) &gt; 1">
												<option value="-99">
													--Select--
												</option>
											</xsl:if>
											<xsl:for-each select="$GoalResponsible/Responsible[Role='Participant' or Participant = 1]">
												<xsl:choose>
													<xsl:when test="$UserID = ID">
														<option value="{ID}" 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>
										</xsl:when>
										<xsl:otherwise>
											<xsl:choose>
												<xsl:when test="$UserID = 'null'">
													<option value="{$LoggedInUserID}">
														<xsl:text>Me</xsl:text>
													</option>
												</xsl:when>
												<xsl:otherwise>
													<option value="{$UserID}">
														<xsl:text>Me</xsl:text>
													</option>
												</xsl:otherwise>
											</xsl:choose>

										</xsl:otherwise>
									</xsl:choose>
								</select>
							</div>
						</div>
						<xsl:variable name="FuncMyNumberDBCompliedNumbersTotalGrid">
							<xsl:text>	LoadMyNumbersDashboardCompiledMetrics_3_0(</xsl:text>
							<xsl:value-of select="$MasterPortalItemID"/>
							<xsl:text>, 'optMyNumbersDBPortal', 'optMyNumberGoals', 'optMyNumbersDBUser'	, null, 'optMyNumbersDBDateRange', 'MyNumbersDashboard','divMyNumberDBCompiledNumbers');</xsl:text>
						</xsl:variable>
						<div class="totalscore">
							<span id="spanTotalGrid" class="onMouseOver active1" onclick="{$FuncMyNumberDBCompliedNumbersTotalGrid} $('#spanTotalGrid').addClass('active1');$('#spanScorecardGrid').removeClass('active1');
								  $('#divScoreCardFilter').css('display','none');$('#divTotalFilter').css('display','block');">Totals</span> | <span class="onMouseOver"
									onclick="{$scoreCardFilter} $('#spanTotalGrid').removeClass('active1');$('#spanScorecardGrid').addClass('active1');
									$('#divScoreCardFilter').css('display','block');$('#divTotalFilter').css('display','none');" id="spanScorecardGrid">Scorecard</span>
						</div>
					</div>
					<xsl:variable name="FuncMyNumberDBCompliedNumbers">
						<xsl:text>	LoadMyNumbersDashboardCompiledMetrics_3_0(</xsl:text>
						<xsl:value-of select="$MasterPortalItemID"/>
						<xsl:text>, 'optMyNumbersDBPortal', 'optMyNumberGoals', 'optMyNumbersDBUser'	, null, 'optMyNumbersDBDateRange', 'MyNumbersDashboard','divMyNumberDBCompiledNumbers');</xsl:text>
					</xsl:variable>
					<div class="col-md-12 white-bg-new A Featurd">
						<div class="box inner light-gray" style="background: #f6f6f6;border: 1px solid #e9e9e9;">
							<div class="row-fluid padded0">
								<div class="section-title ">
									<p style="100%">
										<span style="width:60%">
											FEATURED METRICS
											<span class="glyphicon glyphicon-refresh onMouseOver" style="margin-left: 5px;"
												  onclick="{$FuncMyNumberDBCompliedNumbers}" title="Refresh"></span>
										</span>
									</p>
								</div>
								<div id="divMyNumberDBCompiledNumbers">
									<script>
										<xsl:value-of select="$FuncMyNumberDBCompliedNumbers"/>
									</script>
								</div>
							</div>
						</div>
					</div>
					<!--Middle Page End-->
					<!--Graph Start-->
					<div class="col-md-12 col-sm-12 pull-left">
						<div class="box bordered">
							<div class="row-fluid" id="divGraph">
								<div class="col-md-5">
									<xsl:choose>
										<xsl:when test="$Action = 'LoadMyNumbersDashboard_3_0_Goal' 
										  and $IsGoalCoach = 1 
										  and $UserID = 'null'
										  and count($GoalResponsible/Responsible[Role='Participant']) &gt; 1">
											<div class="section-title">Leaderboard</div>
											<div id="divNumbersLeaderBoard" class="NLeaderBoard">
												<xsl:choose>
													<xsl:when test="$DefaultMetric[text()]">
														<script>
															getReportingDashboardLeaderboard_3_0_Goal('optMyNumbersDBDateRange'
															, 'optMyNumbersDBUser', '<xsl:value-of select="$DefaultMetric"/>', 'divNumbersLeaderBoard'
															, 'ReportingNumberGraph3_0', 0, 10, 1, <xsl:value-of select="$GoalPortalItemID"/>
															, <xsl:value-of select="$GoalItemID"/>)
														</script>
													</xsl:when>
												</xsl:choose>
											</div>
										</xsl:when>
										<xsl:otherwise>
											<div class="section-title">My Numbers</div>
											<div id="divNumbersLeaderBoard" class="slidxs">
												<xsl:choose>
													<xsl:when test="$DefaultMetric !=''">
														<script>
															goalNumberDataEntryPanel('optMyNumberGoals','1','1','optMyNumbersDBUser','','divNumbersLeaderBoard', <xsl:value-of select="$MasterPortalItemID"/>);
														</script>
													</xsl:when>
												</xsl:choose>
											</div>
										</xsl:otherwise>
									</xsl:choose>
								</div>

								<div class="col-md-7">
									<div class="section-title" id="MetricTitle">
										<span id="spanNumberGraphMetric" defaultMetric="{$DefaultMetric}">
											<xsl:value-of select="$DefaultMetricDisplay"/>
										</span>
										<xsl:variable name="FuncNumberGraph">
											<xsl:text>LoadMyNumbersDashboardGraph_3_0_Refresh(</xsl:text>
											<xsl:value-of select="$MasterPortalItemID"/>
											<xsl:text>,'optMyNumbersDBPortal', 'optMyNumberGoals', 'optMyNumbersDBUser'
									, null, 'optMyNumbersDBDateRange', 'divNumbersGraph', 'spanNumberGraphMetric');</xsl:text>
										</xsl:variable>
										<span class="glyphicon glyphicon-refresh onMouseOver" style="margin-left: 5px;"
												  onclick="{$FuncNumberGraph}" title="Refresh"></span>
									</div>
									<div id="divNumbersGraph" class="chart" style="width: 100%; height: 330px; padding: 0px; position: relative;">
										<xsl:choose>
											<xsl:when test="$DefaultMetric !=''">
												<script>
													LoadMyNumbersDashboardGraph_3_0(<xsl:value-of select="$MasterPortalItemID"/>
													, 'optMyNumbersDBPortal', 'optMyNumberGoals', 'optMyNumbersDBUser'
													, null, 'optMyNumbersDBDateRange', 'divNumbersGraph', '<xsl:value-of select="$DefaultMetric"/>');
												</script>
											</xsl:when>
										</xsl:choose>
									</div>
									<div class="section-title ">
										<p style="100%">
											<span style="width:60%">
												Check-in
											</span>
										</p>
									</div>
									<div class="well" id="divGoalNotes" style="width: 100%;padding-bottom:10px;margin-top:10px;height:auto;display: inline-block;" GoalItemID="{$GoalItemID}">

										<xsl:choose>
											<xsl:when test="$DefaultMetric !=''">
												<script>

													loadAddNoteAtGoalLevel_3_0('<xsl:value-of select="$MasterPortalItemID"></xsl:value-of>', '<xsl:value-of select="$LoggedInUserID"></xsl:value-of>', 'divGoalNotes', 'optMyNumberGoals')

													<!--GetItemNotes_ForVersion('<xsl:value-of select="$GoalItemID"></xsl:value-of>',"divGoalNotes", "5");-->
												</script>
											</xsl:when>
										</xsl:choose>
									</div>
									<div class="container" id="SuccessfullyAddedNote" style="display:none;width:100%;">

										<div class="alert alert-success">
											<strong>Success!</strong> Your message has been saved to the notes section of this program.
										</div>

									</div>


								</div>
							</div>
						</div>
					</div>
				</div>
			</xsl:when>
			<xsl:otherwise>
				<xsl:choose>
					<xsl:when test="$AllowGoalAddition != 0">
						<xsl:variable name="OnClickAddProgram">
							<xsl:choose>
								<xsl:when test="$PortalItemID= 'null'">
									<xsl:text>getUserAndPortalDetailsByPortalID(</xsl:text>
									<xsl:value-of select="$MasterPortalItemID"/>
									<xsl:text>, null, 'Number', 'divAddProgram_BusinessPlan');</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>baseBrandAutoSuggest_selectAutoSuggetData('</xsl:text>
									<xsl:value-of select="$PortalItemID"/>
									<xsl:text>','</xsl:text>
									<xsl:value-of select="$UserID"/>
									<xsl:text>', 'N/A', 'PortalAddGoalWizardForSelectedUser', 'divAddProgram_BusinessPlan','-99','-99','MarkAutoSuggestDataSelected_3_0','Number','Number');</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<div id="divUserGoalForTemplate" style="padding: 4px;">
							<input type="hidden" onClick="LoadMyNumbersDashboard_3_0_Data({$MasterPortalItemID},{$PortalItemID}, {$UserID}, '{$DivID}','{$Classification}');" id="divMyNumberDashboard_Refresh"/>
							<div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray adbtn"
											 style="width:150px;line-height:30px;text-align:center;float:left;margin-bottom: 4px;"
											 onclick="$('#divUserGoalForTemplate').css('display','none');
							$('#divAddProgram_BusinessPlan').css('display','inline-block');{$OnClickAddProgram}">
								<span class="glyphicon glyphicon-plus">
									<xsl:text> </xsl:text>
								</span>

								<span id="span_Cancel">
									<xsl:text>ADD PROGRAM</xsl:text>
								</span>
							</div>
						</div>
					</xsl:when>
					<xsl:otherwise>
						<xsl:text>No program available</xsl:text>
					</xsl:otherwise>
				</xsl:choose>
				<div style="display:none;" id="divAddProgram_BusinessPlan"></div>
			</xsl:otherwise>
		</xsl:choose>

	</xsl:template>
</xsl:stylesheet>
