﻿<?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 match="/">
		<xsl:variable name="TemplateURL" select="AjaxRequest/TemplateURL"></xsl:variable>
		<xsl:variable name="PortalItemID" select="AjaxRequest/Params/PortalID"></xsl:variable>
		<xsl:variable name="DivID" select="AjaxRequest/Params/DivID"></xsl:variable>
		<xsl:variable name="PortalTypeList" select="AjaxRequest/PortalType"></xsl:variable>
		<table class="tableMaster" cellpadding="3">
			<tr>
				<td width="15%">
					<span class="goalUpdateLabel">Metric</span>
				</td>
				<td width="85%" class="verticallyMiddle">
					<input id="txt_Metric_{$PortalItemID}" type="text" class="marginRight5"></input>
					<select id="opt_NumberFormat" class="smallDropdown" style="width:40px">
						<option>$</option>
						<option selected="selected">#</option>
					</select>
				</td>
			</tr>
			<tr>
				<td width="15%">
					<span class="goalUpdateLabel">Control Key</span>
				</td>
				<td width="85%" class="verticallyMiddle">
					<input id="txt_AddControlKey_{$PortalItemID}" type="text" class="marginRight5"></input>
				</td>
			</tr>
			<tr>
				<td width="15%">
					<span class="goalUpdateLabel">Type</span>
				</td>
				<td width="85%" class="verticallyMiddle">
					<select id="opt_AddType_{PortalMetricID}" class="smallDropdown">
						<xsl:for-each select="$PortalTypeList/Type">
							<option value="{PortalMetricTypeID}">
								<xsl:value-of select="PortalMetricType"/>
							</option>
						</xsl:for-each>
					</select>
				</td>
			</tr>
			<tr>
				<td>
					<span class="goalUpdateLabel">
						Period Type
					</span>
				</td>
				<td>
					<select id="opt_PeriodTypes_{$PortalItemID}" class="smallDropdown">
						<xsl:for-each select="AjaxRequest/PeriodTypes/PeriodType">
							<xsl:choose>
								<xsl:when test="PeriodType = 'Weekly'">
									<option value="{PeriodTypeID}" selected="selected">
										<xsl:value-of select="PeriodType"/>
									</option>
								</xsl:when>
								<xsl:otherwise>
									<option value="{PeriodTypeID}">
										<xsl:value-of select="PeriodType"/>
									</option>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:for-each>
					</select>
				</td>
			</tr>
			<tr>
				<td>
					<span class="goalUpdateLabel">
						Default
					</span>
				</td>
				<td>
					<select id="opt_PublicYN_{$PortalItemID}" class="smallDropdown">
						<option value="1">Yes</option>
						<option value="0" selected="selected">No</option>
					</select>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<table>
						<tr>
							<td class="textCenter onMouseOver divBrowseGradient spanBrowseGradientTextGray verticallyMiddle" style="width:70px;height:25px;"
                                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="corporatePortal_AddMetricKey('{$PortalItemID}','{$DivID}','txt_Metric_{$PortalItemID}',
                                                                       'opt_PeriodTypes_{$PortalItemID}','opt_PublicYN_{$PortalItemID}','opt_NumberFormat',
																		'txt_AddControlKey_{$PortalItemID}','opt_AddType_{PortalMetricID}')">
								<img id="img_Save" class="marginRight5" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle"></img>
								<span id="span_Save" class="capitalFont">ADD</span>
							</td>
							<td></td>
							<td class="textCenter onMouseOver divBrowseGradient spanBrowseGradientTextGray verticallyMiddle" style="width:70px;height:25px;"
                               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="corporatePortal_LoadMetrics('{$PortalItemID}','{$DivID}');">
								<img id="img_Cancel" class="marginRight5" src="{$TemplateURL}Web/Images/Ver_2_0/BT_x.png" align="absmiddle"></img>
								<span id="span_Cancel" class="capitalFont">CANCEL</span>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</xsl:template>
</xsl:stylesheet>
