<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:decimal-format NaN="0"/>

<xsl:template match="/">

<html>
<script language="JavaScript" type="text/javascript">
<![CDATA[

var maxId = 0;
function gotBlur(obj) 
 {
	if((oldVal != obj.value) || (obj.ISCHANGED == "true"))
	{
		obj.ISCHANGED = "true"; 
	}
 }

function gotFocus( column )
{
	objCur=column.name; 
	oldVal=column.value; 
}
function upperCase(fieldId)
{

var fieldValue = document.getElementById(fieldId).value; 
document.getElementById(fieldId).value = fieldValue.toUpperCase();

}

function setItemFromPophelp()
{ 
	var seldbID ="";
	for( dbID = 1; dbID <= maxId; dbID++)
	{ 
		
		if( document.getElementById("DetailActCode."+dbID+".selectbox").value == 'true' )
		{	
			seldbID = dbID;		
			
			fieldvalue = document.getElementById("DetailActCode."+dbID+".sundry_code").value;
			fieldName= document.getElementById("DetailActCode."+dbID+".sundry_name").value;		
			 	
		}
		
	}
	
	if( fieldvalue == "" )
	{
		alert("No Selection Made ! \nPlease Select Sundry Code !");
	}
	else
	{		
		window.opener.setSundryCode(fieldvalue);		
		window.close();
	}
}
function searchItem()
{
	var itemCode  ="";
	
	itemCode = document.getElementById("SEARCH_ITEM").value;
	siteCode = document.getElementById("site_code").value;
	detail2dom = document.getElementById("dbID").value;
	
	
	
	
}

function setChecked( obj )
{
	for( dbID = 1; dbID <= maxId; dbID++)
	{
		objCurr = document.getElementById("DetailActCode."+dbID+".selectbox");
		if( objCurr.value == 'true' )
		{
			objCurr.value ='false';
			objCurr.checked = false;
		}
	}
	if( obj.value == 'false' )
	{
		
		obj.value ='true';
		obj.checked = true;
	}
	else
	{
		obj.value = 'false';
		obj.checked = false;
	}
}

]]>
</script>
<body>
<style type="text/css">

.tableClass
{margin-left:0px;margin-top:0px}

.header_td
{border:inset 0;background:#FFCCCC;font-family:verdana;font-size:9pt}

.input_editable
{border:inset 2;color:#102132;background:#D7E5F9;text-align:left;font-family:verdana;font-size:9pt}

.input_num_editable
{border:inset 2;color:#102132;background:#D7E5F9;text-align:right;font-family:verdana;font-size:9pt}

.td_leftAlign
{background:#D7E5F9;text-align:left;font-family:verdana;font-size:9pt}

.td_rightAlign
{background:#D7E5F9;text-align:right;font-family:verdana;font-size:9pt}

</style>

	<form name="Wizard_Activity" method="post">

	<table class="tableClass" border="0" cellspacing="1" cellpadding="1">
	
		<tr>
			<td class="header_td" nowrap="true" valign="bottom" width="2%">
			</td>		
			<!-- <td class="header_td" nowrap="true" valign="bottom" width="20%">
				<strong>Field Name</strong>
			</td> -->
			<td class="header_td" nowrap="true" valign="bottom" width="20%">
				<strong>Sundry Code</strong>
			</td>
			<td class="header_td" nowrap="true" valign="bottom" width="20%">
				<strong>Sundry Name</strong>
			</td>
				
						
		</tr>
<!-- filename = document.getElementById("DetailActCode."+dbID+".fld_name").value; -->
		<xsl:for-each select="Root/Detail">
			<xsl:variable name="sundry_code"><xsl:value-of select="sundry_code"/></xsl:variable>
			<xsl:variable name="sundry_name"><xsl:value-of select="sundry_name"/></xsl:variable>
			
			 <xsl:variable name="dbID"><xsl:value-of select="@domID"/></xsl:variable>
			<SCRIPT>
				<![CDATA[ var qtyR ; qtyR ="]]>	<xsl:value-of select="$dbID"/>
				<![CDATA[";maxId= qtyR; ]]>
			</SCRIPT>
			<xsl:variable name="chkbox"><xsl:value-of select="@selected"/></xsl:variable>
			<tr>
			
				<td class="td_leftAlign">
					<xsl:choose>
						<xsl:when test="$chkbox ='Y'">
							<input  type="checkbox"  name="selectbox" id="DetailActCode.{normalize-space($dbID)}.selectbox" checked='true' value="true" onClick="setChecked(this)"/>
						</xsl:when>	
						<xsl:otherwise>
							<input  type="checkbox"  name="selectbox" id="DetailActCode.{normalize-space($dbID)}.selectbox" value="false" onClick="setChecked(this)"/>
						</xsl:otherwise>
					</xsl:choose>		
				</td>
				<!-- <td class="td_leftAlign">
					<xsl:value-of select="fld_name"/>
					<input  type="hidden"  name="site_code" id = "site_code" value="{normalize-space($site_code)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
					<input  type="hidden"  name="Detail4.{normalize-space($dbID)}.fld_name" id = "DetailActCode.{normalize-space($dbID)}.fld_name" value="{normalize-space($fld_name)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td> -->
				<td class="td_leftAlign">
				
					<xsl:value-of select="sundry_code"/>
					<input  type="hidden"  name="Detail.{normalize-space($dbID)}.sundry_code" id = "DetailActCode.{normalize-space($dbID)}.sundry_code" value="{normalize-space($sundry_code)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td>
				<td class="td_leftAlign">
					<xsl:value-of select="sundry_name"/>
					<input  type="hidden"  name="Detail.{normalize-space($dbID)}.sundry_name" id = "DetailActCode.{normalize-space($dbID)}.sundry_name" value="{normalize-space($sundry_name)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td>
				
				
		
			</tr>
		</xsl:for-each>
</table>
<table cellSpacing="1" cellPadding="1" width="50%" border="0">
	<tr>
	      <td>
			<input  type="hidden"  value="1" name="FORM_NO" />
			<input  type="hidden"  value="emp_travel_info" name="OBJ_NAME" />
			<input  type="hidden"  value="" name="action" id="action" />

			<input type ="button" value=" Add " title='' onclick="javascript:setItemFromPophelp()"/>
			<input type ="button" value="Cancel" title='' onclick="window.close()"/>
	      </td>
	</tr>
</table>
</form>
</body>

</html>
</xsl:template>
</xsl:stylesheet>


