﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
	<xsl:output method="xml" indent="yes"/>

	<xsl:template name="Slider">
		<xsl:param name="Min" select="'N/A'"></xsl:param>
		<xsl:param name="Max" select="'N/A'"></xsl:param>
		<xsl:param name="curMetric" select="'N/A'"></xsl:param>
		<xsl:param name="EscapedMetricKey" select="'N/A'"></xsl:param>
		<xsl:param name="curPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetricFormat" select="'N/A'"></xsl:param>
		<xsl:param name="Amount" select="'N/A'"></xsl:param>
		<xsl:param name="ItemID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="UserID" select="'N/A'"></xsl:param>
		<xsl:param name="classXS" select="'N/A'"></xsl:param>
		<xsl:param name="curColPeriodType" select="'N/A'"></xsl:param>

		<xsl:variable name="xs">
			<xsl:choose>
				<xsl:when test="$classXS='XS7'">
					<xsl:text>col-xs-8</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>col-xs-5</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="sliderID">
			<xsl:value-of select="ItemID"/>
			<xsl:text>_</xsl:text>
			<xsl:value-of select="$curPeriodKey"/>
		</xsl:variable>

		<!--<span class="col-md-5 col-sm-5 {$xs} PdgRgt ">-->
		<span class="col-xs-4 col-md-4 col-sm-4 PdgRgt ">
			<xsl:choose>
				<xsl:when test="$curMetricFormat = 'Y/N'">
					<input id="ex{$sliderID}" type="text" class="form-control txtnumbrformat text-right" data-slider-min="{$Min}" data-slider-max="{$Max}"
						   data-slider-step="1" data-slider-value='{$Amount}' data-value="{$Amount}"
						   value="{$Amount}"
						   style="display: none;width:62%;" />
				</xsl:when>
				<xsl:otherwise>
					<input id="ex{$sliderID}" class="form-control txtnumbrformat text-right" type="text" data-slider-min="{$Min}" data-slider-max="{$Max}"
						   data-slider-step="1" data-slider-value='{$Amount}' data-value="{$Amount}"
						   value="{$Amount}"
						   style="display: none;width:62%;" />
				</xsl:otherwise>
			</xsl:choose>
			<span class="val">
				<a href="#" onclick="return false">
					<span id="ex{$sliderID}SliderVal">
						<xsl:value-of select="$Amount"/>
					</span>
				</a>
			</span>
		</span>
		<script>
			var slider = new Slider("#ex<xsl:value-of select="$sliderID"></xsl:value-of>");
			slider.on("slideStop", function (slideEvt) {
			$("#ex<xsl:value-of select="$sliderID"></xsl:value-of>SliderVal").text(slideEvt);
			SaveAmountForPeriodKey_3_0('ex<xsl:value-of select="$sliderID"></xsl:value-of>'
			,'<xsl:value-of select="$curPeriodKey"></xsl:value-of>'
			,'<xsl:value-of select="$GoalItemID"></xsl:value-of>','0'
			,'<xsl:value-of select="$UserID"></xsl:value-of>'
			,'<xsl:value-of select="$curPeriodKey"></xsl:value-of>'
			,'<xsl:value-of select="''"></xsl:value-of>'
			,'<xsl:value-of select="$EscapedMetricKey"></xsl:value-of>',<xsl:value-of select="$ItemID"/>
			,'','<xsl:value-of select="$curColPeriodType"/>');
			});
			$("#ex<xsl:value-of select="$sliderID"></xsl:value-of>SliderVal").click(function() {
			destroySlider("ex<xsl:value-of select="$sliderID"></xsl:value-of>");

			});
			$("#ex<xsl:value-of select="$sliderID"></xsl:value-of>").blur(function(){
			var value=document.getElementById('ex<xsl:value-of select="$sliderID"></xsl:value-of>').value;
			document.getElementById('ex<xsl:value-of select="$sliderID"></xsl:value-of>').removeAttribute("data-slider-value");
			document.getElementById('ex<xsl:value-of select="$sliderID"></xsl:value-of>').removeAttribute("data-value");
			document.getElementById('ex<xsl:value-of select="$sliderID"></xsl:value-of>').setAttribute("data-slider-value",value);
			document.getElementById('ex<xsl:value-of select="$sliderID"></xsl:value-of>').setAttribute("data-value",value);

			$("#ex<xsl:value-of select="$sliderID"></xsl:value-of>SliderVal").text(value);

			var slider = new Slider("#ex<xsl:value-of select="$sliderID"></xsl:value-of>");
			slider.on("slideStop", function (slideEvt) {
			$("#ex<xsl:value-of select="$sliderID"></xsl:value-of>SliderVal").text(slideEvt);
			SaveAmountForPeriodKey_3_0('ex<xsl:value-of select="$sliderID"></xsl:value-of>'
			,'<xsl:value-of select="$curPeriodKey"></xsl:value-of>'
			,'<xsl:value-of select="$GoalItemID"></xsl:value-of>','0'
			,'<xsl:value-of select="$UserID"></xsl:value-of>'
			,'<xsl:value-of select="$curPeriodKey"></xsl:value-of>'
			,'<xsl:value-of select="''"></xsl:value-of>'
			,'<xsl:value-of select="$EscapedMetricKey"></xsl:value-of>',<xsl:value-of select="$ItemID"/>
			,'','<xsl:value-of select="$curColPeriodType"/>');
			});
			SaveAmountForPeriodKey_3_0('ex<xsl:value-of select="$sliderID"></xsl:value-of>'
			,'<xsl:value-of select="$curPeriodKey"></xsl:value-of>'
			,'<xsl:value-of select="$GoalItemID"></xsl:value-of>','0'
			,'<xsl:value-of select="$UserID"></xsl:value-of>'
			,'<xsl:value-of select="$curPeriodKey"></xsl:value-of>'
			,'<xsl:value-of select="''"></xsl:value-of>'
			,'<xsl:value-of select="$EscapedMetricKey"></xsl:value-of>',<xsl:value-of select="$ItemID"/>
			,'','<xsl:value-of select="$curColPeriodType"/>');

			});
		</script>

	</xsl:template>

	<xsl:template name="TextNumber">
		<xsl:param name="EscapedMetricKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetric" select="'N/A'"></xsl:param>
		<xsl:param name="curPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetricFormat" select="'N/A'"></xsl:param>
		<xsl:param name="Amount" select="'N/A'"></xsl:param>
		<xsl:param name="ItemID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="UserID" select="'N/A'"></xsl:param>
		<xsl:param name="tabIndex" select="'N/A'"></xsl:param>
		<xsl:param name="NumbersEnteredBy" select="'N/A'"></xsl:param>
		<xsl:param name="classXS" select="'N/A'"></xsl:param>
		<xsl:param name="ControlStatus" select="'N/A'"></xsl:param>
		<xsl:param name="curColPeriodType" select="'N/A'"></xsl:param>
		<xsl:param name="NumberPrecision" select="'N/A'"></xsl:param>
		<xsl:variable name="NumberPrecisionVal">
			<xsl:choose>
				<xsl:when test="$NumberPrecision">
					<xsl:value-of select="$NumberPrecision"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>0</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		
		<xsl:variable name="xs">
			<xsl:text>col-xs-4 col-md-4 col-sm-4</xsl:text>
			<!--<xsl:choose>
				<xsl:when test="$classXS='XS7'">
					<xsl:text>col-xs-8 col-md-8 col-sm-5 form-group</xsl:text>
				</xsl:when>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>col-xs-12 col-md-12 col-sm-12 font10</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>col-xs-5 col-md-5 col-sm-5</xsl:text>
				</xsl:otherwise>
			</xsl:choose>-->
		</xsl:variable>
		<xsl:variable name="NumberFormat">
			<xsl:text>#</xsl:text>
		</xsl:variable>
		<xsl:variable name="inputHeight">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>height:18px !important;</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="xsInput">
			<xsl:text>col-xs-4 col-md-3 col-sm-3</xsl:text>
			<!--<xsl:choose>
				<xsl:when test="$classXS='XS7'">
					<xsl:text>col-xs-8 col-md-8 col-sm-5</xsl:text>
				</xsl:when>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text></xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>col-xs-5 col-md-5 col-sm-5</xsl:text>
				</xsl:otherwise>
			</xsl:choose>-->
		</xsl:variable>
		<xsl:variable name="DisplayTextBox">
			<xsl:choose>
				<xsl:when test ="format-number($Amount, '###,###')!='NaN'">
					<xsl:text>display:none;</xsl:text>
				</xsl:when>
				<xsl:otherwise>display:inline-block;</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="DisplaySpan">
			<xsl:choose>
				<xsl:when test ="format-number($Amount, '###,###')!='NaN'">
					<xsl:text>display:inline-block;</xsl:text>
				</xsl:when>
				<xsl:otherwise>display:none;</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="onclickSpanFn">
			<xsl:choose>
				<xsl:when test="$NumbersEnteredBy != 0">
					<xsl:text>document.getElementById('span_Amount_</xsl:text>
					<xsl:value-of select="$ItemID"></xsl:value-of>
					<xsl:text>_</xsl:text>
					<xsl:value-of select="$curPeriodKey"></xsl:value-of>
					<xsl:text>').style.display = 'none';
					document.getElementById('txt_PeriodKeyValue_</xsl:text>
					<xsl:value-of select="$ItemID"></xsl:value-of>
					<xsl:text>_</xsl:text>
					<xsl:value-of select="$curPeriodKey"></xsl:value-of>
					<xsl:text>').style.display = 'inline';
					document.getElementById('txt_PeriodKeyValue_</xsl:text>
					<xsl:value-of select="$ItemID"></xsl:value-of>
					<xsl:text>_</xsl:text>
					<xsl:value-of select="$curPeriodKey"></xsl:value-of>
					<xsl:text>').focus();</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="OnClickInputFunction">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>compareActualTarget('clsTxtActual_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>','txtTarget_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>','icnTarget_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>'); </xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>

		</xsl:variable>
		<xsl:variable name="txtBoxClass">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text></xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>form-control</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="FormatAmount" select="format-number($Amount, $NumberPrecisionVal)"></xsl:variable>
		<xsl:variable name="KeyUpCall">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>calculateTotal('clsInputActual', 'spanTotalActual');</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<!--<span class="labelGoalActionsText  {$xs} text-right" style="margin-bottom:0px;">-->


		<xsl:if test="$ControlStatus !=1">
			<xsl:choose>
				<xsl:when test ="format-number($Amount, '###,###')!='NaN' and $NumbersEnteredBy !=0">
					<span class="DWidthdiv30 {$xsInput}" style="padding-right:0px;padding-left: 0px;">
						<div class="input-group riteinput PadL0Wid100">
							<input id="txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}" type="text" value="{$FormatAmount}"
								   style="{$DisplayTextBox};width:100%!important;margin:0px;{$inputHeight}" class="{$txtBoxClass}   txtnumbrformat text-right clsInputActual clsTxtActual_{$curPeriodKey}"
								   onblur="SaveAmountForPeriodKey_3_0('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}','{$curPeriodKey}'
					   ,'{$GoalItemID}','0',{$UserID},'{$curPeriodKey}','{$NumberFormat}','{$EscapedMetricKey}',{$ItemID},'','{$curColPeriodType}'); 
					   numberOnlyForNumbers('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}');" tabindex="{$tabIndex}" onkeyup="{$KeyUpCall}{$OnClickInputFunction}"></input>
						</div>
						<span class="labelGoalActionsText" style="margin-bottom:0px;">
							<span  style="margin-right:0px;font-weight:normal;{$DisplaySpan} " id="span_Amount_{$ItemID}_{$curPeriodKey}"
								  class="onMouseOver spannumbrformt nmberFont spanR"
								  onmouseover="this.style.textDecoration='underline';"
								  onmouseout="this.style.textDecoration = 'none';"
								  onclick="{$onclickSpanFn}">
								<span id="span_Amount_lbl_{$ItemID}_{$curPeriodKey}"  class="OutputSpn" style="{$DisplaySpan}" >
									<xsl:value-of select="$FormatAmount"/>
								</span>
							</span>
						</span>
					</span>
				</xsl:when>
				<xsl:when test ="$NumbersEnteredBy !=0">
					<span class="DWidthdiv30 {$xsInput}" style="padding-right:0px;padding-left: 0px;">
						<div class="input-group riteinput PadL0Wid100">
							<input id="txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}" type="text"
								   style="{$DisplayTextBox};width:100%!important;margin:0px;{$inputHeight}"  class="{$txtBoxClass} smallBtn txtnumbrformat text-right clsInputActual clsTxtActual_{$curPeriodKey}"
								   onblur="SaveAmountForPeriodKey_3_0('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}','{$curPeriodKey}'
					   ,'{$GoalItemID}','0',{$UserID},'{$curPeriodKey}','{$NumberFormat}','{$EscapedMetricKey}',{$ItemID},'','{$curColPeriodType}'); 
					   numberOnlyForNumbers('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}');" tabindex="{$tabIndex}" onkeyup="{$KeyUpCall}{$OnClickInputFunction}"></input>
						</div>
						<span class="labelGoalActionsText" style="margin-bottom:0px;">
							<span  style="margin-right:0px;font-weight:normal;{$DisplaySpan}" id="span_Amount_{$ItemID}_{$curPeriodKey}"
								  class="onMouseOver spannumbrformt nmberFont spanR"
								  onmouseover="this.style.textDecoration='underline';"
								  onmouseout="this.style.textDecoration = 'none';"
								  onclick="{$onclickSpanFn}">
								<span id="span_Amount_lbl_{$ItemID}_{$curPeriodKey}" class="OutputSpn" style="{$DisplaySpan}" >
									<xsl:value-of select="$FormatAmount"/>
								</span>
							</span>
						</span>
					</span>
				</xsl:when>
				<xsl:otherwise>
					<span class="DWidthdiv30 {$xsInput}" style="padding-right:0px;padding-left: 0px;">
						<span class="labelGoalActionsText" style="margin-bottom:0px;">
							<span id="span_Amount_{$ItemID}_{$curPeriodKey}"
								 style="margin-right:0px;font-weight:normal;" class="spannumbrformt nmberFont spanR">
								<span id="span_Amount_lbl_{$ItemID}_{$curPeriodKey}"  >
									<xsl:choose>
										<xsl:when test="format-number($Amount, '###,###')!='NaN'">
											<xsl:value-of select="$FormatAmount"/>
										</xsl:when>
									</xsl:choose>
								</span>
							</span>
						</span>
					</span>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>

	</xsl:template>

	<xsl:template name="TextCurrency">
		<xsl:param name="EscapedMetricKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetric" select="'N/A'"></xsl:param>
		<xsl:param name="curPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetricFormat" select="'N/A'"></xsl:param>
		<xsl:param name="Amount" select="'N/A'"></xsl:param>
		<xsl:param name="ItemID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="UserID" select="'N/A'"></xsl:param>
		<xsl:param name="tabIndex" select="'N/A'"></xsl:param>
		<xsl:param name="NumbersEnteredBy" select="'N/A'"></xsl:param>
		<xsl:param name="classXS" select="'N/A'"></xsl:param>
		<xsl:param name="ControlStatus" select="'N/A'"></xsl:param>
		<xsl:param name="curColPeriodType" select="'N/A'"></xsl:param>
		<xsl:param name="NumberPrecision" select="'N/A'"></xsl:param>
		<xsl:variable name="NumberPrecisionVal">
			<xsl:choose>
				<xsl:when test="$NumberPrecision">
					<xsl:value-of select="$NumberPrecision"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>0</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="xs">
			<xsl:text>col-xs-4 col-md-4 col-sm-4</xsl:text>
			<!--<xsl:choose>
				<xsl:when test="$classXS='XS7'">
					<xsl:text>col-xs-8 col-md-8 col-sm-5</xsl:text>
				</xsl:when>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>col-xs-12 col-md-12 col-sm-12 font10</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>col-xs-5 col-md-5 col-sm-5</xsl:text>
				</xsl:otherwise>
			</xsl:choose>-->
		</xsl:variable>
		<xsl:variable name="inputHeight">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>height:18px !important;</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="xsInput">
			<xsl:text>col-xs-4 col-md-3 col-sm-3</xsl:text>
			<!--<xsl:choose>
				<xsl:when test="$classXS='XS7'">
					<xsl:text>col-xs-8 col-md-8 col-sm-5</xsl:text>
				</xsl:when>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text></xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>col-xs-5 col-md-5 col-sm-5</xsl:text>
				</xsl:otherwise>
			</xsl:choose>-->
		</xsl:variable>
		<xsl:variable name="NumberFormat">
			<xsl:text>$</xsl:text>
		</xsl:variable>

		<xsl:variable name="DisplayTextBox">
			<xsl:choose>
				<xsl:when test ="format-number($Amount, '###,###')!='NaN'">
					<xsl:text>display:none;</xsl:text>
				</xsl:when>
				<xsl:otherwise>display:inline-block;</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="DisplaySpan">
			<xsl:choose>
				<xsl:when test ="format-number($Amount, '###,###')!='NaN' " >
					<xsl:text>display:inline-block;</xsl:text>
				</xsl:when>
				<xsl:otherwise>display:none;</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="onclickSpanFn">
			<xsl:choose>
				<xsl:when test="$NumbersEnteredBy != 0">
					<xsl:text>document.getElementById('span_Amount_</xsl:text>
					<xsl:value-of select="$ItemID"></xsl:value-of>
					<xsl:text>_</xsl:text>
					<xsl:value-of select="$curPeriodKey"></xsl:value-of>
					<xsl:text>').style.display = 'none';
					document.getElementById('txt_PeriodKeyValue_</xsl:text>
					<xsl:value-of select="$ItemID"></xsl:value-of>
					<xsl:text>_</xsl:text>
					<xsl:value-of select="$curPeriodKey"></xsl:value-of>
					<xsl:text>').style.display = 'inline';
					document.getElementById('txt_PeriodKeyValue_</xsl:text>
					<xsl:value-of select="$ItemID"></xsl:value-of>
					<xsl:text>_</xsl:text>
					<xsl:value-of select="$curPeriodKey"></xsl:value-of>
					<xsl:text>').focus();</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="FormatAmount">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:choose>
						<xsl:when test="round($Amount)=0">
							<xsl:value-of  select="format-number($Amount, '0')"></xsl:value-of>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of  select="format-number($Amount, '###,###')"></xsl:value-of>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of  select="format-number($Amount, $NumberPrecisionVal)"></xsl:value-of>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="KeyUpCall">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>calculateTotal('clsInputActual', 'spanTotalActual');</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="OnClickInputFunction">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>compareActualTarget('clsTxtActual_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>','txtTarget_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>','icnTarget_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>'); </xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>

		</xsl:variable>
		<xsl:variable name="CurrencyText">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>$</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>$ </xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		
		<xsl:if test="$ControlStatus != 1">
			<xsl:choose>
				<xsl:when test ="format-number($Amount, '###,###')!='NaN' and $NumbersEnteredBy !=0">
					<span class="DWidthdiv30 {$xsInput}" style="padding-right:0px;padding-left: 0px;">
						<div class="input-group riteinput PadL0Wid100">
							<input id="txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}" type="text" value="{$FormatAmount}"
								   style="{$DisplayTextBox};width:100%!important;margin:0px;{$inputHeight}" class="form-control txtnumbrformat text-right inpsmal clsInputActual clsTxtActual_{$curPeriodKey}"
								   onblur="SaveAmountForPeriodKey_3_0('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}','{$curPeriodKey}'
					   ,'{$GoalItemID}','0',{$UserID},'{$curPeriodKey}','{$NumberFormat}','{$EscapedMetricKey}',{$ItemID},'','{$curColPeriodType}'); 
					   numberOnlyForNumbers('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}');" tabindex="{$tabIndex}" onkeyup="{$KeyUpCall}{$OnClickInputFunction}"></input>
						</div>
						<span class="labelGoalActionsText   text-right">
							<span id="span_Amount_{$ItemID}_{$curPeriodKey}"
								 style="margin-right:0px;{$DisplaySpan};width: 100%!important;font-weight:normal;" 
								  class="onMouseOver txtnumbrformat nmberFont spanR"
								  onmouseover="this.style.textDecoration='underline';"
								  onmouseout="this.style.textDecoration = 'none';"
								  onclick="{$onclickSpanFn}">
								<span id="span_Amount_lbl_{$ItemID}_{$curPeriodKey}" class="OutputSpn" style="{$DisplaySpan}" >
									<xsl:value-of select="$CurrencyText"/>
									<xsl:value-of select="$FormatAmount"/>
								</span>
							</span>
						</span>
					</span>
				</xsl:when>
				<xsl:when test="$NumbersEnteredBy !=0">
					<span class="DWidthdiv30 {$xsInput}" style="padding-right:0px;padding-left: 0px;">
						<div class="input-group riteinput PadL0Wid100">
							<input id="txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}" type="text"
								   style="{$DisplayTextBox};width:100%!important;margin:0px;{$inputHeight}"  class="form-control txtnumbrformat text-right inpsmal clsInputActual clsTxtActual_{$curPeriodKey}"
								   onblur="SaveAmountForPeriodKey_3_0('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}','{$curPeriodKey}'
					   ,'{$GoalItemID}','0',{$UserID},'{$curPeriodKey}','{$NumberFormat}','{$EscapedMetricKey}',{$ItemID},'','{$curColPeriodType}'); 
					   numberOnlyForNumbers('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}');" tabindex="{$tabIndex}" onkeyup="{$KeyUpCall}{$OnClickInputFunction}"></input>
						</div>
						<span class="labelGoalActionsText  text-right">
							<span id="span_Amount_{$ItemID}_{$curPeriodKey}"
								 style="margin-right:0px;{$DisplaySpan};width: 100%!important;font-weight:normal;" 
								  class="onMouseOver txtnumbrformat nmberFont spanR"
								  onmouseover="this.style.textDecoration='underline';"
								  onmouseout="this.style.textDecoration = 'none';"
								  onclick="{$onclickSpanFn}">
								<span id="span_Amount_lbl_{$ItemID}_{$curPeriodKey}" class="OutputSpn" style="{$DisplaySpan}" >
									<xsl:value-of select="$CurrencyText"/>
									<xsl:value-of select="$FormatAmount"/>
								</span>
							</span>
						</span>
					</span>
				</xsl:when>
				<xsl:otherwise>
					<span class="DWidthdiv30 {$xsInput}" style="padding-right:0px;padding-left: 0px;">
						<span class="labelGoalActionsText" style="margin-bottom:0px;">
							<span id="span_Amount_{$ItemID}_{$curPeriodKey}"
								 style="margin-right:0px;width: 100%!important;font-weight:normal;" class="spannumbrformt nmberFont spanR">
								<span id="span_Amount_lbl_{$ItemID}_{$curPeriodKey}"  >
									<xsl:choose>
										<xsl:when test="format-number($Amount, '###,###')!='NaN'">
											<xsl:value-of select="$CurrencyText"/>
											<xsl:value-of select="$FormatAmount"/>
										</xsl:when>
									</xsl:choose>
								</span>
							</span>
						</span>
					</span>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
	</xsl:template>

	<xsl:template name="CheckBox">
		<xsl:param name="EscapedMetricKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetric" select="'N/A'"></xsl:param>
		<xsl:param name="curPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetricFormat" select="'N/A'"></xsl:param>
		<xsl:param name="Amount" select="'N/A'"></xsl:param>
		<xsl:param name="ItemID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="UserID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalNumberFormat" select="'N/A'"></xsl:param>
		<xsl:param name="tabIndex" select="'N/A'"></xsl:param>
		<xsl:param name="curColPeriodType" select="'N/A'"></xsl:param>
		<xsl:choose>
			<xsl:when test="$Amount = 1 ">
				<span class="col-xs-3 col-md-3 col-sm-3 text-center" style="padding-top:6px">
					<input class="chk" id="txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}" type="checkbox" checked="checked"
					onclick="SaveAmountForPeriodKey_3_0('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}','{$curPeriodKey}','{$GoalItemID}','0','{$UserID}'
                                                       ,'{$curPeriodKey}','{$GoalNumberFormat}','{$EscapedMetricKey}','{$ItemID}','','{$curColPeriodType}');"
				   style="background-color:#00FF00; border: solid 1px #006699; border-bottom: dashed 3px; #000;width: 18px;height: 18px;"
						   tabindex="{$tabIndex}"></input>
				</span>
			</xsl:when>
			<xsl:otherwise>
				<span class="col-xs-3 col-md-3 col-sm-3 text-center"  style="padding-top:6px">
					<input class="chk" id="txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}" type="checkbox"
					onclick="SaveAmountForPeriodKey_3_0('txt_PeriodKeyValue_{$ItemID}_{$curPeriodKey}','{$curPeriodKey}','{$GoalItemID}','0','{$UserID}'
                                                       ,'{$curPeriodKey}','{$GoalNumberFormat}','{$EscapedMetricKey}','{$ItemID}','','{$curColPeriodType}');"
				   style="background-color:#00FF00; border: solid 1px #006699; border-bottom: dashed 3px; #000;width: 18px;height: 18px;"
						    tabindex="{$tabIndex}"></input>
				</span>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="CheckBox5">
		<xsl:param name="EscapedMetricKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetric" select="'N/A'"></xsl:param>
		<xsl:param name="curPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetricFormat" select="'N/A'"></xsl:param>
		<xsl:param name="Amount" select="'N/A'"></xsl:param>
		<xsl:param name="ItemID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="UserID" select="'N/A'"></xsl:param>
		<xsl:param name="curColPeriodType" select="'N/A'"></xsl:param>
		<xsl:variable name="sliderID">
			<xsl:value-of select="ItemID"/>
			<xsl:text>_</xsl:text>
			<xsl:value-of select="$curPeriodKey"/>
		</xsl:variable>
		<xsl:variable name="FormatAmount" select="format-number($Amount,'0')"></xsl:variable>


		<input id="ex{$sliderID}" type="text" data-slider-ticks="" data-slider-ticks-snap-bounds="1" data-slider-ticks-labels='1'/>

		<script>

			var slider = new Slider("#ex<xsl:value-of select="$sliderID"></xsl:value-of>",{
			ticks: [0, 1, 2, 3, 4,5],
			ticks_labels: [],
			ticks_snap_bounds: 1,value:<xsl:value-of select="$FormatAmount"/>
			});
			slider.on("slideStop", function (slideEvt) {
			$("#ex<xsl:value-of select="$sliderID"></xsl:value-of>SliderVal").text(slideEvt);
			SaveAmountForPeriodKey_3_0('ex<xsl:value-of select="$sliderID"></xsl:value-of>'
			,'<xsl:value-of select="$curPeriodKey"></xsl:value-of>'
			,'<xsl:value-of select="$GoalItemID"></xsl:value-of>','0'
			,'<xsl:value-of select="$UserID"></xsl:value-of>'
			,'<xsl:value-of select="$curPeriodKey"></xsl:value-of>'
			,'<xsl:value-of select="''"></xsl:value-of>'
			,'<xsl:value-of select="$EscapedMetricKey"></xsl:value-of>',<xsl:value-of select="$ItemID"/>,'','<xsl:value-of select="$curColPeriodType"/>');
			});

		</script>
	</xsl:template>
	<xsl:template name="Increamental">
		<xsl:param name="EscapedMetricKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetric" select="'N/A'"></xsl:param>
		<xsl:param name="curPeriodKey" select="'N/A'"></xsl:param>
		<xsl:param name="curMetricFormat" select="'N/A'"></xsl:param>
		<xsl:param name="Amount" select="'N/A'"></xsl:param>
		<xsl:param name="ItemID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="UserID" select="'N/A'"></xsl:param>
		<xsl:param name="GoalNumberFormat" select="'N/A'"></xsl:param>
		<xsl:param name="tabIndex" select="'N/A'"></xsl:param>
		<xsl:param name="NumbersEnteredBy" select="'N/A'"></xsl:param>
		<xsl:param name="classXS" select="'N/A'"></xsl:param>
		<xsl:param name="ControlStatus" select="'N/A'"></xsl:param>
		<xsl:param name="curColPeriodType" select="'N/A'"></xsl:param>
		
		<xsl:variable name="KeyUpCall">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>calculateTotal('clsInputActual', 'spanTotalActual');</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="OnClickInputFunction">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>compareActualTarget('clsTxtActual_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>','txtTarget_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>','icnTarget_</xsl:text>
					<xsl:value-of select="$curPeriodKey"/>
					<xsl:text>'); </xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text></xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="xs">
			<xsl:text>col-xs-4 col-md-3 col-sm-3</xsl:text>
			<!--<xsl:choose>
				<xsl:when test="$classXS='XS7'">
					<xsl:text>col-xs-8 col-md-8 col-sm-5</xsl:text>
				</xsl:when>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text>col-xs-12 col-md-12 col-sm-12</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>col-xs-5 col-md-5 col-sm-5</xsl:text>
				</xsl:otherwise>
			</xsl:choose>-->
		</xsl:variable>
		<xsl:variable name="form-groupClassXs">
			<xsl:choose>
				<xsl:when test="$classXS='BusinessXS7'">
					<xsl:text></xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>form-group  </xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="sliderID">
			<xsl:value-of select="ItemID"/>
			<xsl:text>_</xsl:text>
			<xsl:value-of select="$curPeriodKey"/>
		</xsl:variable>
		<xsl:variable name="FormatAmount" select="format-number($Amount,'0')"></xsl:variable>
		<xsl:variable name="saveFn">
			<xsl:text>SaveAmountForPeriodKey_3_0('ex</xsl:text>
			<xsl:value-of select="$sliderID"></xsl:value-of>
			<xsl:text>','</xsl:text>
			<xsl:value-of select="$curPeriodKey"></xsl:value-of>
			<xsl:text>','</xsl:text>
			<xsl:value-of select="$GoalItemID"></xsl:value-of>
			<xsl:text>','0','</xsl:text>
			<xsl:value-of select="$UserID"></xsl:value-of>
			<xsl:text>','</xsl:text>
			<xsl:value-of select="$curPeriodKey"></xsl:value-of>
			<xsl:text>','</xsl:text>
			<xsl:value-of select="''"></xsl:value-of>
			<xsl:text>','</xsl:text>
			<xsl:value-of select="$EscapedMetricKey"></xsl:value-of>
			<xsl:text>',</xsl:text>
			<xsl:value-of select="$ItemID"/>
			<xsl:text>,'','</xsl:text>
			<xsl:value-of select="$curColPeriodType"/>
			<xsl:text>');</xsl:text>
		</xsl:variable>
		<xsl:if test="$ControlStatus !=1">
			<xsl:choose>
				<xsl:when test ="format-number($Amount, '###,###')!='NaN' and $NumbersEnteredBy !=0">
					<div class="{$form-groupClassXs }{$xs} padg0 Widthdiv5 DWidthdiv30" style="margin-bottom:0px;">
						<div class="input-group divInput wid100 PadL0Wid100">
							<span class="input-group-btn">
								<button type="button" class="btn btn-Dec btnpdg leftincr smallBtn" onclick="PlusMinusInputTextValue(-1,'ex{$sliderID}',100000);{$saveFn}{$KeyUpCall}{$OnClickInputFunction}">
									<span class="glyphicon glyphicon-minus"></span>
								</button>
							</span>
							<input id="ex{$sliderID}" class="smallBtn midiv form-control clsInputActual clsTxtActual_{$curPeriodKey}" type="text" value="{$FormatAmount}" min="0" max="100"
								   style="text-align: center;" onblur="{$saveFn}"
									tabindex="{$tabIndex}"></input>
							<span class="input-group-btn">
								<button type="button" class="smallBtn btn btn-Inc btnpdg ritdec" onclick="PlusMinusInputTextValue(1,'ex{$sliderID}',100000);{$saveFn}{$KeyUpCall}{$OnClickInputFunction}">
									<span class="glyphicon glyphicon-plus"></span>

								</button>
							</span>
						</div>
					</div>
				</xsl:when>
				<xsl:when test="$NumbersEnteredBy !=0">
					<div class="{$form-groupClassXs} {$xs} padg0 Widthdiv5 DWidthdiv30" style="margin-bottom:0px;">
						<div class="input-group divInput wid100 PadL0Wid100">
							<span class="input-group-btn">
								<button type="button" class="smallBtn btn btn-Dec btnpdg leftincr" onclick="PlusMinusInputTextValue(-1,'ex{$sliderID}',100000);{$saveFn}{$KeyUpCall}{$OnClickInputFunction}">
									<span class="glyphicon glyphicon-minus"></span>
								</button>
							</span>
							<input id="ex{$sliderID}" class="smallBtn midiv form-control clsInputActual clsTxtActual_{$curPeriodKey}" type="text" value="" min="0" max="100"
								   style="text-align: center;" onblur="{$saveFn}"
									tabindex="{$tabIndex}"></input>
							<span class="input-group-btn">
								<button type="button" class="smallBtn btn btn-Inc btnpdg ritdec" onclick="PlusMinusInputTextValue(1,'ex{$sliderID}',100000);{$saveFn}{$KeyUpCall}{$OnClickInputFunction}">
									<span class="glyphicon glyphicon-plus"></span>
								</button>
							</span>
						</div>
					</div>
				</xsl:when>
				<xsl:otherwise>
					<span class="labelGoalActionsText {$xs} text-right">
						<span id="span_Amount_{$ItemID}_{$curPeriodKey}"
							 style="margin-right:0px;" class="onMouseOver txtnumbrformat nmberFont spanR"
							  onmouseover="this.style.textDecoration='underline';"
							  onmouseout="this.style.textDecoration = 'none';">
							<span id="span_Amount_lbl_{$ItemID}_{$curPeriodKey}"  >
								<xsl:choose>
									<xsl:when test="format-number($Amount, '###,###')!='NaN'">
										<xsl:value-of select="$FormatAmount"/>
									</xsl:when>
								</xsl:choose>

							</span>
						</span>
					</span>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>
