﻿<?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 ="../Version_2_0/GoalActions.xslt"/>
	<xsl:import href="../Version_2_0/CompiledNumberGoalData.xslt"/>
	<xsl:import href="../Version_2_0/CompiledNumberGoalIndividualDataTemplate.xslt"/>
	<xsl:import href="../Version_2_0/GoalUsersLeaderboard.xslt"/>
	<xsl:import href="../Version_2_0/GroupChallenge/FBDiscussions.xslt"/>
	<xsl:import href="../Version_2_0/GoalMediaList.xslt"/>
	<xsl:import href="../GenericTemplates/StringReplace.xslt"/>

	<xsl:output method="xml" indent="yes" omit-xml-declaration ="yes"/>

	<xsl:key name="distinctPeriodType" match="AjaxRequest/NumberGoalDataXML/Metrics/Metric" use="./PeriodType"></xsl:key>
	<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
	<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

	<xsl:decimal-format name="format1" decimal-separator='.' grouping-separator=',' />
	<xsl:decimal-format name="format2" decimal-separator=',' grouping-separator='.' />

	<xsl:template match="/">
		<xsl:variable name="Action" select="AjaxRequest/Action"></xsl:variable>
		<xsl:variable name="TemplateURL" select="AjaxRequest/TemplateURL"></xsl:variable>
		<xsl:variable name="HostName" select="AjaxRequest/HostName"></xsl:variable>
		<xsl:variable name="GoalItemID" select="AjaxRequest/GoalProgressDetail/Item/GoalItemID"></xsl:variable>
		<xsl:variable name="OfWhat" select="AjaxRequest/GoalProgressDetail/Item/GoalNumberMeasure"></xsl:variable>
		<xsl:variable name="Track" select="AjaxRequest/GoalProgressDetail/Item/GoalNumberTracking"></xsl:variable>
		<xsl:variable name="GoalStart" select="AjaxRequest/GoalProgressDetail/Item/GoalNumberStart"></xsl:variable>
		<xsl:variable name="GoalDirection" select="AjaxRequest/GoalProgressDetail/Item/GoalNumberDirection"></xsl:variable>
		<xsl:variable name="Updating" select="AjaxRequest/GoalProgressDetail/Item/GoalMetricsUpdate"></xsl:variable>
		<xsl:variable name="LastAmount" select="AjaxRequest/GoalProgressDetail/Item/LastAmount"></xsl:variable>
		<xsl:variable name="TotalAmount" select="AjaxRequest/GoalProgressDetail/Item/GoalNumber"></xsl:variable>
		<xsl:variable name="Format" select="AjaxRequest/GoalProgressDetail/Item/GoalNumberFormat"></xsl:variable>
		<xsl:variable name="OldPeriodKey" select="AjaxRequest/GoalProgressDetail/Item/PeriodKey"></xsl:variable>
		<xsl:variable name="CurrentAmount" select="round(AjaxRequest/GoalProgressDetail/Item/CurrentAmount)">
		</xsl:variable>
		<xsl:variable name="TotalAcheivedAmount">
			<xsl:choose>
				<xsl:when test="string(number($CurrentAmount))!='NaN'">
					<xsl:value-of select="round($CurrentAmount + $LastAmount + $GoalStart)"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="round($LastAmount + $GoalStart)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="RemainingAmount" select ="round($TotalAmount - $TotalAcheivedAmount)"/>
		<xsl:variable name="WeeklyDataValue" select="round(AjaxRequest/GoalProgressDetail/Item/WeeklyDataValue)"></xsl:variable>
		<xsl:variable name="Month" select="AjaxRequest/CurrentDay/Month"></xsl:variable>
		<xsl:variable name="Year" select="AjaxRequest/CurrentDay/Year"></xsl:variable>
		<xsl:variable name="Week" select="AjaxRequest/CurrentDay/Week"></xsl:variable>
		<xsl:variable name="DayOfWeek" select="AjaxRequest/CurrentDay/DayOfWeek"></xsl:variable>
		<xsl:variable name="Quarter" select="AjaxRequest/CurrentDay/Quarter"></xsl:variable>
		<xsl:variable name="DayOfYear" select="AjaxRequest/CurrentDay/DayOfYear"></xsl:variable>
		<xsl:variable name="Date" select="AjaxRequest/CurrentDay/Date"></xsl:variable>
		<xsl:variable name="MaxAmt" select="round(AjaxRequest/GoalProgressDetail/Item/MaxAmount)"></xsl:variable>
		<xsl:variable name="MinAmt" select="round(AjaxRequest/GoalProgressDetail/Item/MinAmount)"></xsl:variable>
		<xsl:variable name="AvgAmt" select="round(AjaxRequest/GoalProgressDetail/Item/AverageAmt)"></xsl:variable>
		<xsl:variable name="CommunityAdmin" select="AjaxRequest/UserRoles/Role[RoleName = 'Community Admin']"/>

		<xsl:variable name="RemAboveAmt">
			<xsl:choose>
				<xsl:when test="string(number($CurrentAmount))!='NaN'">
					<xsl:value-of select="round($TotalAmount - $CurrentAmount)"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="round($TotalAmount)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="RemBelowAmt">
			<xsl:choose>
				<xsl:when test="string(number($CurrentAmount))!='NaN'">
					<xsl:value-of select="round($CurrentAmount - $TotalAmount)"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="round($TotalAmount)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="LastRecordID" select="AjaxRequest/GoalProgressDetail/Item/LastRecordID"></xsl:variable>
		<xsl:variable name="LastAmountPay" select="round(AjaxRequest/GoalProgressDetail/Item/LastAmountPay)"></xsl:variable>
		<xsl:variable name="LastPeriod" select="AjaxRequest/GoalProgressDetail/Item/LastPeriod"></xsl:variable>
		<xsl:variable name="LastTrackKey" select="AjaxRequest/CurrentDay/LastTrackKey"></xsl:variable>
		<xsl:variable name="UserName" select="AjaxRequest/GoalProgressDetail/UserName"></xsl:variable>
		<xsl:variable name="PreviousDayOfWeek" select="AjaxRequest/PreviousDaysData/DatesData/DayOfWeek"></xsl:variable>
		<xsl:variable name="PreviousMonth" select="AjaxRequest/PreviousDaysData/DatesData/MonthName"></xsl:variable>
		<xsl:variable name="PreviousQuarter" select="AjaxRequest/PreviousDaysData/DatesData/Quarter"></xsl:variable>
		<xsl:variable name="PreviousYear" select="AjaxRequest/PreviousDaysData/DatesData/Year"></xsl:variable>
		<xsl:variable name="DayBeforePreviousDayOfWeek" select="AjaxRequest/TwoTrackPreviousDaysData/DatesData/DayOfWeek"></xsl:variable>
		<xsl:variable name="MonthBeforePreviousMonthName" select="AjaxRequest/TwoTrackPreviousDaysData/DatesData/MonthName"></xsl:variable>
		<xsl:variable name="BeforePreviousMonthQuarter" select="AjaxRequest/TwoTrackPreviousDaysData/DatesData/Quarter"></xsl:variable>
		<xsl:variable name="PreviousToPreviousYear" select="AjaxRequest/TwoTrackPreviousDaysData/DatesData/Year"></xsl:variable>
		<xsl:variable name="LastToLastRecordID" select="AjaxRequest/GoalProgressDetail/Item/LastToLastRecordID"></xsl:variable>
		<xsl:variable name="LastToLastAmountPay" select="round(AjaxRequest/GoalProgressDetail/Item/LastToLastAmountPay)"></xsl:variable>
		<xsl:variable name="LastToLastPeriod" select="AjaxRequest/GoalProgressDetail/Item/LastToLastPeriod"></xsl:variable>
		<xsl:variable name="LastToLastTrackKeyValue" select="AjaxRequest/LastToLastTrackKeyValue"></xsl:variable>
		<xsl:variable name="ThisWeekend" select="AjaxRequest/Weekend/WeekendDates/ThisWeekend"></xsl:variable>
		<xsl:variable name="LastWeekend" select="AjaxRequest/Weekend/WeekendDates/LastWeekend"></xsl:variable>
		<xsl:variable name="LastToLastWeekend" select="AjaxRequest/Weekend/WeekendDates/LastToLastWeekend"></xsl:variable>
		<xsl:variable name="ThreeTrackLastWeekend" select="AjaxRequest/Weekend/WeekendDates/ThreeTrackLastWeekend"></xsl:variable>
		<xsl:variable name="ThreeTrackPrevDayOfWeek" select="AjaxRequest/ThreeTrackPreviousDaysData/DatesData/DayOfWeek"></xsl:variable>
		<xsl:variable name="ThreeTrackPrevMonth" select="AjaxRequest/ThreeTrackPreviousDaysData/DatesData/MonthName"></xsl:variable>
		<xsl:variable name="ThreeTrackPrevQuarter" select="AjaxRequest/ThreeTrackPreviousDaysData/DatesData/Quarter"></xsl:variable>
		<xsl:variable name="ThreeTrackPrevYear" select="AjaxRequest/ThreeTrackPreviousDaysData/DatesData/Year"></xsl:variable>
		<xsl:variable name="ThreeTrackLastRecordID" select="AjaxRequest/GoalProgressDetail/Item/ThreeTrackLastRecordID"></xsl:variable>
		<xsl:variable name="ThreeTrackLastAmountPay" select="round(AjaxRequest/GoalProgressDetail/Item/ThreeTrackLastAmountPay)"></xsl:variable>
		<xsl:variable name="ThreeTrackLastPeriod" select="AjaxRequest/GoalProgressDetail/Item/ThreeTrackLastPeriod"></xsl:variable>
		<xsl:variable name="ThreeTrackOldPeriodKey" select="AjaxRequest/ThreeTrackOldKeyValue"></xsl:variable>
		<xsl:variable name="PeriodKey" select="AjaxRequest/PeriodKey"></xsl:variable>
		<xsl:variable name="LastPeriodKey" select="AjaxRequest/LastPeriodKey"></xsl:variable>
		<xsl:variable name="TwoTrackOlderPeriodKey" select="AjaxRequest/TwoTrackOlderPeriodKey"></xsl:variable>
		<xsl:variable name="ThreeTrackOlderPeriodKey" select="AjaxRequest/ThreeTrackOlderPeriodKey"></xsl:variable>
		<xsl:variable name="GoalUserLeaderBoardDataXML" select="AjaxRequest/GoalUsersLeaderBoardData/."></xsl:variable>
		<xsl:variable name="CummulativeChangeMaxAmount" select="AjaxRequest/CummulativeChangeAmounts/Amount/MaxAmount"/>
		<xsl:variable name="CummulativeChangeMinAmount" select="AjaxRequest/CummulativeChangeAmounts/Amount/MinAmount"/>
		<xsl:variable name="PCT" select="AjaxRequest/CummulativeChangeAmounts/Amount/PCT"/>
		<xsl:variable name="GoalNotesFormat" select="AjaxRequest/Items/Item/GoalNotesFormat"></xsl:variable>
		<xsl:variable name="LoggedInUserID" select="AjaxRequest/LoggedInUserID"></xsl:variable>
		<xsl:variable name="OwnerBrandID" select="AjaxRequest/Items/Item/OwnerBrandID"></xsl:variable>
		<xsl:variable name="MediaFiles" select="AjaxRequest/MediaFiles/."></xsl:variable>
		<xsl:variable name="SuccessKey" select="AjaxRequest/ActionCounts/SuccessKey"></xsl:variable>
		<xsl:variable name="NumbersEnteredBy">
			<xsl:choose>
				<xsl:when test="AjaxRequest/GoalProgressDetail/NumbersEnteredBy">
					<xsl:value-of select="AjaxRequest/GoalProgressDetail/NumbersEnteredBy"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="AjaxRequest/ActionCounts/NumbersEnteredBy"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="GoalType">
			<xsl:choose>
				<xsl:when test="AjaxRequest/Items/Item/GoalType != ''">
					<xsl:value-of select="AjaxRequest/Items/Item/GoalType"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="AjaxRequest/ActionCounts/GoalType"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="GoalMetricsXML" select="AjaxRequest/GoalMetricXML/."></xsl:variable>
		<xsl:variable name="PortalMetricsXML" select="AjaxRequest/PortalMetrics/."></xsl:variable>
		<xsl:variable name="MetricHeaderXML" select="AjaxRequest/NumberGoalDataXML/."></xsl:variable>
		<xsl:variable name="PeriodData" select="AjaxRequest/NumberGoalDataXML/PeriodData/."></xsl:variable>
		<xsl:variable name="MasterPortalItemID" select="AjaxRequest/Settings/MasterPortalItemID"></xsl:variable>
		<xsl:variable name="PermissionID" select="AjaxRequest/ActionCounts/Count/PermissionID"></xsl:variable>
		<xsl:variable name="BetaVersion" select="AjaxRequest/Settings/BetaVersion"></xsl:variable>
		<xsl:variable name="PageNumber" select="AjaxRequest/Params/PageNumber"></xsl:variable>
		<xsl:variable name="PageSize" select="AjaxRequest/Params/PageSize"></xsl:variable>
		<xsl:variable name="UserSettingHideCompleted" select="AjaxRequest/ActionCounts/Count/HideCompleted"></xsl:variable>
		<xsl:variable name="UserSettingMyTasks" select="AjaxRequest/ActionCounts/Count/MyTasks"></xsl:variable>
		<xsl:variable name="UserSettingThisWeek" select="AjaxRequest/ActionCounts/Count/ThisWeek"></xsl:variable>
		<xsl:variable name="UserSettingCollapseAll" select="AjaxRequest/ActionCounts/Count/CollapseAll"></xsl:variable>
		<xsl:variable name="GoalStartDate" select="AjaxRequest/GoalProgressDetail/Item/GoalStartDate"></xsl:variable>
		<xsl:variable name="GoalEndDate" select="AjaxRequest/GoalProgressDetail/Item/GoalEndDate"></xsl:variable>
		<xsl:variable name="UserPermissionOnGoal" select="AjaxRequest/UserPermissionOnGoal"></xsl:variable>


		<div id="div_{$GoalItemID}_GoalDetail" style="overflow:hidden;">
			<table cellpadding="0" cellspacing="0" width="100%">
				<xsl:call-template name="GoalDirections">
					<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
					<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
					<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
					<xsl:with-param name="OfWhat" select="$OfWhat"></xsl:with-param>
					<xsl:with-param name="Track" select="$Track"></xsl:with-param>
					<xsl:with-param name="GoalStart" select="$GoalStart"></xsl:with-param>
					<xsl:with-param name="GoalDirection" select="$GoalDirection"></xsl:with-param>
					<xsl:with-param name="Updating" select="$Updating"></xsl:with-param>
					<xsl:with-param name="LastAmount" select="$LastAmount"></xsl:with-param>
					<xsl:with-param name="TotalAmount" select="$TotalAmount"></xsl:with-param>
					<xsl:with-param name="Format" select="$Format"></xsl:with-param>
					<xsl:with-param name="OldPeriodKey" select="$OldPeriodKey"></xsl:with-param>
					<xsl:with-param name="CurrentAmount" select="$CurrentAmount"></xsl:with-param>
					<xsl:with-param name="TotalAcheivedAmount" select ="$TotalAcheivedAmount" />
					<xsl:with-param name="RemainingAmount" select ="$RemainingAmount"/>
					<xsl:with-param name="WeeklyDataValue" select="$WeeklyDataValue"></xsl:with-param>
					<xsl:with-param name="Month" select="$Month"></xsl:with-param>
					<xsl:with-param name="Year" select="$Year"></xsl:with-param>
					<xsl:with-param name="Week" select="$Week"></xsl:with-param>
					<xsl:with-param name="DayOfWeek" select="$DayOfWeek"></xsl:with-param>
					<xsl:with-param name="Quarter" select="$Quarter"></xsl:with-param>
					<xsl:with-param name="DayOfYear" select="$DayOfYear"></xsl:with-param>
					<xsl:with-param name="Date" select="$Date"></xsl:with-param>
					<xsl:with-param name="MaxAmt" select="$MaxAmt"></xsl:with-param>
					<xsl:with-param name="MinAmt" select="$MinAmt"></xsl:with-param>
					<xsl:with-param name="AvgAmt" select="$AvgAmt"></xsl:with-param>
					<xsl:with-param name="RemAboveAmt" select="$RemAboveAmt"></xsl:with-param>
					<xsl:with-param name="RemBelowAmt" select="$RemBelowAmt"></xsl:with-param>
					<xsl:with-param name="LastRecordID" select="$LastRecordID"></xsl:with-param>
					<xsl:with-param name="LastAmountPay" select="$LastAmountPay"></xsl:with-param>
					<xsl:with-param name="LastPeriod" select="$LastPeriod"></xsl:with-param>
					<xsl:with-param name="LastTrackKey" select="$LastTrackKey"></xsl:with-param>
					<xsl:with-param name="UserName" select="$UserName"></xsl:with-param>
					<xsl:with-param name="PreviousDayOfWeek" select="$PreviousDayOfWeek"></xsl:with-param>
					<xsl:with-param name="PreviousMonth" select="$PreviousMonth"></xsl:with-param>
					<xsl:with-param name="PreviousQuarter" select="$PreviousQuarter"></xsl:with-param>
					<xsl:with-param name="PreviousYear" select="$PreviousYear"></xsl:with-param>
					<xsl:with-param name="DayBeforePreviousDayOfWeek" select="$DayBeforePreviousDayOfWeek"></xsl:with-param>
					<xsl:with-param name="MonthBeforePreviousMonthName" select="$MonthBeforePreviousMonthName"></xsl:with-param>
					<xsl:with-param name="BeforePreviousMonthQuarter" select="$BeforePreviousMonthQuarter"></xsl:with-param>
					<xsl:with-param name="PreviousToPreviousYear" select="$PreviousToPreviousYear"></xsl:with-param>
					<xsl:with-param name="LastToLastRecordID" select="AjaxRequest/GoalProgressDetail/Item/LastToLastRecordID"></xsl:with-param>
					<xsl:with-param name="LastToLastAmountPay" select="AjaxRequest/GoalProgressDetail/Item/LastToLastAmountPay"></xsl:with-param>
					<xsl:with-param name="LastToLastPeriod" select="AjaxRequest/GoalProgressDetail/Item/LastToLastPeriod"></xsl:with-param>
					<xsl:with-param name="LastToLastTrackKeyValue" select="AjaxRequest/LastToLastTrackKeyValue"></xsl:with-param>
					<xsl:with-param name="ThisWeekend" select="$ThisWeekend"></xsl:with-param>
					<xsl:with-param name="LastWeekend" select="$LastWeekend"></xsl:with-param>
					<xsl:with-param name="LastToLastWeekend" select="$LastToLastWeekend"></xsl:with-param>
					<xsl:with-param name="ThreeTrackLastWeekend" select="$ThreeTrackLastWeekend"></xsl:with-param>
					<xsl:with-param name="ThreeTrackPrevDayOfWeek" select="$ThreeTrackPrevDayOfWeek"></xsl:with-param>
					<xsl:with-param name="ThreeTrackPrevMonth" select="$ThreeTrackPrevMonth"></xsl:with-param>
					<xsl:with-param name="ThreeTrackPrevQuarter" select="$ThreeTrackPrevQuarter"></xsl:with-param>
					<xsl:with-param name="ThreeTrackPrevYear" select="$ThreeTrackPrevYear"></xsl:with-param>
					<xsl:with-param name="ThreeTrackLastRecordID" select="$ThreeTrackLastRecordID"></xsl:with-param>
					<xsl:with-param name="ThreeTrackLastAmountPay" select="$ThreeTrackLastAmountPay"></xsl:with-param>
					<xsl:with-param name="ThreeTrackLastPeriod" select="$ThreeTrackLastPeriod"></xsl:with-param>
					<xsl:with-param name="ThreeTrackOldPeriodKey" select="$ThreeTrackOldPeriodKey"></xsl:with-param>
					<xsl:with-param name="PeriodKey" select="$PeriodKey"></xsl:with-param>
					<xsl:with-param name="LastPeriodKey" select="$LastPeriodKey"></xsl:with-param>
					<xsl:with-param name="TwoTrackOlderPeriodKey" select="$TwoTrackOlderPeriodKey"></xsl:with-param>
					<xsl:with-param name="ThreeTrackOlderPeriodKey" select="$ThreeTrackOlderPeriodKey"></xsl:with-param>
					<xsl:with-param name="GoalType" select="$GoalType"></xsl:with-param>
					<xsl:with-param name="ShareITRecords" select="AjaxRequest/ShareITRecords/."></xsl:with-param>
					<xsl:with-param name="IsGoalCoach" select="AjaxRequest/Goal/IsGoalCoach"></xsl:with-param>
					<xsl:with-param name="IsGoalObserver" select="AjaxRequest/Goal/IsGoalObserver"></xsl:with-param>
					<xsl:with-param name="OwnerID" select="AjaxRequest/Items/Item/OwnerID"></xsl:with-param>
					<xsl:with-param name="ParticipantUserID">
						<xsl:choose>
							<xsl:when test="AjaxRequest/ParticipantUserID">
								<xsl:value-of select="AjaxRequest/ParticipantUserID"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="AjaxRequest/Params/ParticipantUserId"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:with-param>
					<xsl:with-param name="GoalUserLeaderBoardDataXML" select="$GoalUserLeaderBoardDataXML"></xsl:with-param>
					<xsl:with-param name="CummulativeChangeMaxAmount" select="$CummulativeChangeMaxAmount"/>
					<xsl:with-param name="CummulativeChangeMinAmount" select="$CummulativeChangeMinAmount"/>
					<xsl:with-param name="PCT" select="$PCT"/>
					<xsl:with-param name="GoalNotesFormat" select="$GoalNotesFormat"></xsl:with-param>
					<xsl:with-param name="LoggedInUserID" select="$LoggedInUserID"></xsl:with-param>
					<xsl:with-param name="OwnerBrandID" select="$OwnerBrandID"></xsl:with-param>
					<xsl:with-param name="MediaFiles" select="$MediaFiles"></xsl:with-param>
					<xsl:with-param name="NumbersEnteredBy" select="$NumbersEnteredBy"></xsl:with-param>
					<xsl:with-param name="GoalMetricsXML" select="$GoalMetricsXML"></xsl:with-param>
					<xsl:with-param name="PortalMetricsXML" select="$PortalMetricsXML"></xsl:with-param>
					<xsl:with-param name="MetricHeaderXML" select="$MetricHeaderXML"></xsl:with-param>
					<xsl:with-param name="PeriodData" select="$PeriodData"></xsl:with-param>
					<xsl:with-param name="MasterPortalItemID" select="$MasterPortalItemID"></xsl:with-param>
					<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
					<xsl:with-param name="BetaVersion" select="$BetaVersion"></xsl:with-param>
					<xsl:with-param name="PageNumber" select="$PageNumber"></xsl:with-param>
					<xsl:with-param name="PageSize" select="$PageSize"></xsl:with-param>
					<xsl:with-param name="UserSettingHideCompleted" select="$UserSettingHideCompleted"></xsl:with-param>
					<xsl:with-param name="UserSettingMyTasks" select="$UserSettingMyTasks"></xsl:with-param>
					<xsl:with-param name="UserSettingThisWeek" select="$UserSettingThisWeek"></xsl:with-param>
					<xsl:with-param name="UserSettingCollapseAll" select="$UserSettingCollapseAll"></xsl:with-param>
					<xsl:with-param name="SuccessKey" select="$SuccessKey"></xsl:with-param>
					<xsl:with-param name="CommunityAdmin" select="$CommunityAdmin"></xsl:with-param>
					<xsl:with-param name="GoalStartDate" select="$GoalStartDate"></xsl:with-param>
					<xsl:with-param name="GoalEndDate" select="$GoalEndDate"></xsl:with-param>
					<xsl:with-param name="UserPermissionOnGoal" select="$UserPermissionOnGoal"></xsl:with-param>
					<xsl:with-param name="Action" select="$Action"></xsl:with-param>
				</xsl:call-template>
			</table>
		</div>
	</xsl:template>


	<xsl:template name="GoalDirections">
		<xsl:param name="TemplateURL" select="'N/A'"></xsl:param>
		<xsl:param name="HostName" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="OfWhat" select="'N/A'"></xsl:param>
		<xsl:param name="Track" select="'N/A'"></xsl:param>
		<xsl:param name="GoalStart" select="'N/A'"></xsl:param>
		<xsl:param name="GoalDirection" select="'N/A'"></xsl:param>
		<xsl:param name="Updating" select="'N/A'"></xsl:param>
		<xsl:param name="LastAmount" select="'N/A'"></xsl:param>
		<xsl:param name="TotalAmount" select="'N/A'"></xsl:param>
		<xsl:param name="Format" select="'N/A'"></xsl:param>
		<xsl:param name="OldPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="CurrentAmount" select="'N/A'"></xsl:param>
		<xsl:param name="TotalAcheivedAmount" select ="'N/A'" />
		<xsl:param name="RemainingAmount" select ="'N/A'"/>
		<xsl:param name="WeeklyDataValue" select="'N/A'"></xsl:param>
		<xsl:param name="Month" select="'N/A'"></xsl:param>
		<xsl:param name="Year" select="'N/A'"></xsl:param>
		<xsl:param name="Week" select="'N/A'"></xsl:param>
		<xsl:param name="DayOfWeek" select="'N/A'"></xsl:param>
		<xsl:param name="Quarter" select="'N/A'"></xsl:param>
		<xsl:param name="DayOfYear" select="'N/A'"></xsl:param>
		<xsl:param name="Date" select="'N/A'"></xsl:param>
		<xsl:param name="MaxAmt" select="'N/A'"></xsl:param>
		<xsl:param name="MinAmt" select="'N/A'"></xsl:param>
		<xsl:param name="AvgAmt" select="'N/A'"></xsl:param>
		<xsl:param name="RemAboveAmt" select="'N/A'"></xsl:param>
		<xsl:param name="RemBelowAmt" select="'N/A'"></xsl:param>
		<xsl:param name="LastRecordID" select="'N/A'"></xsl:param>
		<xsl:param name="LastAmountPay" select="'N/A'"></xsl:param>
		<xsl:param name="LastPeriod" select="'N/A'"></xsl:param>
		<xsl:param name="LastTrackKey" select="'N/A'"></xsl:param>
		<xsl:param name="UserName" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousDayOfWeek" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousMonth" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousQuarter" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousYear" select="'N/A'"></xsl:param>
		<xsl:param name="DayBeforePreviousDayOfWeek" select="'N/A'"></xsl:param>
		<xsl:param name="MonthBeforePreviousMonthName" select="'N/A'"></xsl:param>
		<xsl:param name="BeforePreviousMonthQuarter" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousToPreviousYear" select="'N/A'"></xsl:param>
		<xsl:param name="LastToLastRecordID" select="'N/A'"></xsl:param>
		<xsl:param name="LastToLastAmountPay" select="'N/A'"></xsl:param>
		<xsl:param name="LastToLastPeriod" select="'N/A'"></xsl:param>
		<xsl:param name="LastToLastTrackKeyValue" select="'N/A'"></xsl:param>
		<xsl:param name="ThisWeekend" select="'N/A'"></xsl:param>
		<xsl:param name="LastWeekend" select="'N/A'"></xsl:param>
		<xsl:param name="LastToLastWeekend" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackLastWeekend" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackPrevDayOfWeek" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackPrevMonth" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackPrevQuarter" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackPrevYear" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackLastRecordID" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackLastAmountPay" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackLastPeriod" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackOldPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="PeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="LastPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="TwoTrackOlderPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="ThreeTrackOlderPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="GoalType" select="'N/A'"></xsl:param>
		<xsl:param name="ShareITRecords" select="'N/A'"></xsl:param>
		<xsl:param name="IsGoalCoach" select="'N/A'"></xsl:param>
		<xsl:param name="IsGoalObserver" select="'N/A'"></xsl:param>
		<xsl:param name="OwnerID" select="'N/A'"></xsl:param>
		<xsl:param name="ParticipantUserID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalUserLeaderBoardDataXML" select="'N/A'"></xsl:param>
		<xsl:param name="CummulativeChangeMaxAmount" select="'N/A'"/>
		<xsl:param name="CummulativeChangeMinAmount" select="'N/A'"/>
		<xsl:param name="PCT" select="'N/A'"/>
		<xsl:param name="GoalNotesFormat" select="'N/A'"></xsl:param>
		<xsl:param name="LoggedInUserID" select="'N/A'"></xsl:param>
		<xsl:param name="OwnerBrandID" select="'N/A'"></xsl:param>
		<xsl:param name="MediaFiles" select="'N/A'"></xsl:param>
		<xsl:param name="NumbersEnteredBy" select="'N/A'"></xsl:param>
		<xsl:param name="GoalMetricsXML" select="'N/A'"></xsl:param>
		<xsl:param name="PortalMetricsXML" select="'N/A'"></xsl:param>
		<xsl:param name="MetricHeaderXML" select="'N/A'"></xsl:param>
		<xsl:param name="PeriodData" select="'N/A'"></xsl:param>
		<xsl:param name="MasterPortalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="PermissionID" select="'N/A'"></xsl:param>
		<xsl:param name="BetaVersion" select="'N/A'"></xsl:param>
		<xsl:param name="PageNumber" select="'N/A'"></xsl:param>
		<xsl:param name="PageSize" select="'N/A'"></xsl:param>
		<xsl:param name="UserSettingHideCompleted" select="'N/A'"></xsl:param>
		<xsl:param name="UserSettingMyTasks" select="'N/A'"></xsl:param>
		<xsl:param name="UserSettingThisWeek" select="'N/A'"></xsl:param>
		<xsl:param name="UserSettingCollapseAll" select="'N/A'"></xsl:param>
		<xsl:param name="SuccessKey" select="'N/A'"></xsl:param>
		<xsl:param name="CommunityAdmin" select="'N/A'"></xsl:param>
		<xsl:param name="GoalStartDate" select="'N/A'"></xsl:param>
		<xsl:param name="GoalEndDate" select="'N/A'"></xsl:param>
		<xsl:param name="UserPermissionOnGoal" select="'N/A'"></xsl:param>
		<xsl:param name="Action" select="'N/A'"></xsl:param>
		<xsl:variable name="PutAddItemBoxYN">
			<xsl:choose>
				<xsl:when test='($GoalNotesFormat = 1 or $GoalNotesFormat = 2) and $GoalType = 2'>
					<xsl:number value='0'/>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>

		<tr>
			<td colspan="2">
				<div  class="padding15">
					<div>
						<img src="{$TemplateURL}Web/Images/Ver_2_0/icon_metrics_goal.png" class="marginLeft10 marginRight10" align="absmiddle">
						</img>
						<span class="actionDetailTitle verticallyMiddle">
							Update and Track Your Progress
						</span>
					</div>
				</div>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<div id="td_Indivdual_NumberGoalData_{$GoalItemID}"  class="dnone-mvp" style="padding-bottom:10px;">
					<xsl:call-template name="CompiledNumberGoalIndividualDataTemplate">
						<xsl:with-param name="OfWhat" select="$OfWhat"></xsl:with-param>
						<xsl:with-param name="Track" select="$Track"></xsl:with-param>
						<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
						<xsl:with-param name="Format" select="$Format"></xsl:with-param>
						<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
						<xsl:with-param name="TotalAmount" select="$TotalAmount"></xsl:with-param>
						<xsl:with-param name="UserName" select="$UserName"></xsl:with-param>
						<xsl:with-param name="GoalDirection" select="$GoalDirection"></xsl:with-param>
						<xsl:with-param name ="MaxAmt" select="$MaxAmt"></xsl:with-param>
						<xsl:with-param name="MinAmt" select="$MinAmt"></xsl:with-param>
						<xsl:with-param name="TotalAcheivedAmount" select="$TotalAcheivedAmount"></xsl:with-param>
						<xsl:with-param name="RemAboveAmt" select="$RemAboveAmt"></xsl:with-param>
						<xsl:with-param name="RemBelowAmt" select="$RemBelowAmt"></xsl:with-param>
						<xsl:with-param name="RemainingAmount" select="$RemainingAmount"></xsl:with-param>
						<xsl:with-param name="WeeklyDataValue" select="$WeeklyDataValue"></xsl:with-param>
						<xsl:with-param name="GoalType" select="$GoalType"></xsl:with-param>
						<xsl:with-param name="ShareITRecords" select="$ShareITRecords"></xsl:with-param>
						<xsl:with-param name="IsGoalCoach" select="$IsGoalCoach"></xsl:with-param>
						<xsl:with-param name="IsGoalObserver" select="$IsGoalObserver"></xsl:with-param>
						<xsl:with-param name="OwnerID" select="$OwnerID"></xsl:with-param>
						<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
						<xsl:with-param name="CurrentAmount" select="$CurrentAmount"></xsl:with-param>
						<xsl:with-param name="GoalUserLeaderBoardDataXML" select="$GoalUserLeaderBoardDataXML"></xsl:with-param>
						<xsl:with-param name="CummulativeChangeMaxAmount" select="$CummulativeChangeMaxAmount"/>
						<xsl:with-param name="CummulativeChangeMinAmount" select="$CummulativeChangeMinAmount"/>
						<xsl:with-param name="PCT" select="$PCT"/>
						<xsl:with-param name="GoalStartDate" select="$GoalStartDate"></xsl:with-param>
						<xsl:with-param name="GoalEndDate" select="$GoalEndDate"></xsl:with-param>
						<xsl:with-param name="UserPermissionOnGoal" select="$UserPermissionOnGoal"></xsl:with-param>
						<xsl:with-param name="Action" select="$Action"></xsl:with-param>
						<xsl:with-param name="PageNumber" select="$PageNumber"></xsl:with-param>
					<xsl:with-param name="PageSize" select="$PageSize"></xsl:with-param>
					</xsl:call-template>
				</div>
			</td>
		</tr>

		<xsl:choose>
			<xsl:when test="$BetaVersion &gt;= 2.5">
				<tr>
					<td colspan="2">
						<div style="padding-right:2px;padding-left:2px;">
							<xsl:call-template name="GoalMetricLayout">
								<xsl:with-param name="Updating" select="$Updating"></xsl:with-param>
								<xsl:with-param name="MetricHeaderXML" select="$MetricHeaderXML"></xsl:with-param>
								<xsl:with-param name="GoalNotesFormat" select="$GoalNotesFormat"></xsl:with-param>
								<xsl:with-param name="LoggedInUserID" select="$LoggedInUserID"></xsl:with-param>
								<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
								<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
								<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
								<xsl:with-param name="PeriodData" select="$PeriodData"></xsl:with-param>
								<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
								<xsl:with-param name="NumbersEnteredBy" select="$NumbersEnteredBy"></xsl:with-param>
								<xsl:with-param name="PortalMetricsXML" select="$PortalMetricsXML"></xsl:with-param>
								<xsl:with-param name="OfWhat" select="$OfWhat"></xsl:with-param>
								<xsl:with-param name="Track" select="$Track"></xsl:with-param>
								<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
								<xsl:with-param name="PageNumber" select="$PageNumber"></xsl:with-param>
								<xsl:with-param name="PageSize" select="$PageSize"></xsl:with-param>
							</xsl:call-template>
						</div>
					</td>
				</tr>
			</xsl:when>
			<xsl:otherwise>
				<tr>
					<td width="60%" style="border-right:1px solid #5E5E5E;">
						<div style="padding-right:2px;padding-left:2px;">
							<table cellpadding="0" cellspacing="0" width="100%">
								<tr>
									<td id="td_NumberGoalData_{$GoalItemID}" width="40%">
										<xsl:choose>
											<xsl:when test="$GoalType = 1">
												<xsl:call-template name="PeriodTypeData">
													<xsl:with-param name="OfWhat" select="$OfWhat"></xsl:with-param>
													<xsl:with-param name="Track" select="$Track"></xsl:with-param>
													<xsl:with-param name="DayOfWeek" select="$DayOfWeek"></xsl:with-param>
													<xsl:with-param name="Month" select="$Month"></xsl:with-param>
													<xsl:with-param name="ThisWeekend" select="$ThisWeekend"></xsl:with-param>
													<xsl:with-param name="Year" select="$Year"></xsl:with-param>
													<xsl:with-param name="Quarter" select="$Quarter"></xsl:with-param>
													<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
													<xsl:with-param name="CurrentAmount" select="$CurrentAmount"></xsl:with-param>
													<xsl:with-param name="Format" select="$Format"></xsl:with-param>
													<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
													<xsl:with-param name="TotalAmount" select="$TotalAmount"></xsl:with-param>
													<xsl:with-param name="LastAmount" select="$LastAmount"></xsl:with-param>
													<xsl:with-param name="OldPeriodKey" select="$OldPeriodKey"></xsl:with-param>
													<xsl:with-param name="PreviousDayOfWeek" select="$PreviousDayOfWeek"></xsl:with-param>
													<xsl:with-param name="PreviousMonth" select="$PreviousMonth"></xsl:with-param>
													<xsl:with-param name="LastWeekend" select="$LastWeekend"></xsl:with-param>
													<xsl:with-param name="LastPeriod" select="$LastPeriod"></xsl:with-param>
													<xsl:with-param name="LastTrackKey" select="$LastTrackKey"></xsl:with-param>
													<xsl:with-param name="LastAmountPay" select="$LastAmountPay"></xsl:with-param>
													<xsl:with-param name="LastRecordID" select="$LastRecordID"></xsl:with-param>
													<xsl:with-param name="DayBeforePreviousDayOfWeek" select="$DayBeforePreviousDayOfWeek"></xsl:with-param>
													<xsl:with-param name="MonthBeforePreviousMonthName" select="$MonthBeforePreviousMonthName"></xsl:with-param>
													<xsl:with-param name="LastToLastWeekend" select="$LastToLastWeekend"></xsl:with-param>
													<xsl:with-param name="ThreeTrackLastWeekend" select="$ThreeTrackLastWeekend"></xsl:with-param>
													<xsl:with-param name="LastToLastRecordID" select="$LastToLastRecordID"></xsl:with-param>
													<xsl:with-param name="PreviousToPreviousYear" select="$PreviousToPreviousYear"></xsl:with-param>
													<xsl:with-param name="LastToLastAmountPay" select="$LastToLastAmountPay"></xsl:with-param>
													<xsl:with-param name="LastToLastTrackKeyValue" select="$LastToLastTrackKeyValue"></xsl:with-param>
													<xsl:with-param name="LastToLastPeriod" select="$LastToLastPeriod"></xsl:with-param>
													<xsl:with-param name="ThreeTrackPrevDayOfWeek" select="$ThreeTrackPrevDayOfWeek"></xsl:with-param>
													<xsl:with-param name="ThreeTrackPrevMonth" select="$ThreeTrackPrevMonth"></xsl:with-param>
													<xsl:with-param name="ThreeTrackPrevQuarter" select="$ThreeTrackPrevQuarter"></xsl:with-param>
													<xsl:with-param name="ThreeTrackPrevYear" select="$ThreeTrackPrevYear"></xsl:with-param>
													<xsl:with-param name="ThreeTrackLastRecordID" select="$ThreeTrackLastRecordID"></xsl:with-param>
													<xsl:with-param name="ThreeTrackLastAmountPay" select="$ThreeTrackLastAmountPay"></xsl:with-param>
													<xsl:with-param name="ThreeTrackLastPeriod" select="$ThreeTrackLastPeriod"></xsl:with-param>
													<xsl:with-param name="ThreeTrackOldPeriodKey" select="$ThreeTrackOldPeriodKey"></xsl:with-param>
													<xsl:with-param name="PeriodKey" select="$PeriodKey"></xsl:with-param>
													<xsl:with-param name="LastPeriodKey" select="$LastPeriodKey"></xsl:with-param>
													<xsl:with-param name="TwoTrackOlderPeriodKey" select="$TwoTrackOlderPeriodKey"></xsl:with-param>
													<xsl:with-param name="ThreeTrackOlderPeriodKey" select="$ThreeTrackOlderPeriodKey"></xsl:with-param>
													<xsl:with-param name="UserName" select="$UserName"></xsl:with-param>
													<xsl:with-param name="GoalType" select="$GoalType"></xsl:with-param>
													<xsl:with-param name="ShareITRecords" select="$ShareITRecords"></xsl:with-param>
													<xsl:with-param name="IsGoalCoach" select="$IsGoalCoach"></xsl:with-param>
													<xsl:with-param name="IsGoalObserver" select="$IsGoalObserver"></xsl:with-param>
													<xsl:with-param name="OwnerID" select="$OwnerID"></xsl:with-param>
													<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
													<xsl:with-param name="NumbersEnteredBy" select="$NumbersEnteredBy"></xsl:with-param>
												</xsl:call-template>
											</xsl:when>
											<xsl:otherwise>
												<xsl:call-template name="GoalUsersLeaderboardData">
													<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
													<xsl:with-param name="GoalUserLeaderBoardDataXML" select="$GoalUserLeaderBoardDataXML"></xsl:with-param>
													<xsl:with-param name="GoalDirection" select="$GoalDirection"></xsl:with-param>
													<xsl:with-param name="LoggedInUserID" select="$LoggedInUserID"></xsl:with-param>
													<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
												</xsl:call-template>
											</xsl:otherwise>
										</xsl:choose>
									</td>
									<td width="60%">
										<xsl:choose>
											<xsl:when test="$GoalType = 2">
												<xsl:call-template name="PeriodTypeData">
													<xsl:with-param name="OfWhat" select="$OfWhat"></xsl:with-param>
													<xsl:with-param name="Track" select="$Track"></xsl:with-param>
													<xsl:with-param name="DayOfWeek" select="$DayOfWeek"></xsl:with-param>
													<xsl:with-param name="Month" select="$Month"></xsl:with-param>
													<xsl:with-param name="ThisWeekend" select="$ThisWeekend"></xsl:with-param>
													<xsl:with-param name="Year" select="$Year"></xsl:with-param>
													<xsl:with-param name="Quarter" select="$Quarter"></xsl:with-param>
													<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
													<xsl:with-param name="CurrentAmount" select="$CurrentAmount"></xsl:with-param>
													<xsl:with-param name="Format" select="$Format"></xsl:with-param>
													<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
													<xsl:with-param name="TotalAmount" select="$TotalAmount"></xsl:with-param>
													<xsl:with-param name="LastAmount" select="$LastAmount"></xsl:with-param>
													<xsl:with-param name="OldPeriodKey" select="$OldPeriodKey"></xsl:with-param>
													<xsl:with-param name="PreviousDayOfWeek" select="$PreviousDayOfWeek"></xsl:with-param>
													<xsl:with-param name="PreviousMonth" select="$PreviousMonth"></xsl:with-param>
													<xsl:with-param name="LastWeekend" select="$LastWeekend"></xsl:with-param>
													<xsl:with-param name="LastPeriod" select="$LastPeriod"></xsl:with-param>
													<xsl:with-param name="LastTrackKey" select="$LastTrackKey"></xsl:with-param>
													<xsl:with-param name="LastAmountPay" select="$LastAmountPay"></xsl:with-param>
													<xsl:with-param name="LastRecordID" select="$LastRecordID"></xsl:with-param>
													<xsl:with-param name="DayBeforePreviousDayOfWeek" select="$DayBeforePreviousDayOfWeek"></xsl:with-param>
													<xsl:with-param name="MonthBeforePreviousMonthName" select="$MonthBeforePreviousMonthName"></xsl:with-param>
													<xsl:with-param name="LastToLastWeekend" select="$LastToLastWeekend"></xsl:with-param>
													<xsl:with-param name="ThreeTrackLastWeekend" select="$ThreeTrackLastWeekend"></xsl:with-param>
													<xsl:with-param name="LastToLastRecordID" select="$LastToLastRecordID"></xsl:with-param>
													<xsl:with-param name="PreviousToPreviousYear" select="$PreviousToPreviousYear"></xsl:with-param>
													<xsl:with-param name="LastToLastAmountPay" select="$LastToLastAmountPay"></xsl:with-param>
													<xsl:with-param name="LastToLastTrackKeyValue" select="$LastToLastTrackKeyValue"></xsl:with-param>
													<xsl:with-param name="LastToLastPeriod" select="$LastToLastPeriod"></xsl:with-param>
													<xsl:with-param name="ThreeTrackPrevDayOfWeek" select="$ThreeTrackPrevDayOfWeek"></xsl:with-param>
													<xsl:with-param name="ThreeTrackPrevMonth" select="$ThreeTrackPrevMonth"></xsl:with-param>
													<xsl:with-param name="ThreeTrackPrevQuarter" select="$ThreeTrackPrevQuarter"></xsl:with-param>
													<xsl:with-param name="ThreeTrackPrevYear" select="$ThreeTrackPrevYear"></xsl:with-param>
													<xsl:with-param name="ThreeTrackLastRecordID" select="$ThreeTrackLastRecordID"></xsl:with-param>
													<xsl:with-param name="ThreeTrackLastAmountPay" select="$ThreeTrackLastAmountPay"></xsl:with-param>
													<xsl:with-param name="ThreeTrackLastPeriod" select="$ThreeTrackLastPeriod"></xsl:with-param>
													<xsl:with-param name="ThreeTrackOldPeriodKey" select="$ThreeTrackOldPeriodKey"></xsl:with-param>
													<xsl:with-param name="PeriodKey" select="$PeriodKey"></xsl:with-param>
													<xsl:with-param name="LastPeriodKey" select="$LastPeriodKey"></xsl:with-param>
													<xsl:with-param name="TwoTrackOlderPeriodKey" select="$TwoTrackOlderPeriodKey"></xsl:with-param>
													<xsl:with-param name="ThreeTrackOlderPeriodKey" select="$ThreeTrackOlderPeriodKey"></xsl:with-param>
													<xsl:with-param name="UserName" select="$UserName"></xsl:with-param>
													<xsl:with-param name="GoalType" select="$GoalType"></xsl:with-param>
													<xsl:with-param name="ShareITRecords" select="$ShareITRecords"></xsl:with-param>
													<xsl:with-param name="IsGoalCoach" select="$IsGoalCoach"></xsl:with-param>
													<xsl:with-param name="IsGoalObserver" select="$IsGoalObserver"></xsl:with-param>
													<xsl:with-param name="OwnerID" select="$OwnerID"></xsl:with-param>
													<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
													<xsl:with-param name="NumbersEnteredBy" select="$NumbersEnteredBy"></xsl:with-param>
												</xsl:call-template>
											</xsl:when>
											<xsl:otherwise>
												<xsl:call-template name ="GoalsWeeklyPlan">
													<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
													<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
													<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
													<xsl:with-param name="Updating" select="$Updating"></xsl:with-param>
													<xsl:with-param name="Track" select="$Track"></xsl:with-param>
													<xsl:with-param name="Metrics" select="AjaxRequest/Metrics/."></xsl:with-param>
													<xsl:with-param name="OfWhat" select="$OfWhat"></xsl:with-param>
													<xsl:with-param name="Month" select="$Month"></xsl:with-param>
													<xsl:with-param name="Year" select="$Year"></xsl:with-param>
													<xsl:with-param name="Quarter" select="$Quarter"></xsl:with-param>
													<xsl:with-param name="DayOfWeek" select="$DayOfWeek"></xsl:with-param>
													<xsl:with-param name="PreviousDayOfWeek" select="$PreviousDayOfWeek"></xsl:with-param>
													<xsl:with-param name="PreviousMonth" select="$PreviousMonth"></xsl:with-param>
													<xsl:with-param name="PreviousQuarter" select="$PreviousQuarter"></xsl:with-param>
													<xsl:with-param name="PreviousYear" select="$PreviousYear"></xsl:with-param>
													<xsl:with-param name="ThisWeekend" select="$ThisWeekend"></xsl:with-param>
													<xsl:with-param name="LastWeekend" select="$LastWeekend"></xsl:with-param>
													<xsl:with-param name="LastPeriod" select="$LastPeriod"></xsl:with-param>
													<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
													<xsl:with-param name="GoalMetricsXML" select="$GoalMetricsXML"></xsl:with-param>
													<xsl:with-param name="PortalMetricsXML" select="$PortalMetricsXML"></xsl:with-param>
													<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
												</xsl:call-template>
											</xsl:otherwise>
										</xsl:choose>
									</td>
								</tr>
							</table>
						</div>
					</td>
					<td width='40%'>
						<xsl:choose>
							<xsl:when test='$GoalNotesFormat = 2'>
								<div class="actionCountText marginBottom10">Add a Quick Note :</div>
								<xsl:call-template name='FBDiscussionsControl'>
									<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
									<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
									<xsl:with-param name="Mode">
										<xsl:text>MyProgress</xsl:text>
									</xsl:with-param>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test='$GoalNotesFormat = 1'>
								<table cellpadding="0" cellspacing="2">
									<tr>
										<td>
											<span class="actionCountText">Check-in and enter an update :</span>
										</td>
									</tr>
									<tr>
										<td>

											<div class="marginTop5">
												<textarea id="txt_AddNoteOnMyProgress_{$GoalItemID}" rows ="4" cols ="40" style="padding:4px;"
                                                          defaultText="Add a note here"
                                                       onFocus='SetTextAreaValue("txt_AddNoteOnMyProgress_{$GoalItemID}", "Add a note here", "focus")'
                                                       onBlur='SetTextAreaValue("txt_AddNoteOnMyProgress_{$GoalItemID}", "Add a note here", "blur");'>
													<xsl:text>Add a note here</xsl:text>
												</textarea>
											</div>
											<div class="divGradient spanGradientText" style="height:30px;line-height:25px;width:90px;"
                                                onmouseover="document.getElementById('img_Post_{$GoalItemID}').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
                                                onmouseout="document.getElementById('img_Post_{$GoalItemID}').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';">
												<span class="padding10" id="div_Lifespace_AddNewPost_{$GoalItemID}"
                                                      onclick="goal_AddQuickNote('txt_AddNoteOnMyProgress_{$GoalItemID}',{$GoalItemID},'div_Goal_{$GoalItemID}_Operations');
                                                       goal_HightlightSelectedLink('cell_NoteBook_{$GoalItemID}','defaultMenuGoal','selectedMenuGoalTabs','GoalMenuAction',0,'#2B9BF3');">
													<img id="img_Post_{$GoalItemID}" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" class="verticallyMiddle" align="absmiddle"></img>
													<span class="verticallyMiddle marginLeft5">
														POST
													</span>
												</span>
											</div>
										</td>
									</tr>
								</table>
							</xsl:when>
						</xsl:choose>
					</td>
				</tr>
			</xsl:otherwise>
		</xsl:choose>

		<tr>
			<td colspan="2">
				<div style="border-bottom:1px solid #5E5E5E;"></div>
			</td>
		</tr>
		<!--<table class="tableMaster" cellpadding="0" cellspacing="0">
			<tr>
				<td width="100%">
					<xsl:choose>
						<xsl:when test="$GoalType = 2">
							<div class="marginTop10">
								<xsl:call-template name="MediaList">
									<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
									<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
									<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
									<xsl:with-param name="MediaFiles" select="$MediaFiles"></xsl:with-param>
								</xsl:call-template>
							</div>
							<xsl:call-template name="GoalShareFooter">
								<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
								<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
								<xsl:with-param name="LoggedInUserID" select="$LoggedInUserID"></xsl:with-param>
								<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
							</xsl:call-template>
						</xsl:when>
						<xsl:otherwise>
							<xsl:call-template name="GoalActionsTemplate">
								<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
								<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
								<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
								<xsl:with-param name="SummaryItems" select="AjaxRequest/Goal/SummaryItems/."></xsl:with-param>
								<xsl:with-param name="DetailItems" select="AjaxRequest/Goal/DetailItems/."></xsl:with-param>
								<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
								<xsl:with-param name="PutAddItemBox" select="$PutAddItemBoxYN"></xsl:with-param>
								<xsl:with-param name="LoggedInUserID" select="$LoggedInUserID"></xsl:with-param>
								<xsl:with-param name="OwnerBrandID" select="$OwnerBrandID"></xsl:with-param>
								<xsl:with-param name="IsGoalCoach" select="$IsGoalCoach"></xsl:with-param>
								<xsl:with-param name="IsGoalObserver" select="$IsGoalObserver"></xsl:with-param>
								<xsl:with-param name="UserSettingHideCompleted" select="$UserSettingHideCompleted"></xsl:with-param>
								<xsl:with-param name="UserSettingMyTasks" select="$UserSettingMyTasks"></xsl:with-param>
								<xsl:with-param name="UserSettingThisWeek" select="$UserSettingThisWeek"></xsl:with-param>
								<xsl:with-param name="UserSettingCollapseAll" select="$UserSettingCollapseAll"></xsl:with-param>
								<xsl:with-param name="SuccessKey" select="$SuccessKey"></xsl:with-param>
								<xsl:with-param name="CommunityAdmin" select="$CommunityAdmin"></xsl:with-param>
							</xsl:call-template>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
		</table>-->
	</xsl:template>

	<xsl:template name ="GoalsWeeklyPlan">
		<xsl:param name ="TemplateURL" select ="'N/A'"></xsl:param>
		<xsl:param name ="HostName" select ="'N/A'"></xsl:param>
		<xsl:param name ="GoalItemID" select ="'N/A'"></xsl:param>
		<xsl:param name ="Updating" select ="'N/A'"></xsl:param>
		<xsl:param name ="Track" select ="'N/A'"></xsl:param>
		<xsl:param name ="Metrics" select ="'N/A'"></xsl:param>
		<xsl:param name ="OfWhat" select ="'N/A'"></xsl:param>
		<xsl:param name ="Month" select ="'N/A'"></xsl:param>
		<xsl:param name ="Year" select ="'N/A'"></xsl:param>
		<xsl:param name ="Quarter" select ="'N/A'"></xsl:param>
		<xsl:param name ="DayOfWeek" select ="'N/A'"></xsl:param>
		<xsl:param name ="PreviousDayOfWeek" select ="'N/A'"></xsl:param>
		<xsl:param name ="PreviousMonth" select ="'N/A'"></xsl:param>
		<xsl:param name ="PreviousQuarter" select ="'N/A'"></xsl:param>
		<xsl:param name ="PreviousYear" select ="'N/A'"></xsl:param>
		<xsl:param name="ThisWeekend" select="'N/A'"></xsl:param>
		<xsl:param name="LastWeekend" select="'N/A'"></xsl:param>
		<xsl:param name="LastPeriod" select="'N/A'"></xsl:param>
		<xsl:param name="ParticipantUserID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalMetricsXML" select="'N/A'"></xsl:param>
		<xsl:param name="PortalMetricsXML" select="'N/A'"></xsl:param>
		<xsl:param name="PermissionID" select="'N/A'"></xsl:param>

		<xsl:variable name ="TotalMetric" select ="count($Metrics/ItemMetric)"></xsl:variable>
		<xsl:variable name="GoalMetric" select="count($GoalMetricsXML/GoalMetric)"></xsl:variable>


		<table id="table_MetricData_{$GoalItemID}" cellpadding="0" cellspacing="0" class="tableMaster" >
			<xsl:choose>
				<xsl:when test ="$TotalMetric &gt; 0">
					<xsl:call-template name="GoalMetricsHeader">
						<xsl:with-param name="Updating" select="$Updating"></xsl:with-param>
						<xsl:with-param name="DayOfWeek" select="$DayOfWeek"></xsl:with-param>
						<xsl:with-param name="Month" select="$Month"></xsl:with-param>
						<xsl:with-param name="ThisWeekend" select="$ThisWeekend"></xsl:with-param>
						<xsl:with-param name="Year" select="$Year"></xsl:with-param>
						<xsl:with-param name="Quarter" select="$Quarter"></xsl:with-param>
						<xsl:with-param name="PreviousDayOfWeek" select="$PreviousDayOfWeek"></xsl:with-param>
						<xsl:with-param name="PreviousMonth" select="$PreviousMonth"></xsl:with-param>
						<xsl:with-param name="LastWeekend" select="$LastWeekend"></xsl:with-param>
						<xsl:with-param name="PreviousYear" select="$PreviousYear"></xsl:with-param>
						<xsl:with-param name="PreviousQuarter" select="$PreviousQuarter"></xsl:with-param>
					</xsl:call-template>
					<xsl:for-each select ="$Metrics/ItemMetric">
						<xsl:variable name ="OldPeriodKey" select ="PeriodKey"></xsl:variable>
						<xsl:variable name ="LatestPeriodKey" select ="LatestPeriodKey"></xsl:variable>
						<xsl:variable name="position" select="position()"></xsl:variable>
						<xsl:variable name="tabIndex">
							<xsl:number value="1"/>
						</xsl:variable>
						<xsl:variable name="ThisPeriodTypeValue">
							<xsl:choose>
								<xsl:when test="Amount &gt;= 0">
									<xsl:value-of select="Amount"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text></xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="LastPeriodTypeValue">
							<xsl:choose>
								<xsl:when test="LastAmount &gt;= 0">
									<xsl:value-of select="LastAmount"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text></xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>

						<xsl:variable name="MetricOnClickCall">
							<xsl:choose>
								<xsl:when test="$PermissionID = 3 or $PermissionID &gt;= 4">
									GoalNumbers_DisplayMetricTargetUpdatePanel(<xsl:value-of select="ItemID"/>)
								</xsl:when>
							</xsl:choose>
						</xsl:variable>

						<tr id="tr_Metric_{ItemID}"
                            onmouseover="document.getElementById('img_Delete_{ItemID}').style.display = 'inline';"
                            onmouseout="document.getElementById('img_Delete_{ItemID}').style.display = 'none';">
							<td class='verticallyMiddle textLeft' style='padding-top:5px;' nowrap='nowrap'>
								<img id="img_Delete_{ItemID}" src="{$TemplateURL}Web/Images/Ver_2_0/BT_x.png" height="10" width="9" style="display:none;"
                                     align="absmiddle" class="onMouseOver marginLeft5"
                                     onClick="deleteMetric('{$GoalItemID}','{ItemID}')"></img>
							</td>
							<td style="padding-top:10px;" class="textLeft" nowrap="nowrap">
								<span class="labelGoalActionsText sentenceFont link"
                                      onClick="{$MetricOnClickCall}"
                                      onmouseover="this.style.textDecoration='underline';"
                                      onmouseout="this.style.textDecoration='none';">
									<xsl:value-of select ="Metric"/>
								</span>
								<span class="labelGoalActionsText sentenceFont link" id="tr_Metric_{ItemID}_TargetDisplay"
                                      onClick="{$MetricOnClickCall}">
									<xsl:if test="Target &gt; 0">
										(
										<xsl:choose>
											<xsl:when test="Target &lt; 1">
												<xsl:value-of select ="Target"/>
											</xsl:when>
											<xsl:otherwise>
												<xsl:value-of select ="format-number(Target, '#,###')"/>
											</xsl:otherwise>
										</xsl:choose>
										)
									</xsl:if>
								</span>
								<span class="labelGoalActionsText sentenceFont link" id="tr_Metric_{ItemID}_TargetUpdate" style="display:none;">
									<input id="tr_Metric_{ItemID}_TargetUpdate_Ctrl"
                                       style="width:40px;text-align:right;margin-right:10px;"
                                       value='{Target}' onblur='GoalNumbers_UpdateMetricTarget({ItemID});'></input>
								</span>
							</td>
							<td style="padding-top:10px;padding-right:10px;" class="textRight" nowrap="nowrap">

								<xsl:variable name="LabelDisplay">
									<xsl:choose>
										<xsl:when test ="Amount &gt;= 0">
											<xsl:text>display:inline;</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>display:none;</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<xsl:variable name="TextDisplay">
									<xsl:choose>
										<xsl:when test ="Amount &gt;= 0">
											<xsl:text>display:none;</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>display:inline;</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>

								<span style="{$LabelDisplay}" class="labelGoalActionsText textLeft capitalFont" id="span_lbl_{ItemID}_MetricValue_{$position}_Left">
									<span class="labelGoalActionsText capitalFont" tabID="position()" id="span_lbl_Amount_{ItemID}_{$position}_Left">
										<xsl:value-of select ="Amount"/>
									</span>
									<img id="img_EditIcon_{ItemID}_CurrentPay" src="{$TemplateURL}Web/Images/Ver_2_0/edit_goal.png"
                                         style="display:inline;cursor:pointer;"
                                                class="marginLeft5 marginRight5 verticallyMiddle paddingBottom5"
                                                onClick ='goalProgress_DisplayLastEdit("span_{ItemID}_MetricValue_{$position}_Left",
                                                         "span_lbl_{ItemID}_MetricValue_{$position}_Left");
                                                    document.getElementById("txt_Item_{ItemID}_Metrickey_{$position}_Left").focus();'/>
								</span>
								<span id="span_{ItemID}_MetricValue_{$position}_Left" style="{$TextDisplay}">
									<input id="txt_Item_{ItemID}_Metrickey_{$position}_Left" tabindex="({$position}+{$tabIndex})" name="tabCount"
                                           textBox="txt_Item_{ItemID}_Metrickey" tabID="position()" type="text"
                                           style="width:50px;text-align:right;margin-right:10px;"
                                           onBlur='numberOnly("txt_Item_{ItemID}_Metrickey_{$position}_Left");goalProgress_SaveMetricValue("{ItemID}","{PeriodType}",
                                                   "{Metric}","{PeriodKey}","{Amount}","txt_Item_{ItemID}_Metrickey_{$position}_Left",
                                                   "div_{$GoalItemID}_GoalDetail","{$GoalItemID}","{$Track}","{$OfWhat}","Save","{$position}_Left","{$ParticipantUserID}");'
                                           value='{$ThisPeriodTypeValue}'></input>

								</span>
							</td>
							<td style="padding-top:10px;padding-right:5px;" class="textRight" nowrap="nowrap">

								<xsl:variable name="LabelDisplay">
									<xsl:choose>
										<xsl:when test ="LastAmount &gt;= 0">
											<xsl:text>display:inline;</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>display:none;</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<xsl:variable name="TextDisplay">
									<xsl:choose>
										<xsl:when test ="LastAmount &gt;= 0">
											<xsl:text>display:none;</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>display:inline;</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>

								<span style="{$LabelDisplay}" class="labelGoalActionsText textLeft capitalFont" id="span_lbl_{ItemID}_LastMetricValue_{$position}_Right">
									<span class="labelGoalActionsText capitalFont" tabID="position()" id="span_lbl_Amount_{ItemID}_{$position}_Right">
										<xsl:value-of select ="LastAmount"/>
									</span>
									<img id="img_EditIcon_{ItemID}_CurrentPay" src="{$TemplateURL}Web/Images/Ver_2_0/edit_goal.png"
                                         style="display:inline;cursor:pointer;"
                                                class="marginLeft5 marginRight5 verticallyMiddle paddingBottom5"
                                                onClick ='goalProgress_DisplayLastEdit("span_{ItemID}_LastMetricValue_{$position}_Right",
                                                         "span_lbl_{ItemID}_LastMetricValue_{$position}_Right");
                                                 document.getElementById("txt_Item_{ItemID}_LastMetrickey_{$position}_Right").focus();'/>
								</span>
								<span id="span_{ItemID}_LastMetricValue_{$position}_Right" style="{$TextDisplay}">
									<input id="txt_Item_{ItemID}_LastMetrickey_{$position}_Right" name="tabCount"
                                           textBox="txt_Item_{ItemID}_LastMetrickey_{$position}_Right" tabID="position()" type="text"
                                           style="width:50px;text-align:right;margin-right:10px;"
                                           onBlur='numberOnly("txt_Item_{ItemID}_LastMetrickey_{$position}_Right");goalProgress_SaveMetricValue("{ItemID}","{PeriodType}",
                                                   "{Metric}","{$LastPeriod}","{Amount}","txt_Item_{ItemID}_LastMetrickey_{$position}_Right",
                                                   "div_{$GoalItemID}_GoalDetail","{$GoalItemID}","{$Track}","{$OfWhat}","Save","{$position}_Right","{$ParticipantUserID}");'
                                           value='{$LastPeriodTypeValue}'></input>
								</span>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:when>

				<xsl:otherwise>
					<tr id="tr_AddMetricMessage">
						<td colspan='2' style="padding-top:10px;">
							<div width="100%" class="labelGoalActionsText" align="center">
								Create your own metrics and track them&#xa0;<xsl:value-of select ="$Updating"/>
							</div>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
			<tr>
				<td colspan="3" style="padding-top:10px;">
					<span class="labelAddMetricText" style="display:block;margin-left:10px;" id="lbl_{$GoalItemID}_AddMetric"
                          onClick="goalProgress_DisplayLastEdit('div_{$GoalItemID}_AddMetric',
                          'lbl_{$GoalItemID}_AddMetric','Add','{$GoalItemID}');">+ ADD A METRIC</span>
				</td>
			</tr>
		</table>
		<xsl:call-template name="AddMetricTemplate">
			<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
			<xsl:with-param name="PortalMetricsXML" select="$PortalMetricsXML"></xsl:with-param>
			<xsl:with-param name="Updating" select="$Updating"></xsl:with-param>
			<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
			<xsl:with-param name="OfWhat" select="$OfWhat"></xsl:with-param>
			<xsl:with-param name="Track" select="$Track"></xsl:with-param>
			<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
		</xsl:call-template>
	</xsl:template>

	<xsl:template name="AddMetricTemplate">
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="PortalMetricsXML" select="'N/A'"></xsl:param>
		<xsl:param name="Updating" select="'N/A'"></xsl:param>
		<xsl:param name="TemplateURL" select="'N/A'"></xsl:param>
		<xsl:param name="OfWhat" select="'N/A'"></xsl:param>
		<xsl:param name="Track" select="'N/A'"></xsl:param>
		<xsl:param name="ParticipantUserID" select="'N/A'"></xsl:param>
		<xsl:param name="PageNumber">
			<xsl:number value="1"/>
		</xsl:param>
		<xsl:param name="PageSize">
			<xsl:number value="7"/>
		</xsl:param>

		<xsl:variable name="EscapedOfWhat">
			<xsl:call-template name="replaceCharsInString">
				<xsl:with-param name="stringIn" select="$OfWhat"></xsl:with-param>
				<xsl:with-param name="charsIn">
					<xsl:text>'</xsl:text>
				</xsl:with-param>
				<xsl:with-param name="charsOut">
					<xsl:text>\'</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>

		<table class="tableMaster" cellspacing="0" cellpadding="0" id="tab_GoalMetrics_{$GoalItemID}">
			<tr>
				<td colspan="2" style="padding-top:10px;">
					<div id="div_{$GoalItemID}_AddMetric" style="display:none;">
						<span class="marginRight5" style="margin-left:10px;">
							<input id="txt_Item_{$GoalItemID}_TargetMetricAmount" type="text"
                                   value ="Number" class="autoSuggest" style="width:65px;text-align:right;"
                                   onBlur="numberOnly('txt_Item_{$GoalItemID}_TargetMetricAmount');"
                                   onFocus='return SuccessKey_ClearAutoSuggestTextbox("txt_Item_{$GoalItemID}_TargetMetricAmount");'/>
						</span>
						<span class="marginRight5">
							<xsl:choose>
								<xsl:when test="count($PortalMetricsXML/Metrics) &gt; 0">
									<select id="ddl_GoalPortalMetric_{$GoalItemID}" class="smallDropdown"
                                            onchange="DisplayTextBoxOnCustomMetric('ddl_GoalPortalMetric_{$GoalItemID}','txt_Item_{$GoalItemID}_TargetMetricWhat','img_CrossButton_TargetMetric');">
										<option value="" selected="selected">-Select-</option>
										<xsl:for-each select="$PortalMetricsXML/Metrics[PeriodType = $Updating]">
											<option value="{PortalMetricID}">
												<xsl:value-of select="MetricKey"/>
											</option>
										</xsl:for-each>
										<option value="-99">Add Custom...</option>
									</select>
									<input id="txt_Item_{$GoalItemID}_TargetMetricWhat" type="text" class="text" style="display:none;width:110px;"></input>
									<img id="img_CrossButton_TargetMetric" title="Cancel" src="{$TemplateURL}/Web/Images/Ver_2_0/BT_x.png"
                                         width="10" height="10" style="display:none;margin-left:5px;" class="onMouseOver"
                                         onclick="DisplayPortalMetricsDD('ddl_GoalPortalMetric_{$GoalItemID}','txt_Item_{$GoalItemID}_TargetMetricWhat','img_CrossButton_TargetMetric');"></img>
								</xsl:when>
								<xsl:otherwise>
									<input id="txt_Item_{$GoalItemID}_TargetMetricWhat" type="text"
                                           value ="of what?" class="autoSuggest" style="width:65px;"
                                           onFocus='return SuccessKey_ClearAutoSuggestTextbox("txt_Item_{$GoalItemID}_TargetMetricWhat");'/>
								</xsl:otherwise>
							</xsl:choose>
						</span>
						<span class="labelGoalActionsText">
							<xsl:value-of select ="$Updating"/>
						</span>
						<div style="margin:10px;">
							<table cellspacing="10">
								<tr>
									<td class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:70px;height:25px;text-align:center;"
                                       onmouseover="document.getElementById('img_Cancel').src='{$TemplateURL}Web/Images/Ver_2_0/BT_x_hover.png';"
                                       onmouseout="document.getElementById('img_Cancel').src='{$TemplateURL}Web/Images/Ver_2_0/BT_x.png';"
                                       onClick="goalProgress_DisplayLastEdit('lbl_{$GoalItemID}_AddMetric','div_{$GoalItemID}_AddMetric','Cancel','{$GoalItemID}');">
										<img id="img_Cancel" src="{$TemplateURL}Web/Images/Ver_2_0/BT_x.png" align="absmiddle" class="marginRight5"></img>
										<span id="span_Cancel">CANCEL</span>
									</td>
									<td class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:70px;height:25px;text-align:center;"
                                        onmouseover="document.getElementById('img_Save').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
                                        onmouseout="document.getElementById('img_Save').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';"
                                         onClick="goalProgress_SaveMetrice('{$GoalItemID}','{$Updating}','{$EscapedOfWhat}',
                                                                           'txt_Item_{$GoalItemID}_TargetMetricAmount','txt_Item_{$GoalItemID}_TargetMetricWhat',
                                                                           'div_{$GoalItemID}_GoalDetail','{$Track}','{$ParticipantUserID}','ddl_GoalPortalMetric_{$GoalItemID}',
                                                                           '{$PageNumber}','{$PageSize}');">
										<img id="img_Save" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle" class="marginRight5"></img>
										<span id="span_Save">SAVE</span>
									</td>
								</tr>
							</table>
						</div>
					</div>
				</td>
			</tr>
		</table>
	</xsl:template>

	<xsl:template name="GoalMetricLayout">
		<xsl:param name="Updating" select="'N/A'"></xsl:param>
		<xsl:param name="MetricHeaderXML" select="'N/A'"></xsl:param>
		<xsl:param name="GoalNotesFormat" select="'N/A'"></xsl:param>
		<xsl:param name="LoggedInUserID" select="'N/A'"></xsl:param>
		<xsl:param name="HostName" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="TemplateURL" select="'N/A'"></xsl:param>
		<xsl:param name="PeriodData" select="'N/A'"></xsl:param>
		<xsl:param name="ParticipantUserID" select="'N/A'"></xsl:param>
		<xsl:param name="NumbersEnteredBy" select="'N/A'"></xsl:param>
		<xsl:param name="PortalMetricsXML" select="'N/A'"></xsl:param>
		<xsl:param name="OfWhat" select="'N/A'"></xsl:param>
		<xsl:param name="Track" select="'N/A'"></xsl:param>
		<xsl:param name="PermissionID" select="'N/A'"></xsl:param>
		<xsl:param name="PageNumber" select="'N/A'"></xsl:param>
		<xsl:param name="PageSize" select="'N/A'"></xsl:param>


		<xsl:variable name="NextPageNumber">
			<xsl:value-of select="$PageNumber + 1"/>
		</xsl:variable>

		<xsl:variable name="PrevPageNumber">
			<xsl:value-of select="$PageNumber - 1"/>
		</xsl:variable>

		<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
		<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />


		<xsl:variable name="GoalMetricTotalPages">

			<xsl:choose>
				<xsl:when test="$PeriodData/Period[translate(PeriodType, $smallcase, $uppercase) = translate($Track, $smallcase, $uppercase)]/TotalPages">
					<xsl:value-of select="$PeriodData/Period[translate(PeriodType, $smallcase, $uppercase) = translate($Track, $smallcase, $uppercase)]/TotalPages"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:number value="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="SubMetricTotalPages">
			<xsl:choose>
				<xsl:when test="count($MetricHeaderXML/Metrics/Metric[MetricType = 'SubMetric']) &gt; 0
                          and $PeriodData/Period[translate(PeriodType, $smallcase, $uppercase) = translate($Updating, $smallcase, $uppercase)]/TotalPages">
					<xsl:value-of select="$PeriodData/Period[translate(PeriodType, $smallcase, $uppercase) = translate($Updating, $smallcase, $uppercase)]/TotalPages"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:number value="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="TotalPages">
			<xsl:choose>
				<xsl:when test="$GoalMetricTotalPages &gt; $SubMetricTotalPages">
					<xsl:number value="$GoalMetricTotalPages"/>
				</xsl:when>
				<xsl:when test="$GoalMetricTotalPages &lt; $SubMetricTotalPages">
					<xsl:number value="$SubMetricTotalPages"/>
				</xsl:when>
				<xsl:when test="$GoalMetricTotalPages = $SubMetricTotalPages">
					<xsl:number value="$GoalMetricTotalPages"/>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>


		<table cellpadding="2" cellspacing="0" class="tableMaster" border="0">
			<tr>
				<td>
					<table id="tbl_MetricLayoutGrid" class="tableMaster">
						<xsl:call-template name="GoalMetricsLayoutGrid">
							<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
							<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
							<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
							<xsl:with-param name="PeriodData" select="$PeriodData"></xsl:with-param>
							<xsl:with-param name="smallcase" select="$smallcase"></xsl:with-param>
							<xsl:with-param name="uppercase" select="$uppercase"></xsl:with-param>
							<xsl:with-param name="MetricHeaderXML" select="$MetricHeaderXML"></xsl:with-param>
							<xsl:with-param name="NumbersEnteredBy" select="$NumbersEnteredBy"></xsl:with-param>
							<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
							<xsl:with-param name="Track" select="$Track"></xsl:with-param>
							<xsl:with-param name="TotalPages" select="$TotalPages"></xsl:with-param>
							<xsl:with-param name="PrevPageNumber" select="$PrevPageNumber"></xsl:with-param>
							<xsl:with-param name="NextPageNumber" select="$NextPageNumber"></xsl:with-param>
							<xsl:with-param name="PageSize" select="$PageSize"></xsl:with-param>
						</xsl:call-template>
					</table>
				</td>
			</tr>



			<tr>
				<td colspan="9">
					<xsl:call-template name="AddMetricTemplate">
						<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
						<xsl:with-param name="PortalMetricsXML" select="$PortalMetricsXML"></xsl:with-param>
						<xsl:with-param name="Updating" select="$Updating"></xsl:with-param>
						<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
						<xsl:with-param name="OfWhat" select="$OfWhat"></xsl:with-param>
						<xsl:with-param name="Track" select="$Track"></xsl:with-param>
						<xsl:with-param name="ParticipantUserID" select="$ParticipantUserID"></xsl:with-param>
						<xsl:with-param name="PageNumber" select="$PageNumber"></xsl:with-param>
						<xsl:with-param name="PageSize" select="$PageSize"></xsl:with-param>
					</xsl:call-template>
				</td>

			</tr>
			
		</table>
	</xsl:template>


	<xsl:template name="GoalMetricsLayoutGrid">
		<xsl:param name="PermissionID" select="'N/A'"></xsl:param>
		<xsl:param name="TemplateURL" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="PeriodData" select="'N/A'"></xsl:param>
		<xsl:param name="smallcase" select="'N/A'"></xsl:param>
		<xsl:param name="uppercase" select="'N/A'"></xsl:param>
		<xsl:param name="MetricHeaderXML" select="'N/A'"></xsl:param>
		<xsl:param name="NumbersEnteredBy" select="'N/A'"></xsl:param>
		<xsl:param name="ParticipantUserID" select="'N/A'"></xsl:param>
		<xsl:param name="Track" select="'N/A'"></xsl:param>
		<xsl:param name="TotalPages" select="'N/A'"></xsl:param>
		<xsl:param name="PrevPageNumber" select="'N/A'"></xsl:param>
		<xsl:param name="NextPageNumber" select="'N/A'"></xsl:param>
		<xsl:param name="PageSize" select="'N/A'"></xsl:param>


		<xsl:for-each select="$MetricHeaderXML/Metrics/Metric[
					  generate-id() = generate-id(key('distinctPeriodType', ./PeriodType))
					  and PeriodType != 'Never'
			]">
			<xsl:sort data-type="number" select="MetricSort" order="ascending"/>
			<xsl:variable name="PeriodType" select="PeriodType"></xsl:variable>
			<xsl:variable name="MetricType" select="MetricType"></xsl:variable>

			<xsl:variable name="GoalMetricPadding">
				<xsl:choose>
					<xsl:when test="$MetricType = 'GoalMetric'">
						<xsl:text>paddingTop10</xsl:text>
					</xsl:when>
					<xsl:otherwise>
						<xsl:text></xsl:text>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>

			<xsl:variable name="VarCounterXML">
				<Counter>
					<Count>1</Count>
					<Count>2</Count>
					<Count>3</Count>
					<Count>4</Count>
					<Count>5</Count>
					<Count>6</Count>
					<Count>7</Count>
				</Counter>
			</xsl:variable>

			<tr class="{$GoalMetricPadding}">
				<td width="2%" nowrap="nowrap"></td>
				<td width="21%" nowrap="nowrap">
					<span class="actionCountText sentenceFont">
						<xsl:value-of select="PeriodType"/>
					</span>
				</td>
				<xsl:for-each select="$PeriodData/Period[translate(PeriodType, $smallcase, $uppercase) = translate($PeriodType, $smallcase, $uppercase)]">
					<td width="11%" class="textCenter" nowrap="nowrap">
						<span class="actionCountText sentenceFont">
							<xsl:value-of select="Period"/>
						</span>
					</td>
				</xsl:for-each>

				<xsl:variable name="TotalPeriodCount" select="count($PeriodData/Period[translate(PeriodType, $smallcase, $uppercase) = translate($PeriodType, $smallcase, $uppercase)])"></xsl:variable>

				<xsl:for-each select="msxsl:node-set($VarCounterXML)/Counter/Count[. &gt; $TotalPeriodCount]">
					<td width="11%" class="textCenter" nowrap="nowrap">
						<span class="actionCountText sentenceFont">&#xa0;</span>
					</td>
				</xsl:for-each>

			</tr>

			<xsl:for-each select="$MetricHeaderXML/Metrics/Metric[translate(PeriodType, $smallcase, $uppercase) = translate($PeriodType, $smallcase, $uppercase)]">
				<xsl:sort data-type="number" select="MetricSort" order="ascending"/>

				<xsl:variable name="MetricItemID" select="ItemID"></xsl:variable>
				<xsl:variable name="Metric" select="Metric"></xsl:variable>
				<xsl:variable name="GoalNumberFormat" select="GoalNumberFormat"></xsl:variable>
				<xsl:variable name="NumberFormat" select="NumberFormat"></xsl:variable>
				<xsl:variable name="Target" select="Target"></xsl:variable>
				<xsl:variable name="InputType" select="InputType"></xsl:variable>
				<xsl:variable name="EscapedMetricKey">
					<xsl:call-template name="replaceCharsInString">
						<xsl:with-param name="stringIn" select="$Metric"></xsl:with-param>
						<xsl:with-param name="charsIn">
							<xsl:text>'</xsl:text>
						</xsl:with-param>
						<xsl:with-param name="charsOut">
							<xsl:text>\'</xsl:text>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="TargetVisbility">
					<xsl:choose>
						<xsl:when test="$InputType ='None' or $InputType ='Label'">
							<xsl:text>visibility: hidden;</xsl:text>
						</xsl:when>
					</xsl:choose>
				</xsl:variable>

				<xsl:variable name="MetricOnClickCall">
					<xsl:choose>
						<xsl:when test="($PermissionID = 3 or $PermissionID &gt;= 4) and MetricType != 'GoalMetric'">
							GoalNumbers_DisplayMetricTargetUpdatePanel(<xsl:value-of select="$MetricItemID"/>)
						</xsl:when>
					</xsl:choose>
				</xsl:variable>

				<xsl:variable name="MetricFontBold">
					<xsl:choose>
						<xsl:when test="MetricType = 'GoalMetric'">
							<xsl:text>actionCountText</xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>labelGoalActionsText</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>

				<xsl:variable name="MetricFontItalic">
					<xsl:choose>
						<xsl:when test="MetricType = 'GoalMetric'">
							<xsl:text>font-style:italic;</xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>font-style:normal;</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>

				<tr id="tr_Metric_{$MetricItemID}"
                    onmouseover="document.getElementById('img_Delete_{$MetricItemID}').style.display = 'inline';"
                        onmouseout="document.getElementById('img_Delete_{$MetricItemID}').style.display = 'none';">

					<td width="2%" class="numberGoalCellPadding verticallyMiddle">
						<xsl:if test="MetricType != 'GoalMetric' and $PermissionID &gt;= 4">
							<img id="img_Delete_{$MetricItemID}" src="{$TemplateURL}Web/Images/Ver_2_0/BT_x.png" height="10" width="7" style="display:none;"
                                align="absmiddle" class="onMouseOver"
                                onClick="deleteMetric('{$GoalItemID}','{$MetricItemID}')"></img>
						</xsl:if>
					</td>

					<td width="21%" class="numberGoalCellPadding verticallyMiddle" nowrap="nowrap">
						<span class="labelGoalActionsText {$MetricFontBold} onMouseOver actionCountText  " style="{$MetricFontItalic}"
                              onclick="{$MetricOnClickCall};
                           document.getElementById('tr_Metric_{$MetricItemID}_TargetUpdate_Ctrl').focus();"
                              onmouseover="this.style.textDecoration='underline';"
                              onmouseout="this.style.textDecoration='none';">
							<xsl:choose>
								<xsl:when test="$InputType ='None' or $InputType ='Label'">
									<strong>
										<u>
											<xsl:value-of select="$Metric"/>
										</u>
									</strong>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="$Metric"/>
								</xsl:otherwise>
							</xsl:choose>
							
						</span>

						<span class="labelGoalActionsText sentenceFont link" id="tr_Metric_{$MetricItemID}_TargetDisplay"
                                  onClick="{$MetricOnClickCall};
                               document.getElementById('tr_Metric_{$MetricItemID}_TargetUpdate_Ctrl').focus();" style="{$TargetVisbility}">
							<xsl:choose>
								<xsl:when test="$Target &lt; 0">
									( <xsl:value-of select ="$Target"/> )
								</xsl:when>
								<xsl:when test="$Target = 0">
									( <xsl:number value="0"/> )
								</xsl:when>
								<xsl:when test="format-number($Target, '###,###.##') != 'NaN'">
									( <xsl:value-of select ="format-number($Target, '###,###.##')"/> )
								</xsl:when>
							</xsl:choose>
						</span>
						<xsl:variable name="MetricTarget">
							<xsl:choose>
								<xsl:when test="$Target = 0">
									<xsl:number value="0"/>
								</xsl:when>
								<xsl:when test="format-number($Target, '###,###.##') != 'NaN'">
									<xsl:value-of select="format-number($Target, '###,###.##')"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text></xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>

						<span class="labelGoalActionsText sentenceFont link" id="tr_Metric_{$MetricItemID}_TargetUpdate" style="display:none;{$TargetVisbility}">
							<input id="tr_Metric_{$MetricItemID}_TargetUpdate_Ctrl"
                               style="width:40px;text-align:right;margin-right:10px;"
                               value="{$MetricTarget}" onBlur='GoalNumbers_UpdateMetricTarget({$MetricItemID});'></input>
						</span>
					</td>
					<xsl:for-each select="$PeriodData/Period[translate(PeriodType, $smallcase, $uppercase) = translate($PeriodType, $smallcase, $uppercase)]">
						<xsl:variable name="PeriodKey" select="PeriodKey"></xsl:variable>
						<xsl:variable name="Period" select="Period"></xsl:variable>
						<xsl:variable name="Amount" select="$MetricHeaderXML/Metrics/Metric/MetricData/MetricDataRecord[PeriodKey = $PeriodKey and DataKey = $Metric]/Amount"></xsl:variable>

						<xsl:variable name="DisplayTextBox">
							<xsl:choose>
								<xsl:when test ="format-number($Amount, '###,###')!='NaN' or $NumbersEnteredBy = 0">
									<xsl:text>display:none;</xsl:text>
								</xsl:when>
								<xsl:otherwise>display:inline-block;</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>

						<xsl:variable name="DisplayImage">
							<xsl:choose>
								<xsl:when test ="format-number($Amount, '###,###')!='NaN'">
									<xsl:text>display:inline;</xsl:text>
								</xsl:when>
								<xsl:otherwise>display:none;</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>

						<xsl:variable name="TextFirstPeriodVisible">
							<xsl:choose>
								<xsl:when test ="format-number($Amount, '###,###') != 'NaN'">
									<xsl:text>display:inline;</xsl:text>
								</xsl:when>
								<xsl:otherwise>display:none;</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>

						<xsl:choose>
							<xsl:when test="$GoalNumberFormat = 'Y/N'">
								<td class="numberGoalCellPadding textRight verticallyMiddle" width="11%">
									<xsl:choose>
										<xsl:when test="$Amount = 1 and $GoalNumberFormat = 'Y/N'">
											<input id="txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}" type="checkbox" checked="checked"
                                            onclick="SaveAmountForPeriodKey('txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}','{$PeriodKey}','{$GoalItemID}','0','{$ParticipantUserID}'
                                                       ,'{$PeriodKey}','{$NumberFormat}','{$EscapedMetricKey}','{$MetricItemID}','{$Track}');"
                                           style="background-color:#00FF00; border: solid 1px #006699; border-bottom: dashed 3px; #000;"></input>
										</xsl:when>
										<xsl:when test="$InputType='None' or $InputType='Label'">

										</xsl:when>
										<xsl:otherwise>
											<input id="txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}" type="checkbox"
                                            onclick="SaveAmountForPeriodKey('txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}','{$PeriodKey}','{$GoalItemID}','0','{$ParticipantUserID}'
                                                       ,'{$PeriodKey}','{$NumberFormat}','{$EscapedMetricKey}','{$MetricItemID}','{$Track}');"
                                           style="background-color:#00FF00; border: solid 1px #006699; border-bottom: dashed 3px; #000;"></input>
										</xsl:otherwise>
									</xsl:choose>
								</td>
							</xsl:when>
							<xsl:otherwise>

								<xsl:variable name="SpanOnClick">
									<!--NumbersEnteredBy Determine whether user can enter or edit data
                                        If NumbersEnteredBy = 1 or -99 then user can add/edit numbers
                                        If NumbersEnteredBy = 0 then user can't add with-->
									<xsl:if test="$NumbersEnteredBy = 1">
										document.getElementById('span_Amount_<xsl:value-of select="$MetricItemID"></xsl:value-of>_<xsl:value-of select="$PeriodKey"></xsl:value-of>').style.display = 'none';
										document.getElementById('txt_PeriodKeyValue_<xsl:value-of select="$MetricItemID"></xsl:value-of>_<xsl:value-of select="$PeriodKey"></xsl:value-of>').style.display = 'inline';
										document.getElementById('txt_PeriodKeyValue_<xsl:value-of select="$MetricItemID"></xsl:value-of>_<xsl:value-of select="$PeriodKey"></xsl:value-of>').focus();
									</xsl:if>
								</xsl:variable>

								<xsl:variable name="NumberFormatDisplay">
									<xsl:choose>
										<xsl:when test="$Amount = 0">
											<xsl:number value="0"/>
										</xsl:when>
										<xsl:when test="$Amount = round($Amount) or $Amount >= 1000">
											<xsl:value-of select="format-number($Amount, '###,###')"></xsl:value-of>
										</xsl:when>
										<xsl:otherwise>
											<xsl:choose>
												<xsl:when test="(round($Amount * 10 * 10) div 100) = (round($Amount * 10) div 10)">
													<xsl:value-of select ="format-number($Amount, '###,###.00', 'format1')"/>
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select ="format-number($Amount, '###,###.##')"/>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>

								<td class="numberGoalCellPadding textRight verticallyMiddle" width="11%">
									<span class="labelGoalActionsText lblGoalActioMVP">
										<span id="span_Amount_{$MetricItemID}_{PeriodKey}" class="onMouseOver lblGoalActioMVP_Child"
                                              onmouseover="this.style.textDecoration='underline';"
                                              onmouseout="this.style.textDecoration = 'none';"
                                              onclick="{$SpanOnClick}">
											<xsl:choose>
												<xsl:when test ="$NumberFormat = '$' and string($Amount)!='NaN'">
													<span id="span_NumberFormat_{$MetricItemID}_{PeriodKey}" style="margin-right:2px;">$</span>
												</xsl:when>
												<xsl:when test ="$NumberFormat = '#' and string($Amount)!='NaN'">
													<span id="span_NumberFormat_{$MetricItemID}_{PeriodKey}" style="margin-right:2px;"></span>
												</xsl:when>
											</xsl:choose>
											<span id="span_Amount_lbl_{$MetricItemID}_{$PeriodKey}" style="{$TextFirstPeriodVisible}">
												<xsl:value-of select="$NumberFormatDisplay"/>
											</span>
										</span>
									</span>
									<xsl:choose>
										<xsl:when test ="format-number($Amount, '###,###')!='NaN'">
											<input id="txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}" type="text" value="{$NumberFormatDisplay}"
                                                   style="{$DisplayTextBox}" class="numberGoalTextBox"
                                                   onblur="SaveAmountForPeriodKey('txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}','{$PeriodKey}','{$GoalItemID}','0','{$ParticipantUserID}'
                                               ,'{$PeriodKey}','{$NumberFormat}','{$EscapedMetricKey}','{$MetricItemID}','{$Track}'); numberOnlyForNumbers('txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}');"></input>
										</xsl:when>
										<xsl:when test="$InputType='None' or $InputType='Label'">
											
										</xsl:when>
										<xsl:otherwise>
											<input id="txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}" type="text"
                                                   style="{$DisplayTextBox}" tabindex="{position() + 7}" class="numberGoalTextBox"
                                                   onblur="SaveAmountForPeriodKey('txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}','{$PeriodKey}','{$GoalItemID}','0','{$ParticipantUserID}','{$PeriodKey}'
                                               ,'{$NumberFormat}','{$EscapedMetricKey}','{$MetricItemID}','{$Track}'); numberOnlyForNumbers('txt_PeriodKeyValue_{$MetricItemID}_{$PeriodKey}');"></input>
										</xsl:otherwise>
									</xsl:choose>
								</td>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:for-each>

					<xsl:variable name="TotalPeriodCountLevel1" select="count($PeriodData/Period[translate(PeriodType, $smallcase, $uppercase) = translate($PeriodType, $smallcase, $uppercase)])"></xsl:variable>

					<xsl:for-each select="msxsl:node-set($VarCounterXML)/Counter/Count[. &gt; $TotalPeriodCountLevel1]">
						<td width="11%" class="numberGoalCellPadding textCenter">
							<span class="actionCountText sentenceFont">&#xa0;</span>
						</td>
					</xsl:for-each>
				</tr>
			</xsl:for-each>


		</xsl:for-each>
		<tr>
			<td colspan="5" style="padding-top:10px;">
				<span class="labelAddMetricText" style="display:block;margin-left:10px;" id="lbl_{$GoalItemID}_AddMetric"
                      onClick="goalProgress_DisplayLastEdit('div_{$GoalItemID}_AddMetric',
                          'lbl_{$GoalItemID}_AddMetric','Add','{$GoalItemID}');">+ ADD A METRIC</span>
			</td>
			<td class="textRight">
				<xsl:if test="$TotalPages &gt; 1 and $PrevPageNumber &gt; 0">
					<span class="labelGoalTitle onMouseOver"
                          onclick="Goal_LoadFiteredNumbers_3_0({$GoalItemID},'div_Goal_{$GoalItemID}_Operations','span_MyProgress_{$GoalItemID}','{$PrevPageNumber}','{$PageSize}');">
						&lt;&lt; Next
					</span>
					
				</xsl:if>
			</td>
			<td class="textRight">
				<xsl:if test="$TotalPages &gt; 1 and $NextPageNumber &lt;= $TotalPages">
					<span class="labelGoalTitle onMouseOver"
                          onclick="Goal_LoadFiteredNumbers_3_0({$GoalItemID},'div_Goal_{$GoalItemID}_Operations','span_MyProgress_{$GoalItemID}','{$NextPageNumber}','{$PageSize}');">
						Prev >>
					</span>
				</xsl:if>
			</td>
		</tr>
	</xsl:template>


	<xsl:template name="GoalMetricsHeader">
		<xsl:param name="Updating" select="'N/A'"></xsl:param>
		<xsl:param name="DayOfWeek" select="'N/A'"></xsl:param>
		<xsl:param name="Month" select="'N/A'"></xsl:param>
		<xsl:param name="ThisWeekend" select="'N/A'"></xsl:param>
		<xsl:param name="Year" select="'N/A'"></xsl:param>
		<xsl:param name="Quarter" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousDayOfWeek" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousMonth" select="'N/A'"></xsl:param>
		<xsl:param name="LastWeekend" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousYear" select="'N/A'"></xsl:param>
		<xsl:param name="PreviousQuarter" select="'N/A'"></xsl:param>



		<tr id="tr_AddMetricMessage" style="display:none;">
			<td colspan='4' style="padding-top:15px;">
				<div width="100%" class="labelGoalActionsText" align="center">
					Create your own metrics and track them&#xa0;<xsl:value-of select ="$Updating"/>
				</div>
			</td>
		</tr>
		<tr>
			<td width="5%"></td>
			<td width="28%" style="padding-top:15px;" class="actionCountText textLeft">Metrics</td>
			<td width="25%" style="padding-top:15px;" class="actionCountText sentenceFont textCenter">
				<xsl:choose>
					<xsl:when test ="$Updating = 'Daily'">
						for&#xa0;<xsl:value-of select="$DayOfWeek"/>
					</xsl:when>
					<xsl:when test ="$Updating = 'Monthly'">
						for&#xa0;<xsl:value-of select ="$Month"/>
					</xsl:when>
					<xsl:when test ="$Updating = 'Weekly'">
						for&#xa0;<xsl:value-of select ="$ThisWeekend"/>
					</xsl:when>
					<xsl:when test ="$Updating = 'Quarterly'">
						for&#xa0;<xsl:value-of select ="$Year"/>-<xsl:value-of select ="$Quarter"/>
					</xsl:when>
					<xsl:when test ="$Updating = 'Annually'">
						for&#xa0;<xsl:value-of select ="$Year"/>
					</xsl:when>
				</xsl:choose>
			</td>
			<td width="25%" style="padding-top:15px;" class="actionCountText sentenceFont textCenter">
				<xsl:choose>
					<xsl:when test ="$Updating = 'Daily'">
						for&#xa0;<xsl:value-of select="$PreviousDayOfWeek"/>
					</xsl:when>
					<xsl:when test ="$Updating = 'Monthly'">
						for&#xa0;<xsl:value-of select ="$PreviousMonth"/>
					</xsl:when>
					<xsl:when test ="$Updating = 'Weekly'">
						for&#xa0;<xsl:value-of select ="$LastWeekend"/>
					</xsl:when>
					<xsl:when test ="$Updating = 'Quarterly'">
						for&#xa0;<xsl:value-of select ="$PreviousYear"/>-<xsl:value-of select ="$PreviousQuarter"/>
					</xsl:when>
					<xsl:when test ="$Updating = 'Annually'">
						for&#xa0;<xsl:value-of select ="$PreviousYear"/>
					</xsl:when>
				</xsl:choose>
			</td>
		</tr>
	</xsl:template>
</xsl:stylesheet>
