Your IP : 216.73.216.155


Current Path : /usr/local/ispmgr/skins/sirius/
Upload File :
Current File : //usr/local/ispmgr/skins/sirius/modules.xsl

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mgr="http://ispsystem.com/xslplugin" exclude-result-prefixes="mgr">
<xsl:output method="html" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>

<xsl:variable name="binary" select="/doc/@binary"/>
<xsl:variable name="tfunc" select="/doc/@func"/>
<xsl:variable name="fixpng" select="/doc/@fixpng"/>
<xsl:variable name="localdir" select="/doc/@localdir"/>
<xsl:variable name="msg" select="/doc/messages"/>
<xsl:variable name="amsg" select="/doc/addonmessages"/>
<xsl:variable name="meta" select="/doc/metadata"/>
<xsl:variable name="newelem" select="/doc/@newelem"/>
<xsl:variable name="get-params">
	<xsl:for-each select="/doc/tparams/*">
		<xsl:variable name="name" select="local-name(.)"/>
		
		<xsl:if test="$name != 'func' and $name != 'out'">
			<xsl:value-of select="concat($name, '=', ./text())"/>
		</xsl:if>
		<xsl:if test="position() != last()">%26</xsl:if>
	</xsl:for-each>
</xsl:variable>

<xsl:template match="doc">
	<xsl:choose>
		<xsl:when test="ok and string(ok)='redirect'">
			<script language="JavaScript">location = "<xsl:value-of select="$binary"/>?<xsl:value-of select="redirect"/>";</script>
		</xsl:when>
		<xsl:when test="ok">
			<script language="JavaScript">
			
			//if ('<xsl:value-of select="ok"/>'=='top') {		
				
			//	top.document.location = ( '<xsl:value-of select="ok/@startpage"/>' != '' ) ? String(top.location).replace(/\?.*/,"") + "?'<xsl:value-of select="ok/@startpage"/>'=" + '<xsl:value-of select="ok/@startpage"/>' : String(top.location).replace(/\?.*/,""); 
			//} else {
				top.mn_do_action('<xsl:value-of select="ok"/>','<xsl:value-of select="ok/@startpage"/>');
			//}
			</script>
		</xsl:when>
		<xsl:when test="not(metadata) and error">
			<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
				<script src="{/doc/@theme}form.js?{/doc/@mtime}"></script>
				<xsl:if test="htmlinc">
					<xsl:for-each select="htmlinc">
						<xsl:value-of select="inc" disable-output-escaping="yes"/>
					</xsl:for-each>
				</xsl:if>
			</head>
			<body bgcolor="#FFFFFF" onload="top.mn_get_obj('waitlayer').style.visibility = 'hidden';setTimeout(fr_showform,100);">
				<table border="0" width="100%" height="100%">
				<tr>
					<td align="center"><table border="0" cellpadding="0" cellspacing="0" width="300">
					<tr><td bgcolor="black"><table border="0" cellpadding="3" cellspacing="1" width="300">
					<tr>
						<td align="center" bgcolor="red">
							<font color="white" face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Fatal error</b></font>
						</td>
					</tr>
					<tr>
						<td align="center" bgcolor="white">
							<font color="red" face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><xsl:value-of select="error"/></b></font>
						</td>
					</tr>
					</table></td></tr></table></td>
				</tr>
				</table>
			</body>
			</html>
		</xsl:when>
		<xsl:otherwise>
			<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
				<xsl:if test="/doc/@host"><base href='{/doc/@host}{/doc/@theme}{/doc/@img}'/></xsl:if>
				<script language="JavaScript">
					<xsl:if test="not(/doc/@host)">document.write( "&lt;base href='"+location.protocol+"//"+location.host+"<xsl:value-of select="/doc/@theme"/><xsl:value-of select="/doc/@img"/>'&gt;" );</xsl:if>
					<xsl:if test="$meta/@autoupdate">var autoupdate = setTimeout("location.reload()",<xsl:value-of select="$meta/@autoupdate"/>*1000);</xsl:if>

					<xsl:if test="$tfunc = 'register' and //metadata/@type = 'form' and not(//metadata/@top)">
						if (parent.frames.length == 0) { location = "<xsl:value-of select="$binary"/>?func=logon"; }
					</xsl:if>
					
					<xsl:if test="not($meta/@type='form')">top.mn_help_value = "";</xsl:if>
					top.mn_help_form_value = "";
					top.mn_newelem = "<xsl:value-of select="$newelem"/>";
					<xsl:if test="$meta/@help">
						<xsl:choose>
							<xsl:when test="$meta/@type='form'">top.mn_help_form_value = "<xsl:value-of select="$meta/@help"/>";</xsl:when>
							<xsl:otherwise>top.mn_help_value = "<xsl:value-of select="$meta/@help"/>";</xsl:otherwise>
						</xsl:choose>
					</xsl:if>
				</script>
                <script src="{/doc/@theme}touchscroll.js?{/doc/@mtime}"></script>
					<xsl:choose>
						<xsl:when test="$meta/@helplevel='yes'">
							<script language="JavaScript">
								top.helplevel = true;
							</script>
						</xsl:when>
						<xsl:otherwise>
							<script language="JavaScript">
								top.helplevel = false;
							</script>
						</xsl:otherwise>
					</xsl:choose>
				<xsl:for-each select="metadata/externalscript">
					<script src="{/doc/@theme}{@name}"></script>
				</xsl:for-each>
				<link href="{@theme}{$localdir}{@css}?{@mtime}" rel="stylesheet" type="text/css"/>
				<xsl:if test="htmlinc">
					<xsl:for-each select="htmlinc">
						<xsl:value-of select="inc" disable-output-escaping="yes"/>
					</xsl:for-each>
				</xsl:if>
			</head>
			<body class="content-body" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0" onload="loaded();">
				<xsl:if test="//form"><xsl:attribute name="class">form-body</xsl:attribute></xsl:if>
				<xsl:if test="//metadata/@type = 'form' and //metadata/@top = 'yes'">
					<xsl:attribute name="class">login-body</xsl:attribute>
					<div id="hintpane" class="hint"></div>				
				</xsl:if>				
				<xsl:if test="//form"><div id="hintspace" class="hintspace"></div></xsl:if>
				
				<!-- Additional toolbar table -->
				<xsl:if test="//metadata/@type = 'list'">
					<table border="0" cellpadding="0" cellspacing="0" id="addtoolbar" class="addtoolbar" onclick="tb_addtoolbar_hide()">
						<tr>
							<td id="addtoolbar-pane" class="addtoolbar-pane"></td>
							<td class="addtoolbar-sh-right"><img src="e.gif" width="3" height="3"/></td>
						</tr>
						<tr>
							<td colspan="2"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
								<td><img src="e.gif" width="3" height="3"/></td>
								<td class="addtoolbar-sh-bottom"><img src="e.gif" width="3" height="3"/></td>
							</tr></table></td>
						</tr>
					</table>
				</xsl:if>

				<div id="debug" style="display: none; position:absolute; top:200px; left:100px; background:white; width:200px; height:200px; overflow-y: scroll; font-size:9px; font-family:Tahoma; padding:3px; border: 1px solid #DDDDDD;"></div>

				<script language="JavaScript">
					var msg_title = '';
					<xsl:for-each select="$msg/msg[starts-with(@name, 'hint_') or starts-with(@name, 'msg_')]">var <xsl:value-of select="@name"/> = "<xsl:value-of select="mgr:fixquote(.)"/>";</xsl:for-each>
					<xsl:for-each select="$amsg/msg[starts-with(@name, 'hint_') or starts-with(@name, 'msg_')]">var <xsl:value-of select="@name"/> = "<xsl:value-of select="mgr:fixquote(.)"/>";</xsl:for-each>
				</script>
				<xsl:apply-templates select="metadata"/>
			</body>
			</html>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- Table view -->
<xsl:template match="metadata[@type='list']">
	<xsl:variable name="knode" select="@key"/>

	<xsl:variable name="pnum" select="/doc/p_num"/>
	<xsl:variable name="pcnt" select="/doc/p_cnt"/>
	<xsl:variable name="psort" select="/doc/p_sort"/>
	<xsl:variable name="porder" select="/doc/p_order"/>
	<script src="{/doc/@theme}table.js?{/doc/@mtime}"></script>
	<script src="{/doc/@theme}grayscale.js?{/doc/@mtime}"></script>
	<script src="{/doc/@theme}ajax.js?{/doc/@mtime}"></script>
	<xsl:if test="diagram and count(/doc/elem) &gt; 1">
		<script src="{/doc/@theme}anychart.js?{/doc/@mtime}"></script>
	</xsl:if>
	<script language="JavaScript">
		var va=[
            <xsl:for-each select="/doc/elem">
                <xsl:if test='position()!=1'>,</xsl:if>[
                    "<xsl:value-of select="mgr:replace(mgr:fixquote(./*[local-name() = $knode]), ', ', '. ')"/>", 
                    0, 
                    "<xsl:value-of select="generate-id()"/>"
                    <xsl:if test="slave">, "<xsl:value-of select="slave"/>"</xsl:if>
                ]
            </xsl:for-each>
        ];	
		var vn=[<xsl:for-each select="/doc/elem"><xsl:variable name="msgname"><xsl:value-of select="mgr:fixquote(./*[local-name() = 'name'])"/></xsl:variable><xsl:if test='position()!=1'>,</xsl:if>[<xsl:if test="$msg/msg[@name=concat('name_',$msgname)]">"<xsl:value-of select="mgr:fixquote(./*[local-name() = $knode])"/>","<xsl:value-of select="$msg/msg[@name=concat('name_',$msgname)]"/>"</xsl:if>]</xsl:for-each>];
		
		var key_name = "<xsl:value-of select="@key"/>";
		var dblact = "<xsl:call-template name="toolbtn-action"><xsl:with-param name="func" select="toolbar/toolbtn[@default]/@func"/><xsl:with-param name="type" select="toolbar/toolbtn[@default]/@type"/></xsl:call-template>";
		var pkey = "<xsl:value-of select="mgr:fixquote(/doc/plid)"/>";
		var slave = "<xsl:value-of select="mgr:fixquote(/doc/slave)"/>";
		var tfilter = "<xsl:value-of select="mgr:fixquote(/doc/tfilter)"/>";
		var clistfunc = "<xsl:value-of select="$tfunc"/>";

		var fixpng = "<xsl:value-of select="$fixpng"/>";

		var cols = [<xsl:for-each select="$meta/coldata/col"><xsl:if test='position()!=1'>,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>];
		<xsl:choose>
			<xsl:when test="$psort != '' and (count(/doc/elem) &gt; $pcnt or count(/doc/page) &gt; 1)">var pager = true;</xsl:when>
			<xsl:otherwise>var pager = false;</xsl:otherwise>
		</xsl:choose>
		var pnum = <xsl:value-of select="$pnum"/>;
		var pcnt = <xsl:value-of select="$pcnt"/>;
		var psort = "<xsl:value-of select="$psort"/>";
		var porder = "<xsl:value-of select="$porder"/>";

		<xsl:if test="$psort != '' and $meta/coldata/col[@name=$psort]">
			<xsl:for-each select="$meta/coldata/col"><xsl:if test="@name = $psort">var tb_sort_col = <xsl:value-of select="position()-1"/>;</xsl:if></xsl:for-each>
			<xsl:choose>
				<xsl:when test="$porder='asc'">var tb_sort_order = true;</xsl:when>
				<xsl:otherwise>var tb_sort_order = false;</xsl:otherwise>
			</xsl:choose>
		</xsl:if>

		<!-- Error -->
		<xsl:choose>
			<xsl:when test="/doc/error">var iserror = true;</xsl:when>
			<xsl:otherwise>var iserror = false; top.mn_successlist = String(location);</xsl:otherwise>
		</xsl:choose>
		function showerror () {
			<xsl:if test="/doc/error">
				try {
					if(top.document.getElementById('formframe')) {
						top.mn_cancel_form();
					}
				} catch(e) {}
				top.mn_error_show( "<xsl:value-of select="mgr:fixquote(/doc/error/@obj)"/>", "<xsl:value-of select="mgr:fixquote(/doc/error/@val)"/>", "<xsl:value-of select="mgr:fixquote(/doc/error/@code)"/>", "<xsl:value-of select="mgr:fixquote(/doc/error/@msg)"/>", "<xsl:value-of select="mgr:fixquote(/doc/error)"/>" );
			</xsl:if>
		}

		function loaded () {
			tb_init();
		}
	</script>

	<table border="0" cellpadding="0" cellspacing="0" style="width:100%; table-layout: fixed;" id="bTable">
		<tbody id="bTbody1">
			<tr><td><xsl:apply-templates select="toolbar"/></td></tr>

			<xsl:if test="/doc/banner">
				<tr id="bannerpane"><td><xsl:apply-templates select="/doc/banner"/></td></tr>
			</xsl:if>

			<xsl:if test="$meta/diagram and count(/doc/elem) &gt; 1">
				<tr><td><xsl:apply-templates select="diagram"/></td></tr>
			</xsl:if>

			<!-- page chooser -->
			<xsl:if test="$psort != '' and (count(/doc/elem) &gt; $pcnt or count(/doc/page) &gt; 1)">
				<tr><td><div class="pagerDiv">
				<form onsubmit="return tb_pager_submit(this.cnt.value, {$pcnt});" id="toppager" class="pagerform">
					<xsl:call-template name="pager">
						<xsl:with-param name="pnum" select="$pnum"/>
						<xsl:with-param name="pcnt" select="$pcnt"/>
						<xsl:with-param name="psort" select="$psort"/>
						<xsl:with-param name="porder" select="$porder"/>
					</xsl:call-template>
				</form>
				<script language="javascript">try { clearTimeout(autoupdate); } catch ( ev ) {}</script>
				</div></td></tr>
			</xsl:if>
			<!-- page chooser -->

			<!-- filter -->
			<xsl:if test="/doc/p_filter">
				<tr><td><xsl:apply-templates select="/doc/p_filter"/></td></tr>
			</xsl:if>
			<!-- filter -->

			<tr><td><table border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed; width:100%;">
				<tr>
					<xsl:choose>
						<xsl:when test="/doc/@no_tsetting">
							<td><div id="headDiv" class="headDiv"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div></td>
							<td id="headSq" class="headSq"></td>							
						</xsl:when>
						<xsl:otherwise>
							<td><div id="headDiv" class="headDiv"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div></td>
							<td id="headSq" class="headSq" align="right" hint="{$amsg/msg[@name='msg_tsetting']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()" onclick="top.mn_form_show('{$binary}?func=tsetting&amp;elid={$tfunc}&amp;params={$get-params}'); return false;">
								<img width="16" height="16"><xsl:call-template name="pngsrc"><xsl:with-param name="src">table.png</xsl:with-param></xsl:call-template></img>
							</td>
						</xsl:otherwise>
					</xsl:choose>		
				</tr>
			</table></td></tr>
		</tbody>
		<tbody id="bTbody2">
			<tr><td><div id="scrollDiv" class="scrollDiv" style="height:2000px">

			<xsl:if test="$meta/coldata">

			<xsl:if test="$meta/toolbar/toolbtn[@type = 'back']">
				<div class="backdiv" onclick="tb_op_back('{$meta/toolbar/toolbtn[@type = 'back']/@func}')"><img src="back.gif" width="16" height="16"/></div>
			</xsl:if>
			<table class="content-table" id="MAINTBL" onclick="tb_row(event)" ondblclick="tb_row_edit(event)">

			<!-- Table body -->
			<tbody class="mainBody" id="mainBody">
			<xsl:for-each select="/doc/elem">
				<xsl:variable name="el" select="."/>

				<xsl:if test="/doc/page or not($psort) or ($psort!=''  and  position() &gt; ($pnum - 1)*$pcnt  and  position() &lt;= $pnum*$pcnt)">
					<tr>
						<xsl:attribute name="id"><xsl:value-of select="generate-id()"/></xsl:attribute>
						<xsl:attribute name="class">
							<xsl:choose>
								<xsl:when test="@row-class"><xsl:value-of select="@row-class"/></xsl:when>
								<xsl:when test="$meta/toolbar/toolbtn[@type = 'back'] and (position() mod 2) = 1">even</xsl:when>
								<xsl:when test="not($meta/toolbar/toolbtn[@type = 'back']) and (position() mod 2) = 0">even</xsl:when>
							</xsl:choose>
						</xsl:attribute>

						<xsl:for-each select="$meta/coldata/col">
							<xsl:variable name="col" select="."/>
							<xsl:variable name="cell-style">
								<xsl:choose>
									<xsl:when test="position() = 1 and position() = last()">border-left: 0px; border-right-color: #FFFFFF;</xsl:when>
									<xsl:when test="position() = 1">border-left: 0px;</xsl:when>
									<xsl:when test="position() = last()">border-right-color: #FFFFFF;</xsl:when>
								</xsl:choose>
								<xsl:if test='$el/*[local-name() = current()/@name]/@xprop'>padding: 2px 3px;</xsl:if>
							</xsl:variable>
					
							<td>
								<xsl:attribute name="style"><xsl:value-of select="$cell-style"/></xsl:attribute>
								
								<xsl:choose>
									<!-- column is text data from element inner xml tag. @name contain name of xml tag -->
									<xsl:when test="@type='data'">
										<xsl:call-template name="coldata"><xsl:with-param name="el" select="$el"/><xsl:with-param name="col" select="$col"/></xsl:call-template>
									</xsl:when>
									<!-- column is message from msg_LANG.xml. @name contain part of message name -->
									<xsl:when test="@type='msg'">
										<xsl:call-template name="colmsg"><xsl:with-param name="el" select="$el"/><xsl:with-param name="col" select="$col"/></xsl:call-template>
									</xsl:when>
									<!-- column contain element properties as image. for example, site have php, cgi, ... -->
									<xsl:when test="prop">
										<xsl:call-template name="colprop"><xsl:with-param name="el" select="$el"/><xsl:with-param name="col" select="$col"/></xsl:call-template>
									</xsl:when>
									<!-- td column contain indicator -->
									<xsl:when test="@type='indicator'">
										<xsl:attribute name="class">indtd</xsl:attribute>
										<xsl:call-template name="indicator">
											<xsl:with-param name="used" select="$el/*[local-name() = current()/@name]/@used"/>
											<xsl:with-param name="all" select="$el/*[local-name() = current()/@name]/@limit"/>
										</xsl:call-template>
									</xsl:when>
								</xsl:choose>
							</td>
						</xsl:for-each>
					</tr>
				</xsl:if>
			</xsl:for-each>
			</tbody>
			<!-- Table body -->

			<!-- Table header -->
			<tbody class="mainHead" style="visibility:hidden;">
			<tr>
				<xsl:for-each select="$meta/coldata/col">
					<td colname="{@name}">
						<xsl:if test="@width"><xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute></xsl:if>
						<xsl:if test="@sort"><xsl:attribute name="onclick">tb_sort(<xsl:value-of select="position()-1"/>,'<xsl:value-of select="@sort"/>')</xsl:attribute></xsl:if>
						<xsl:if test="position() = last()"><xsl:attribute name="class">lasttd</xsl:attribute></xsl:if>
						<div>
							<table cellpadding="0" cellspacing="0" border="0" class="thtbl">
							<tr>
								<td class="thtbl-1"><xsl:value-of select="$msg/msg[@name=current()/@name]"/></td>
								<td class="thtbl-2"><img src="e.gif" width="10" height="7" id="sortimg{position()-1}">
									<xsl:choose>
										<xsl:when test="@name = $psort and $porder='asc'"><xsl:attribute name="src">down.gif</xsl:attribute></xsl:when>
										<xsl:when test="@name = $psort"><xsl:attribute name="src">up.gif</xsl:attribute></xsl:when>
									</xsl:choose>
								</img></td>
							</tr>
							</table>
						</div>
					</td>
				</xsl:for-each>
			</tr>
			</tbody>
			<!-- Table header -->

			<!-- Table footer -->
			<tbody class="mainFoot" style="visibility:hidden;">
			<tr>
				<xsl:for-each select="$meta/coldata/col">
					<td style="padding: 0px 3px;">
						<xsl:if test="position() = last()"><xsl:attribute name="class">lasttd</xsl:attribute></xsl:if>
						<img src="e.gif" width="1" height="1"/>
					</td>
				</xsl:for-each>
			</tr>
			<tr>
				<xsl:for-each select="$meta/coldata/col">
					<xsl:variable name="ccol" select="."/>
					<xsl:if test="position()=1 or @stat or prop/@stat">
						<td>
							<xsl:attribute name="colspan"><xsl:call-template name="fcols"><xsl:with-param name="ccol" select="."/></xsl:call-template></xsl:attribute>
							<xsl:if test="not( $ccol/following-sibling::col[@stat or prop/@stat] )"><xsl:attribute name="class">lasttd</xsl:attribute></xsl:if>
							<div id="{position()-1}-foot"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
						</td>
					</xsl:if>
				</xsl:for-each>
			</tr>
			</tbody>
			<!-- Table footer -->

			</table>
			</xsl:if>
			</div></td></tr>
		</tbody>
		<tbody id="bTbody3">
			<tr><td><table border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed; width:100%">
			<tr>
				<td><div id="footDiv" class="footDiv"></div></td>
				<td id="footSq" class="footSq" align="right" hint="{$amsg/msg[@name='msg_texcel']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()" onclick="top.mn_export_excel(); return false;"><img width="16" height="16"><xsl:call-template name="pngsrc"><xsl:with-param name="src">excel.png</xsl:with-param></xsl:call-template></img></td>
			</tr>
			</table></td></tr>

			<!-- page chooser -->
			<xsl:if test="$psort != '' and (count(/doc/elem) &gt; $pcnt or count(/doc/page) &gt; 1)">
				<tr><td><div class="pagerDiv" style="border-bottom:0px;"><form onsubmit="pnum=1; pcnt=this.cnt.value; tb_pager(); return false;" id="bottompager" class="pagerform"></form></div>
				<script language="javascript">tb_get_obj("bottompager").innerHTML = tb_get_obj("toppager").innerHTML</script></td></tr>
			</xsl:if>
			<!-- page chooser -->
		</tbody>
	</table>

	<script language="JavaScript">
		<xsl:for-each select="$meta/jscript"><xsl:value-of select="."/></xsl:for-each>

		<!-- generate javascript data for status bar -->
		var tblparam = [];
		<xsl:if test="$meta/coldata">
			<xsl:for-each select="$meta/coldata/col">
				<xsl:variable name="colpos" select="position()-1"/>
				<xsl:if test="@stat">tblparam.push("<xsl:value-of select="$colpos"/>-col");</xsl:if>
				<xsl:for-each select="prop[@stat]"><xsl:if test="@defimg">tblparam.push("<xsl:value-of select="$colpos"/>-<xsl:value-of select="@defimg"/>");</xsl:if>tblparam.push("<xsl:value-of select="$colpos"/>-<xsl:value-of select="@onimg"/>");</xsl:for-each>
			</xsl:for-each>

			var animeprop = {};
			<xsl:for-each select="$meta/coldata/col/prop[@stat and @animated]">animeprop["<xsl:value-of select="@onimg"/>"] = true;</xsl:for-each>

			<!-- element stat -->
			var tblstat = {};
			<xsl:for-each select="/doc/elem">
				<xsl:variable name="el" select="."/>
				<xsl:if test="/doc/page or not($psort) or ($psort!=''  and  position() &gt; ($pnum - 1)*$pcnt  and  position() &lt;= $pnum*$pcnt)">
					tblstat["<xsl:value-of select="mgr:fixquote($el/*[local-name() = $knode])"/>"] = { g:1<xsl:for-each select="$meta/coldata/col">
						<xsl:variable name="colpos" select="position()-1"/>
						<xsl:choose>
							<xsl:when test="@stat and @type='indicator'">,"<xsl:value-of select="$colpos"/>-col":[<xsl:value-of select="$el/*[local-name() = current()/@name]/@used"/>,<xsl:value-of select="$el/*[local-name() = current()/@name]/@limit"/>]</xsl:when>
							<xsl:when test="@stat and @type='data'">,"<xsl:value-of select="$colpos"/>-col":"<xsl:value-of select='$el/*[local-name() = current()/@name]'/>"</xsl:when>
						</xsl:choose>
						<xsl:for-each select="prop[@stat]">
							<xsl:variable name="nn"><xsl:value-of select="current()/@name"/></xsl:variable>
							<xsl:if test="$el/*[local-name() = current()/@name]">,"<xsl:value-of select="$colpos"/>-<xsl:value-of select="@onimg"/>":<xsl:value-of select="count($el/*[local-name() = $nn])"/></xsl:if>
						</xsl:for-each>
					</xsl:for-each>};</xsl:if></xsl:for-each>

			<!-- total stat -->
			<xsl:choose>
				<xsl:when test="/doc/page">var tblcount = <xsl:value-of select="/doc/p_elems"/>;</xsl:when>
				<xsl:otherwise>var tblcount = <xsl:value-of select="count( /doc/elem )"/>;</xsl:otherwise>
			</xsl:choose>					

			var tbltotal = [];
			<xsl:for-each select="$meta/coldata/col">
				<xsl:variable name="colpos" select="position()-1"/>
				<xsl:if test="@stat and @type='indicator'">tbltotal["<xsl:value-of select="$colpos"/>-col"]=[<xsl:value-of select="substring-before(@total,' / ')"/>,<xsl:value-of select="substring-after(@total,' / ')"/>];</xsl:if>
				<xsl:if test="@stat and @type='data'">tbltotal["<xsl:value-of select="$colpos"/>-col"]="<xsl:value-of select='@total'/>";</xsl:if>
				<xsl:for-each select="prop[@stat]">tbltotal["<xsl:value-of select="$colpos"/>-<xsl:value-of select="@onimg"/>"]=<xsl:value-of select="count( /doc/elem/*[local-name() = current()/@name] )"/>;</xsl:for-each>
			</xsl:for-each>
		</xsl:if>
		tb_count_stat();
	</script>
</xsl:template>

<xsl:template name="fcols">
	<xsl:param name="ccol"/>

	<xsl:variable name="cpos"><xsl:for-each select="$meta/coldata/col"><xsl:if test="current()/@name = $ccol/@name"><xsl:value-of select="position()"/></xsl:if></xsl:for-each></xsl:variable>
	<xsl:variable name="fpos"><xsl:for-each select="$meta/coldata/col"><xsl:if test="current()/@name = $ccol/following-sibling::col[@stat or prop/@stat][1]/@name"><xsl:value-of select="position()"/></xsl:if></xsl:for-each></xsl:variable>
	<xsl:variable name="total" select="count($meta/coldata/col)"/>

	<xsl:choose>
		<xsl:when test="$fpos != ''"><xsl:value-of select="$fpos - $cpos"/></xsl:when>
		<xsl:otherwise><xsl:value-of select="$total + 1 - $cpos"/></xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template match="toolbar">
	<table id="onlo" border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed; width: 100%;">
	<tr>
		<td class="toolline1" id="toolline1">
			<a href="javascript:location.reload(true);"><script language="javascript">
				var cmbimg = "";
				if ( "<xsl:value-of select="$meta/@selficon"/>" != "" ) {
					cmbimg = "<xsl:value-of select="$meta/@selficon"/>";
					<xsl:variable name="tf"><xsl:variable name="txt"><xsl:value-of select="$tfunc"/></xsl:variable> <xsl:call-template name="replace"><xsl:with-param name="input" select="$txt"/><xsl:with-param name="from" select="'.'"/><xsl:with-param name="to" select="'_'"/></xsl:call-template></xsl:variable>
				} else if ( top.lists["<xsl:value-of select="$tf"/>"] ) {
					cmbimg = top.lists["<xsl:value-of select="$tf"/>"];
					top.mn_cmbimg = cmbimg;
				} else {
					cmbimg = top.mn_cmbimg;
				}
				if ( fixpng == "" ) document.write('&lt;img src="mb-' + cmbimg + '.png" border="0" width="48" height="48" class="waimg" hint="js:workarea.hint_reloadlist" onmouseover="top.mn_hnt(event);" onmouseout="top.mn_hintout()"&gt;');
				else document.write('&lt;img src="e.gif" width="48" height="48" class="waimg" border="0" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + top.imgpath + 'mb-' + cmbimg + '.png\',sizingMethod=\'scale\')"&gt;');
			</script></a>
		</td>
		<td class="toolline2" id="toolline2">
			<div>
				<span id="title">
				<a href="javascript:location.reload(true);" hint="{$amsg/msg[@name='hint_reloadlist']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"><xsl:value-of select="$msg/msg[@name='title']"/></a>
				<xsl:if test="/doc/plid != '' or /doc/tfilter != ''"> -<br/></xsl:if>
				<xsl:if test="/doc/plid != ''">
					<xsl:choose>
						<xsl:when test="/doc/fastlink"><xsl:for-each select="/doc/fastlink"><a href="{$binary}?{@ref}"><xsl:value-of select="."/></a><xsl:if test="position() != last() and . != '/'">/</xsl:if></xsl:for-each></xsl:when>
						<xsl:otherwise><xsl:value-of select="/doc/plid"/></xsl:otherwise>
					</xsl:choose>
				</xsl:if>
				<xsl:if test="/doc/tfilter != ''"> [<xsl:value-of select="/doc/tfilter"/>]</xsl:if>
				</span>
			</div>
		</td>
		<td class="toolline3" id="toolline3"><table border="0" cellpadding="0" cellspacing="0" align="right" id="toolbar-table">
		<tr>
			<td><img src="e.gif" width="10" height="44"/></td>
			<xsl:apply-templates select="*"/>
			<td class="toolexp" id="toolexp" onclick="tb_addtoolbar(this)" onmouseover="if (this.className=='toolexp-act') this.className='toolexp-sel'" onmouseout="if (this.className=='toolexp-sel') this.className='toolexp-act'"><img src="e.gif" width="12" height="1"/></td>
			<td><img src="e.gif" width="6" height="44"/></td>
		</tr>
		</table></td>
	</tr>
	</table>
</xsl:template>

<!-- replace function -->
<xsl:template name="replace">            
   <xsl:param name="input"/>            
   <xsl:param name="from"/>            
   <xsl:param name="to"/>            

   <xsl:choose>            
	   <xsl:when test="contains($input, $from)">            
	
		   <xsl:value-of select="substring-before($input, $from)"/>            
		   <xsl:value-of select="$to"/>            
		
		   <xsl:call-template name="replace">            
	  
			   <xsl:with-param name="input" select="substring-after($input, $from)"/>            
			   <xsl:with-param name="from" select="$from"/>            
			   <xsl:with-param name="to" select="$to"/>            
		   </xsl:call-template>            

	   </xsl:when>            
	   <xsl:otherwise>            
		   <xsl:value-of select="$input"/>            
	   </xsl:otherwise>            
   </xsl:choose>            
</xsl:template>   


<xsl:template match="toolbtn">
	<td align="center">
		<xsl:if test="not(preceding-sibling::toolbtn)"><xsl:attribute name="firstbtn">yes</xsl:attribute></xsl:if>
		<xsl:if test="../@view = 'buttontext'"><xsl:attribute name="valign">top</xsl:attribute></xsl:if>

		<xsl:attribute name="style">cursor: pointer;</xsl:attribute>
		<xsl:attribute name="class">toolbtn</xsl:attribute>
		<xsl:attribute name="btype"><xsl:choose><xsl:when test="@type = 'edit' or @type = 'editlist'">1</xsl:when><xsl:when test="@type = 'group' or @type = 'groupform'">2</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
		<xsl:attribute name="bactive">1</xsl:attribute>
		
		<xsl:attribute name="hint"><xsl:value-of select="$msg/msg[@name=concat('hint_',current()/@name)]"/></xsl:attribute>
		<xsl:attribute name="onmouseover">if ( this.getAttribute("bactive") == 1 ) this.className = "toolbtn-sel"; top.mn_hnt(event);</xsl:attribute>
		<xsl:attribute name="onmouseout">this.className = "toolbtn"; top.mn_hintout();</xsl:attribute>
		<xsl:attribute name="onclick">top.mn_hintout(); if ( this.getAttribute("bactive") == 1 ) {<xsl:call-template name="toolbtn-action"><xsl:with-param name="func" select="@func"/><xsl:with-param name="type" select="@type"/></xsl:call-template>}</xsl:attribute>

		<img width="24" height="24"><xsl:call-template name="pngsrc"><xsl:with-param name="src"><xsl:value-of select="@img"/>.png</xsl:with-param></xsl:call-template></img>
		<xsl:if test="../@view = 'buttontext'"><div class="btnlabel"><xsl:value-of select="$msg/msg[@name=concat('short_',current()/@name)]"/></div></xsl:if>
	</td>
</xsl:template>

<xsl:template name="toolbtn-action">
	<xsl:param name="func"/><xsl:param name="type"/>

	<xsl:choose>
		<xsl:when test="not($type) or $type=''"></xsl:when>
		<xsl:when test="$type='func'"><xsl:value-of select="$func"/></xsl:when>
		<xsl:when test="$type='list'">tb_op_new('<xsl:value-of select="$func"/>',1)</xsl:when>
		<xsl:when test="$type='editlist'">tb_op_edit('<xsl:value-of select="$func"/>',1)</xsl:when>
		<xsl:when test="$type='groupformnosel'">tb_op_groupform('<xsl:value-of select="$func"/>',1)</xsl:when>
		<xsl:otherwise>tb_op_<xsl:value-of select="$type"/>('<xsl:value-of select="$func"/>')</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template match="toolsep">
	<xsl:if test="following-sibling::node()[1][local-name() = 'toolbtn'] and preceding-sibling::toolbtn">
		<td class="toolsep"><img src="e.gif" width="12" height="1"/></td>
	</xsl:if>
</xsl:template>

<xsl:template match="banner">
	<xsl:attribute name="class">bannerTd<xsl:value-of select='@status'/></xsl:attribute>

	<div>
		<table border="0" cellpadding="0" cellspacing="0" width="100%" class="bannerTbl">
		<tr>
			<td class="banTd1"><img width="24" height="24"><xsl:call-template name="pngsrc"><xsl:with-param name="src">banner<xsl:value-of select='@status'/>-icon.png</xsl:with-param></xsl:call-template></img></td>
			<td class="banTd2"><xsl:value-of select="."/></td>
			<xsl:if test="@info">
				<td class="banTd3">
					<xsl:choose>
						<xsl:when test="@infotype = 'help'"><a href='javascript:top.mn_show_help(2,"{@info}")'><xsl:value-of select="$amsg/msg[@name='moreinfo']"/></a></xsl:when>
						<xsl:when test="@infotype = 'url'"><a href='{@info}' target='_blank'><xsl:value-of select="$amsg/msg[@name='moreinfo']"/></a></xsl:when>
						<xsl:when test="@infotype = 'func'"><a href='{$binary}?func={@info}'><xsl:value-of select="$amsg/msg[@name='moreinfo']"/></a></xsl:when>
						<xsl:when test="@infotype = 'formfunc'"><a href="javascript:top.mn_form_show('{$binary}?func={@info}')"><xsl:value-of select="$amsg/msg[@name='moreinfo']"/></a></xsl:when>
					</xsl:choose>
				</td>
			</xsl:if>
			<xsl:if test="@id and not(@nodismiss)">
				<td class="banTd4"><a href='javascript:tb_dismiss("{@id}")'><xsl:value-of select="$amsg/msg[@name='dismiss']"/></a></td>
			</xsl:if>
		</tr>
		</table>
	</div>
</xsl:template>

<xsl:template match="diagram">
	<div id="diagramdiv"></div>
	<script language="javascript">
		var plugin;
		var version = 8;
		var flash = false;

		if (navigator.plugins) {
		    if (navigator.plugins["Shockwave Flash"]) {
		        plugin = navigator.plugins["Shockwave Flash"].description;
				var cver = ( String(plugin).match(/(\d+)\./) ) ? parseInt(RegExp.$1) : 0;
		        flash = cver &gt;= version;
		    } else {
		        if ((navigator.userAgent.indexOf('MSIE') != -1) &amp;&amp; (navigator.userAgent.indexOf('Win') != -1)) {
		            var vb = '&lt;script language="vbscript"&gt;\n'
		                   + 'if ScriptEngineMajorVersion &gt;= 2 then\n'
		                   + '  on error resume next\n'
		                   + '  flash = IsObject(CreateObject('
		                   + '     "ShockwaveFlash.ShockwaveFlash.'
		                   +        version + '"))\n'
		                   + 'end if\n'
		                   + '&lt;' + '/script&gt;';
		            document.write(vb);
		        }
		    }
		}
		if ( flash ) {
			var chart = new AnyChart("anychart.swf");
			chart.width = "100%";
			chart.height = "200";
			chart.wMode = "transparent";
			chart.write("diagramdiv");
			var chartdata = { obj:chart, parentid:"diagramdiv", hid:"mainHead", mid:"mainBody", type:"<xsl:value-of select="@type"/>", label:"<xsl:value-of select="@label"/>", data:[] };
			<xsl:if test="@data">chartdata["data"].push("<xsl:value-of select="@data"/>");</xsl:if>
			<xsl:for-each select="line">chartdata["data"].push("<xsl:value-of select="@data"/>");</xsl:for-each>
			tb_chart.push(chartdata);
		}
	</script>
</xsl:template>

<xsl:template name="pager">
	<xsl:param name="pnum"/><xsl:param name="pcnt"/><xsl:param name="psort"/><xsl:param name="porder"/>

	<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr valign="top">
		<td width="1"><img src="e.gif" width="1" height="26"/></td>
		<td class="pager1"><table cellpadding="0" cellspacing="0" border="0" class="pelemtbl">
		<tr>
			<td>
				<select name="num" class="pinput" style="width:200px;">
					<xsl:choose>
						<xsl:when test="/doc/page">
							<xsl:for-each select="/doc/page">
								<xsl:element name="option">
									<xsl:attribute name="value"><xsl:value-of select="position()"/></xsl:attribute>
									<xsl:if test="$pnum = position()"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>
									<xsl:value-of select="position()"/><xsl:text>: </xsl:text><xsl:value-of select="."/>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="/doc/elem">
								<xsl:variable name="el" select="*[local-name()=$psort]"/>
								<xsl:variable name="eltype" select="$meta/coldata/col[@name=$psort]/@type"/>
								<xsl:variable name="pos" select="position()"/>

								<xsl:if test="(($pos - 1) mod $pcnt) = 0">
									<xsl:variable name="elend" select="/doc/elem[$pos - 1 + $pcnt]/*[local-name()=$psort]"/>
									<xsl:variable name="ellast" select="/doc/elem[last()]/*[local-name()=$psort]"/>

									<xsl:element name="option">
										<xsl:attribute name="value"><xsl:value-of select="(($pos - 1) div $pcnt) + 1"/></xsl:attribute>
										<xsl:if test="$pnum = ((($pos - 1) div $pcnt) + 1)"><xsl:attribute name="selected">yes</xsl:attribute></xsl:if>

										<xsl:value-of select="(($pos - 1) div $pcnt) + 1"/>
										<xsl:if test="$el">
											<xsl:call-template name="pager-option">
												<xsl:with-param name="eltype" select="$eltype"/><xsl:with-param name="el" select="$el"/>
												<xsl:with-param name="elend" select="$elend"/><xsl:with-param name="ellast" select="$ellast"/>
											</xsl:call-template>
										</xsl:if>
									</xsl:element>
								</xsl:if>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>					
				</select>
			</td>
			<td><input type="button" class="pbutton" value="{$amsg/msg[@name='pagerok']}" onclick="pnum=this.form.num.options[this.form.num.selectedIndex].value; tb_pager();"/></td>
		</tr>
		</table></td>

		<td class="pager2"><table cellpadding="0" cellspacing="0" border="0" class="pelemtbl" align="center">
		<tr>
			<td><xsl:value-of select="$amsg/msg[@name='pagershow']"/></td>
			<td><input type="text" name="cnt" style="width:30px;" class="pinput" value="{$pcnt}"/></td>
			<td><xsl:value-of select="$amsg/msg[@name='pagerline']"/></td>
			<td><input type="submit" class="pbutton" value="{$amsg/msg[@name='pagerok']}"/></td>
		</tr>
		</table></td>

		<xsl:choose>
			<xsl:when test="/doc/page">
				<td class="pager3"><table cellpadding="0" cellspacing="0" border="0" class="pelemtbl" align="right">
				<tr>
					<td>
						<input type="button" class="pbutton" value="&lt;" onclick="pnum=parseInt(this.form.num.options[this.form.num.selectedIndex].value)-1; tb_pager();">
							<xsl:if test="$pnum = 1"><xsl:attribute name="disabled">yes</xsl:attribute></xsl:if>
						</input>
					</td>
					<td><xsl:value-of select="$amsg/msg[@name='pagerpage']"/><xsl:text> </xsl:text><span class="pagenum"><xsl:value-of select="$pnum"/></span><xsl:text> </xsl:text><xsl:value-of select="$amsg/msg[@name='pagerfrom']"/><xsl:text> </xsl:text><span class="pagenum"><xsl:value-of select="count(/doc/page)"/></span></td>
					<td>
						<input type="button" class="pbutton" value="&gt;" onclick="pnum=parseInt(this.form.num.options[this.form.num.selectedIndex].value)+1; tb_pager();">
							<xsl:if test="$pnum = count(/doc/page)"><xsl:attribute name="disabled">yes</xsl:attribute></xsl:if>
						</input>
					</td>
				</tr>
				</table></td>
			</xsl:when>
			<xsl:otherwise>
				<td class="pager3"><table cellpadding="0" cellspacing="0" border="0" class="pelemtbl" align="right">
				<tr>
					<td>
						<input type="button" class="pbutton" value="&lt;" onclick="pnum=parseInt(this.form.num.options[this.form.num.selectedIndex].value)-1; tb_pager();">
							<xsl:if test="$pnum = 1"><xsl:attribute name="disabled">yes</xsl:attribute></xsl:if>
						</input>
					</td>
					<td><xsl:value-of select="$amsg/msg[@name='pagerpage']"/><xsl:text> </xsl:text><span class="pagenum"><xsl:value-of select="$pnum"/></span><xsl:text> </xsl:text><xsl:value-of select="$amsg/msg[@name='pagerfrom']"/><xsl:text> </xsl:text><span class="pagenum"><xsl:value-of select="ceiling(count(/doc/elem) div $pcnt)"/></span></td>
					<td>
						<input type="button" class="pbutton" value="&gt;" onclick="pnum=parseInt(this.form.num.options[this.form.num.selectedIndex].value)+1; tb_pager();">
							<xsl:if test="$pnum = ceiling(count(/doc/elem) div $pcnt)"><xsl:attribute name="disabled">yes</xsl:attribute></xsl:if>
						</input>
					</td>
				</tr>
				</table></td>
			</xsl:otherwise>
		</xsl:choose>
	</tr>
	</table>
</xsl:template>

<xsl:template name="pager-option">
	<xsl:param name="eltype"/><xsl:param name="el"/><xsl:param name="elend"/><xsl:param name="ellast"/>

	<xsl:text>: </xsl:text>
	<xsl:choose>
		<xsl:when test="$eltype='data'">
			<xsl:value-of select="$el"/> -
			<xsl:choose>
				<xsl:when test="$elend"><xsl:value-of select="$elend"/></xsl:when>
				<xsl:otherwise><xsl:value-of select="$ellast"/></xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:when test="$eltype='msg'">
			<xsl:value-of select="$msg/msg[@name=concat(local-name($el),'_',$el)]"/> -
			<xsl:choose>
				<xsl:when test="$elend"><xsl:value-of select="$msg/msg[@name=concat(local-name($elend),'_',$elend)]"/></xsl:when>
				<xsl:otherwise><xsl:value-of select="$msg/msg[@name=concat(local-name($ellast),'_',$ellast)]"/></xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:when test="$eltype='indicator'">
			<xsl:value-of select="$el/@used"/> -
			<xsl:choose>
				<xsl:when test="$elend"><xsl:value-of select="$elend/@used"/></xsl:when>
				<xsl:otherwise><xsl:value-of select="$ellast/@used"/></xsl:otherwise>
			</xsl:choose>
		</xsl:when>
	</xsl:choose>
</xsl:template>

<xsl:template match="p_filter">
	<div class="filterDiv">
		<table cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr valign="top">
			<td width="1"><img src="e.gif" width="1" height="26"/></td>
			<td class="filter1"><xsl:value-of select="$amsg/msg[@name='filterhead']"/></td>
			<td class="filter2">
				<table cellpadding="0" cellspacing="0" border="0" width="100%" class="filter2table">
				<tr>
					<td>
						<xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
						<div><xsl:value-of select="."/></div>
					</td>
				</tr>
				</table>
			</td>
			<td class="filter3" align="right"><input type="button" class="fbutton" value="{$amsg/msg[@name='filterremove']}" onclick="location = '{$binary}?func={$tfunc}.filter&amp;sok=ok'"/></td>
		</tr>
		</table>
	</div>
</xsl:template>

<xsl:template name="coldata">
	<xsl:param name="el"/><xsl:param name="col"/>
	<xsl:variable name="dataelem" select="$el/*[local-name() = $col/@name]"/>

	<div>
		<xsl:if test="$col/@wrap"><xsl:attribute name="style">white-space: normal;</xsl:attribute></xsl:if>
		<xsl:if test="$dataelem/@color"><xsl:attribute name="class">status-<xsl:value-of select="$dataelem/@color"/></xsl:attribute></xsl:if>
		<xsl:if test="$col/@align"><xsl:attribute name="align"><xsl:value-of select="$col/@align"/></xsl:attribute></xsl:if>
		
		<!-- element have image. for example, folder and file image in file manager -->
		<xsl:if test='$dataelem/@xprop'>
			<xsl:call-template name="prop"><xsl:with-param name="imgs">p-file-<xsl:value-of select="$dataelem/@xprop"/></xsl:with-param><xsl:with-param name="xhint"><xsl:value-of select="$dataelem/@xhint"/></xsl:with-param></xsl:call-template>
		</xsl:if>
		
		<!-- print element content. if it's empty then print 1x1 gif -->
		<xsl:choose>
			<xsl:when test="$dataelem!=''">
				<xsl:choose>
					<xsl:when test='$dataelem/@xprop'>
						<span style="vertical-align: middle;"><xsl:choose><xsl:when test="$col/@noescaping"><xsl:value-of select="$dataelem" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="$dataelem"/></xsl:otherwise></xsl:choose></span>
					</xsl:when>
					<xsl:otherwise>
						<xsl:choose><xsl:when test="$col/@noescaping"><xsl:value-of select="$dataelem" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="$dataelem"/></xsl:otherwise></xsl:choose>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></xsl:otherwise>
		</xsl:choose>
	</div>
</xsl:template>

<xsl:template name="colmsg">
	<xsl:param name="el"/><xsl:param name="col"/>
	<xsl:variable name="msgelem" select="$el/*[local-name() = $col/@name]"/>
	<xsl:variable name="msgname" select="concat(@name,'_',$msgelem)"/>										

	<div>
		<xsl:if test="$msgelem/@color"><xsl:attribute name="class">status-<xsl:value-of select="$msgelem/@color"/></xsl:attribute></xsl:if>
		<xsl:if test="$col/@align"><xsl:attribute name="align"><xsl:value-of select="$col/@align"/></xsl:attribute></xsl:if>
		
		<!-- element have image. for example, folder and file image in file manager -->
		<xsl:if test='$msgelem/@xprop'>
			<xsl:call-template name="prop"><xsl:with-param name="imgs">p-file-<xsl:value-of select="$msgelem/@xprop"/></xsl:with-param><xsl:with-param name="xhint"><xsl:value-of select="$msgelem/@xhint"/></xsl:with-param></xsl:call-template>
		</xsl:if>

		<xsl:choose>
			<xsl:when test="$msgelem/@data"><xsl:value-of select="$msgelem"/></xsl:when>
			<xsl:when test="$msgelem/@param"><xsl:value-of select="mgr:replace($msg/msg[@name=$msgname],'__param__',$msgelem/@param)"/></xsl:when>
			<xsl:otherwise>
				<span hint="{$msg/msg[@name=concat('hint_',$msgname)]}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()">
					<xsl:choose>
						<xsl:when test="$msg/msg[@name=$msgname]"><xsl:value-of select="$msg/msg[@name=$msgname]"/></xsl:when>
						<xsl:otherwise><xsl:value-of select="$msgelem"/></xsl:otherwise>
					</xsl:choose>
				</span>
			</xsl:otherwise>
		</xsl:choose>
	</div>
</xsl:template>

<xsl:template name="colprop">
	<xsl:param name="el"/><xsl:param name="col"/>
	
	<xsl:attribute name="class">proptd</xsl:attribute>
	<div>
		<xsl:if test="$col/@align"><xsl:attribute name="align"><xsl:value-of select="$col/@align"/></xsl:attribute></xsl:if>
		
		<xsl:attribute name="data-sortind">
			<xsl:for-each select="$col/prop">
				<xsl:variable name="nnn"><xsl:value-of select="current()/@name"/></xsl:variable>
				<xsl:choose>
					<xsl:when test="$el/*[local-name() = $nnn]">1</xsl:when>
					<xsl:otherwise>0</xsl:otherwise>
				</xsl:choose>
			</xsl:for-each>
		</xsl:attribute>
		
		<xsl:for-each select="$col/prop">
			<xsl:variable name="nn"><xsl:value-of select="current()/@name"/></xsl:variable>
			<xsl:variable name="on"><xsl:value-of select="current()/@onimg"/></xsl:variable>
			<xsl:variable name="anym"><xsl:value-of select="current()/@animated"/></xsl:variable>
			
			
			<xsl:for-each select="$el/*[local-name() = $nn]">	
				<xsl:call-template name="prop"><xsl:with-param name="imgs" select="$on"/><xsl:with-param name="hint" select="$nn"/><xsl:with-param name="txt" select="current()"/><xsl:with-param name="url" select="current()/@url"/><xsl:with-param name="animated" select="$anym"/></xsl:call-template>
			</xsl:for-each>
			<xsl:if test="not($el/*[local-name() = current()/@name]) and @defimg">
				<xsl:call-template name="prop"><xsl:with-param name="imgs" select="@defimg"/><xsl:with-param name="hint" select="concat('def_',@name)"/><xsl:with-param name="txt" select="$el/*[local-name() = current()/@name]"/></xsl:call-template>
			</xsl:if>
		</xsl:for-each>
	</div>
</xsl:template>

<!-- Property image -->
<xsl:template name="prop">
	<xsl:param name="imgs"/><xsl:param name="hint"/><xsl:param name="xhint"/><xsl:param name="txt"/><xsl:param name="url"/><xsl:param name="animated"/>

	<img class="pimg">
		<xsl:if test="$url">
			<xsl:attribute name="style">cursor:pointer;</xsl:attribute>
			<xsl:attribute name="onclick">window.open("<xsl:value-of select="$url"/>");</xsl:attribute>
		</xsl:if>
		<xsl:call-template name="pngsrc"><xsl:with-param name="src"><xsl:value-of select="$imgs"/>.png</xsl:with-param><xsl:with-param name="animated" select="$animated"/></xsl:call-template>
		<xsl:if test="contains($imgs,'-file-')"><xsl:attribute name="align">absmiddle</xsl:attribute></xsl:if>
		<xsl:if test="$hint"><xsl:attribute name="hint"><xsl:value-of select="$msg/msg[@name=concat('hint_p_',$hint)]"/><xsl:text> </xsl:text><xsl:value-of select="$txt"/></xsl:attribute></xsl:if>
		<xsl:if test="$xhint"><xsl:attribute name="hint"><xsl:value-of select="$xhint"/></xsl:attribute></xsl:if>
		<xsl:attribute name="onmouseover">top.mn_hnt(event)</xsl:attribute>
		<xsl:attribute name="onmouseout">top.mn_hintout()</xsl:attribute>
	</img>
</xsl:template>

<!-- Indicator -->
<xsl:template name="indicator">
	<xsl:param name="used"/><xsl:param name="all"/>

	<!-- Usage percentage -->
	<xsl:variable name="val" select="ceiling($used * 100 div $all)"/>

	<!-- Indicator -->
	<xsl:choose>
		<xsl:when test="not($used) and not($all)">
			<div><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
		</xsl:when>
		<xsl:otherwise>
			<!-- Text under usage indicator -->
			<div class="int"><xsl:value-of select="$used"/><xsl:if test="$all!=''"> / <xsl:value-of select="$all"/></xsl:if></div>

			<div class="inl">
				<xsl:choose>
					<!-- Only green cell -->
					<xsl:when test="$all='' or not($val) or $val = '' or $val&lt;1"><xsl:attribute name="style">width: 1px; background: transparent;</xsl:attribute></xsl:when>
					<!-- Only red cell -->
					<xsl:when test="$val&gt;99"><xsl:attribute name="style">width: 100%;</xsl:attribute></xsl:when>
					<!-- Red and green cells -->
					<xsl:otherwise><xsl:attribute name="style">width: <xsl:value-of select="$val"/>%;</xsl:attribute></xsl:otherwise>
				</xsl:choose>
				<img src="e.gif" width="1" height="1"/>
			</div>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- Form view -->
<xsl:template match="metadata[@type='form']">
	<script src="{/doc/@theme}form.js?{/doc/@mtime}"></script>
	<script src="{/doc/@theme}ajax.js?{/doc/@mtime}"></script>
	<xsl:if test="//slider"><script src="{/doc/@theme}slider.js?{/doc/@mtime}"></script></xsl:if>
	<!-- export lists to top arrays -->
	<script language="JavaScript">
		function loaded () {
			fr_init();
		}
		<xsl:for-each select="//select">top.<xsl:value-of select="@name"/>list = [];</xsl:for-each>
		<xsl:apply-templates select="/doc/slist"/>
		var fr_pc = <xsl:value-of select="count(form/page)"/>;
		var fr_minheight = 0;
		var fr_goodheight = null;
		<xsl:if test="form/@height">fr_goodheight = <xsl:value-of select="form/@height"/>;</xsl:if>
		var fr_maxheight = null;
		<xsl:if test="form/@maxheight">fr_maxheight = "<xsl:value-of select="form/@maxheight"/>";</xsl:if>
		var fr_maxwidth = false; <xsl:if test="form/@maxwidth">fr_maxwidth = true;</xsl:if>
		var fr_focus = "<xsl:value-of select="//*[@focus]/@name"/>";
		var fr_cancelrefresh = false; <xsl:if test="form/@cancelrefresh">fr_cancelrefresh = true;</xsl:if>
		var fr_top = false; <xsl:if test="@top">fr_top = true;</xsl:if>
		var fr_nocancel = false; <xsl:if test="form/@nocancel">fr_nocancel = true;</xsl:if>
	</script>

	<!-- process form elements -->
	<xsl:choose>
		<xsl:when test="@top">
			<xsl:if test="/doc/pwgenlen">
				<script language="JavaScript">
					var pwgenlen = <xsl:value-of select="/doc/pwgenlen"/>;
					var pwgencharacters = "<xsl:value-of select="/doc/pwgencharacters"/>";
				</script>
			</xsl:if>

			<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="center">
				<table class="topform-table" cellpadding="0" cellcpacing="0" border="0">
					<tr>
						<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
						<tr>
							<td class="login-title-l"><img width="8" height="30"><xsl:call-template name="pngsrc"><xsl:with-param name="src"><xsl:value-of select="$localdir"/>ft-left.png</xsl:with-param></xsl:call-template></img></td>
							<td class="login-title"><xsl:value-of select="$msg/msg[@name='title']"/></td>
							<td class="login-title-r"><img width="8" height="30"><xsl:call-template name="pngsrc"><xsl:with-param name="src"><xsl:value-of select="$localdir"/>ft-right.png</xsl:with-param></xsl:call-template></img></td>
						</tr>
						</table></td>
					</tr>
					<tr>
						<td class="topform-table-content"><div class="topform-table-content-div"><xsl:apply-templates select="form"/></div></td>
					</tr>
				</table>
			</td></tr></table>
		</xsl:when>
		<xsl:otherwise><xsl:apply-templates select="form"/></xsl:otherwise>
	</xsl:choose>

	<script language="JavaScript">
		<xsl:choose>
			<xsl:when test="/doc/elid = ''">
				<xsl:choose>
					<xsl:when test="$msg/msg[@name='title_new']">msg_title = "<xsl:value-of select="mgr:fixquote($msg/msg[@name='title_new'])"/>";</xsl:when>
					<xsl:otherwise>msg_title = "<xsl:value-of select="mgr:fixquote($msg/msg[@name='title'])"/>";</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>msg_title = "<xsl:value-of select="mgr:fixquote($msg/msg[@name='title'])"/> - <xsl:value-of select="mgr:fixquote(/doc/elid)"/>";</xsl:otherwise>
		</xsl:choose>
		
		var frm_msg_ok = "";
		var frm_msg_back = "";
		<xsl:choose>
		<xsl:when test="not(/doc/metadata/form/@nosubmit)">
			<xsl:choose>
				<xsl:when test="form/@wizard = 'first'">frm_msg_ok = top.msg_next;</xsl:when>
				<xsl:when test="form/@wizard = 'middle'">frm_msg_ok = top.msg_next; frm_msg_back = top.msg_back;</xsl:when>
				<xsl:when test="form/@wizard = 'last'">frm_msg_ok = top.msg_finish; frm_msg_back = top.msg_back;</xsl:when>
				<xsl:otherwise>frm_msg_ok = <xsl:choose><xsl:when test="form/@extokmsg">msg_extokmsg</xsl:when><xsl:otherwise>top.msg_ok</xsl:otherwise></xsl:choose>;</xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:otherwise>
			<xsl:choose>
				<xsl:when test="form/@wizard = 'middle'">frm_msg_back = top.msg_back;</xsl:when>
				<xsl:when test="form/@wizard = 'last'">frm_msg_back = top.msg_back;</xsl:when>
			</xsl:choose>		
		</xsl:otherwise>
		</xsl:choose>
		if ( document.frm.suok ) document.frm.suok.value = frm_msg_ok;
		if ( document.frm.suback ) document.frm.suback.value = frm_msg_back;
		
		if ( !(fr_top || fr_nocancel) ) try{document.frm.cancel.value = top.msg_cancel;}catch(e){}
		var fr_pc = <xsl:value-of select="count(form/page)"/>;
		<xsl:for-each select="$meta/jscript">
			<xsl:value-of select="."/>
		</xsl:for-each>

		<!-- Generate Form OnSubmit handler -->
		function frm_gen_event () {
			var form = document.frm;
			<xsl:for-each select="//*[@empty]">
				if ( fr_is_visible(form.<xsl:value-of select="@name"/>) &amp;&amp; fr_get_elem(frm,'<xsl:value-of select="@name"/>').value == "" ) { alert(top.msg_empty.replace(/%fieldname%/,"<xsl:value-of select='$msg/msg[@name=current()/../@name]'/>")); return false; }
			</xsl:for-each>
			<xsl:for-each select="//*[@checkpasswd]">
				if (form.<xsl:value-of select="@name"/>gen.style.display=="block") form.<xsl:value-of select="@name"/>.value=form.<xsl:value-of select="@name"/>gen.value;
			
				if ( fr_is_visible(form.<xsl:value-of select="@name"/>) &amp;&amp; form.elid.value == "" &amp;&amp; form.<xsl:value-of select="@name"/>.value == "" ) { alert(top.msg_passwd); return false; }
				if ( fr_is_visible(form.<xsl:value-of select="@name"/>) &amp;&amp; form.<xsl:value-of select="@name"/>.value != form.<xsl:value-of select="@checkpasswd"/>.value ) { alert(top.msg_confirm); return false; }
                if (top.pwcheck == 'on') {
                    if ( fr_is_visible(form.<xsl:value-of select="@name"/>) &amp;&amp; form.<xsl:value-of select="@name"/>.value != '' ) {
                        if (!checkPassword(form.<xsl:value-of select="@name"/>.value)) {
                            alert(top.msg_badpasswd);
                            return false;
                        }
                    }
                }
			</xsl:for-each>
			<xsl:if test="//*[@filter]">
				var loc = String(top.mn_currlist); var pos = loc.indexOf("&amp;tfilter="); if (pos != -1) loc = loc.substring(0,pos);
				top.mn_currlist = loc + "&amp;tfilter="<xsl:for-each select="//*[@filter]">+<xsl:if test="position()!=1">"<xsl:value-of select="@filter"/>"+</xsl:if><xsl:choose><xsl:when test="local-name()='select'">form.<xsl:value-of select="@name"/>.options[form.<xsl:value-of select="@name"/>.selectedIndex].value</xsl:when><xsl:when test="@type='checkbox'">((form.<xsl:value-of select="@name"/>.checked)?"on":"off")</xsl:when><xsl:otherwise>form.<xsl:value-of select="@name"/>.value</xsl:otherwise></xsl:choose></xsl:for-each>;
				top.mn_successlist = top.mn_currlist;
			</xsl:if>
			<xsl:if test="//form[@event]">if (frm_event()!=true){return false;}</xsl:if>

			fr_disabled();
			return true;
		}

		<!-- Generate Select OnChange handler -->
		<xsl:for-each select="//select[if and not(@type)]">
		function <xsl:value-of select="@name"/>_gen_event () {
			if ( !fr_is_visible(document.frm.<xsl:value-of select="@name"/>) ) return;
			<xsl:for-each select="if">
				<xsl:if test="position()!=1">else</xsl:if> if ( document.frm.<xsl:value-of select="../@name"/>.options[document.frm.<xsl:value-of select="../@name"/>.selectedIndex].value == "<xsl:value-of select="@value"/>" ) { fr_hs_fields(new Array(<xsl:value-of select="@hide"/>),new Array(<xsl:value-of select="@show"/>)); }
			</xsl:for-each>
			<xsl:choose>
				<xsl:when test="else">else { fr_hs_fields(new Array(<xsl:value-of select="else/@hide"/>),new Array(<xsl:value-of select="else/@show"/>)); }</xsl:when>
				<xsl:when test="count(if)=1">else { fr_hs_fields(new Array(<xsl:value-of select="if/@show"/>),new Array(<xsl:value-of select="if/@hide"/>)); }</xsl:when>
			</xsl:choose>
			<xsl:if test="@event"><xsl:value-of select="@name"/>_event();</xsl:if>
		}
		<xsl:value-of select="@name"/>_gen_event();
		</xsl:for-each>


		<!-- Generate Radio OnChange handler -->
		<xsl:for-each select="//select[if and @type='radio']">
		function <xsl:value-of select="@name"/>_gen_event () {
			var radios = document.frm.<xsl:value-of select="@name"/>;
			var flag = false;
			<xsl:for-each select="if">
				for(var i=0;i &lt; radios.length;i++) {
					if  ( radios[i].checked &amp;&amp; radios[i].value == "<xsl:value-of select="@value"/>" ) { flag = true; fr_hs_fields(new Array(<xsl:value-of select="@hide"/>),new Array(<xsl:value-of select="@show"/>)); }
				}
			</xsl:for-each>
			<xsl:choose>
				<xsl:when test="else">if (!flag) { fr_hs_fields(new Array(<xsl:value-of select="else/@hide"/>),new Array(<xsl:value-of select="else/@show"/>)); }</xsl:when>
				<xsl:when test="count(if)=1">if(!flag) { fr_hs_fields(new Array(<xsl:value-of select="if/@show"/>),new Array(<xsl:value-of select="if/@hide"/>)); }</xsl:when>
			</xsl:choose>
			<xsl:if test="@event"><xsl:value-of select="@name"/>_event();</xsl:if>
		}
		<xsl:value-of select="@name"/>_gen_event();
		</xsl:for-each>
		
		<!-- Generate CheckBox OnChange handler -->
		<xsl:for-each select="//input[@type='checkbox' and (@hide or @show)]">
		function <xsl:value-of select="@name"/>_gen_event () {
			if ( !fr_is_visible(document.frm.<xsl:value-of select="@name"/>) ) return;
			if ( document.frm.<xsl:value-of select="@name"/>.checked ) { fr_hs_fields(new Array(<xsl:value-of select="@hide"/>),new Array(<xsl:value-of select="@show"/>)); }
			else { fr_hs_fields(new Array(<xsl:value-of select="@show"/>),new Array(<xsl:value-of select="@hide"/>)); }
			<xsl:if test="@event"><xsl:value-of select="@name"/>_event();</xsl:if>
		}
		<xsl:value-of select="@name"/>_gen_event();
		</xsl:for-each>

		<xsl:for-each select="//field/select[@depend]">
			fr_depend_list(
				document.frm.<xsl:value-of select="@name"/>,
				top.<xsl:value-of select="@name"/>list, 
				(function(o){ var x = o.options[o.selectedIndex]; return x ? x.value : null; })(document.frm.<xsl:value-of select="@depend"/>),
				'<xsl:value-of select="/doc/*[local-name()=current()/@name]"/>',
				'<xsl:value-of select="@dependindex"/>'
			);
		</xsl:for-each>

		<xsl:for-each select="//field/slider">obj<xsl:value-of select='@name'/>.init( <xsl:choose><xsl:when test="/doc/*[local-name()=current()/@text]"><xsl:value-of select="/doc/*[local-name()=current()/@text]"/></xsl:when><xsl:otherwise><xsl:value-of select='@start'/></xsl:otherwise></xsl:choose> );</xsl:for-each>
	</script>
</xsl:template>

<xsl:template match="slist">
	top.<xsl:value-of select="@name"/>list = [<xsl:for-each select="val|msg"><xsl:if test="position()!=1">,</xsl:if><xsl:if test="local-name()='msg'"><xsl:variable name="mname" select="."/><xsl:if test="$msg/msg[@name=$mname]">['<xsl:value-of select="mgr:fixquote($msg/msg[@name=$mname])"/>'</xsl:if><xsl:if test="not($msg/msg[@name=$mname])">['<xsl:value-of select="mgr:fixquote(.)"/>'</xsl:if>,<xsl:if test="@key">'<xsl:value-of select="@key"/>'</xsl:if><xsl:if test="not(@key)">'<xsl:value-of select="mgr:fixquote(.)"/>'</xsl:if><xsl:for-each select="@*">,'<xsl:value-of select="mgr:fixquote(.)"/>'</xsl:for-each>]</xsl:if><xsl:if test="local-name() = 'val'">['<xsl:value-of select="mgr:fixquote(.)"/>',<xsl:if test="@key">'<xsl:value-of select="@key"/>'</xsl:if><xsl:if test="not(@key)">'<xsl:value-of select="mgr:fixquote(.)"/>'</xsl:if><xsl:for-each select="@*">,'<xsl:value-of select="mgr:fixquote(.)"/>'</xsl:for-each>]</xsl:if></xsl:for-each>];
</xsl:template>

<xsl:template match="form">
	<xsl:variable name="helpurl">
		<xsl:call-template name="replace">
			<xsl:with-param name="input" select="@helpurl"/>
			<xsl:with-param name="from" select="string('__LANG__')"/>
			<xsl:with-param name="to" select="/doc/@lang"/>
		</xsl:call-template>
	</xsl:variable>

	<xsl:if test="count(page[field]) &gt; 1 or /doc/error">
	<div id="pcDiv">
		<!-- Page controls -->
		<xsl:if test="count(page[field]) &gt; 1">
			<table border="0" cellspacing="0" cellpadding="0" width="100%">
				<tr>
					<xsl:for-each select="page[field]">
						<xsl:if test="position()!=1"><td class="pcontrol-sep"><img src="e.gif" width="2"/></td></xsl:if>
						<xsl:variable name="pageid"><xsl:value-of select="@id"/></xsl:variable>
						<td class="pcontrol" id="fphead_{position()-1}" onclick="fr_pager({position()-1})">
							<xsl:if test="position()=1"><xsl:attribute name="class">pcontrol-a</xsl:attribute></xsl:if>
							<table border="0" cellspacing="0" cellpadding="0" width="100%" id="{$pageid}">
							<tr>
								<td class="pcontrol-in-l"><img src="e.gif" width="5" height="22"/></td>
								<td class="pcontrol-in-c">
									<xsl:choose>
										<xsl:when test="$msg/msg[@name=current()/@name]"><xsl:value-of select="$msg/msg[@name=current()/@name]"/></xsl:when>
										<xsl:otherwise><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></xsl:otherwise>
									</xsl:choose>
								</td>
								<td class="pcontrol-in-r"><img src="e.gif" width="5" height="22"/></td>
							</tr>
							</table>
						</td>
					</xsl:for-each>
				</tr>
			</table>
		</xsl:if>

		<!-- Handle errors -->
		<xsl:if test="/doc/error">
			<table border="0" cellspacing="0" cellpadding="0" width="100%">
			<tr>
				<td class="error-tbl-margins">
					<table border="0" cellspacing="0" cellpadding="0" width="100%">
						<tr>
							<td class="error-title" width="35%"><script language="javascript">document.write(top.msg_error+':');</script></td>
							<td class="error-content" width="65%"><xsl:apply-templates select="/doc/error"/></td>
						</tr>
					</table>
				</td>
			</tr>
			</table>
		</xsl:if>
	</div>
	</xsl:if>

	<script type="text/javascript">
		top.mn_help_form_external = "<xsl:value-of select="$helpurl"/>";
	</script>


	<!-- Generate form -->
 	<form action="{$binary}" method="post">
		<xsl:choose>
			<xsl:when test="@name"><xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute></xsl:when>
			<xsl:otherwise><xsl:attribute name="name">frm</xsl:attribute></xsl:otherwise>
		</xsl:choose>
		<xsl:copy-of select="@enctype|@autocomplete"/>
		<xsl:if test="/doc/metadata/@onkeypress"><xsl:attribute name="onkeypress">;return ctrl_enter();</xsl:attribute></xsl:if>
		<xsl:if test="@clear"><xsl:attribute name="cleartoempty">cleartoempty</xsl:attribute></xsl:if>
		<xsl:attribute name="onsubmit">return frm_gen_event();</xsl:attribute>
		
		<div id="fieldsDiv">
		<table border="0" cellspacing="0" cellpadding="0" width="100%" id="fields">
		<tr>
			<td class="field-tbl-margins">
				<table border="0" cellspacing="0" cellpadding="0" class="field-tbl">
				<xsl:choose>
					<xsl:when test="count(page[field]) &gt; 1">
						<xsl:for-each select="page[field]">
							<tbody id="fpage_{position()-1}">
								<xsl:if test="position()!=1"><xsl:attribute name="style">display:none;</xsl:attribute></xsl:if>
								<xsl:apply-templates select="field"/>
							</tbody>
						</xsl:for-each>
					</xsl:when>
					<xsl:otherwise>
						<tbody><xsl:apply-templates select="//field"/></tbody>
					</xsl:otherwise>
				</xsl:choose>
				</table>
			</td>
		</tr>
		</table>
		</div>

		<div class="buttonsDiv" id="buttonsDiv">
			<xsl:choose>
				<xsl:when test="contains(/doc/metadata/@name,'.confirm')">
					<input type="hidden" name="func" value="{substring-before(/doc/metadata/@name,'.confirm')}"/>
					<input type="hidden" name="extop" value="on"/>
				</xsl:when>
				<xsl:otherwise>
					<input type="hidden" name="func" value="{/doc/metadata/@name}"/>
				</xsl:otherwise>
			</xsl:choose>
			<input type="hidden" name="elid"><xsl:attribute name="value"><xsl:value-of select="/doc/elid"/></xsl:attribute></input>
			<xsl:if test="/doc/plid"><input type="hidden" name="plid"><xsl:attribute name="value"><xsl:value-of select="/doc/plid"/></xsl:attribute></input></xsl:if>
			<xsl:if test="/doc/slave"><input type="hidden" name="slave"><xsl:attribute name="value"><xsl:value-of select="/doc/slave"/></xsl:attribute></input></xsl:if>
			<xsl:if test="@wizard = 'middle' or @wizard='last'">
				<input type="hidden" name="sback" value=""/>
				<input type="button" name="suback" tabindex="1" class="button" value="" style="margin-right:0px">
					<xsl:choose>
						<xsl:when test="@backevent"><xsl:attribute name="onclick">if ( frm_backevent() ) { this.form.sback.value='ok'; this.form.submit(); }</xsl:attribute></xsl:when>
						<xsl:otherwise><xsl:attribute name="onclick">this.form.sback.value='ok'; this.form.submit()</xsl:attribute></xsl:otherwise>
					</xsl:choose>
				</input>
			</xsl:if>
			<input type="hidden" name="sok" value="ok"/>
			
			<xsl:if test="not(/doc/metadata/form/@nosubmit)">
				<input type="submit" name="suok" tabindex="1" class="button" value="" style="font-weight: bold;"/>
			</xsl:if>
			
			<xsl:if test="not(/doc/metadata/@top)">
				<xsl:if test="not(/doc/metadata/form/@nocancel)">
					<input type="button" name="cancel" tabindex="1" class="button" value="" onClick="top.mn_cancel_form()"/>
				</xsl:if>
			</xsl:if>
		</div>

	</form>
</xsl:template>

<!-- Form field row -->
<xsl:template match="field">
	<xsl:if test="@optional and not( preceding-sibling::field[@optional] )">
		<tr>
			<td class="field-opt" colspan="2" onclick="fr_hs_optional(this); return false;" optflag="hide">
				<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td><span class="opthead"><xsl:value-of select="$amsg/msg[@name='msg_showoptional']"/></span></td>
					<td align="right" style="padding-right:12px; padding-top:1px;"><span class="optnote" id="optnote"></span></td>
				</tr>
				</table>
			</td>
		</tr>
	</xsl:if>

	<tr>
		<xsl:if test="@hidden"><xsl:attribute name="style">display:none</xsl:attribute><xsl:attribute name="hidden">yes</xsl:attribute></xsl:if>
		<xsl:if test="@optional"><xsl:attribute name="style">display:none</xsl:attribute><xsl:attribute name="optional">yes</xsl:attribute></xsl:if>
		<xsl:if test="@id"><xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute></xsl:if>

		<!-- field title cell -->
		<xsl:choose>
			<xsl:when test="@name and not(@fullwidth)">
				<td class="field-title">
					<xsl:if test="$msg/msg[@name=concat('hint_',current()/@name)]">
						<xsl:attribute name="hint"><xsl:value-of select="$msg/msg[@name=concat('hint_',current()/@name)]"/></xsl:attribute>
						<xsl:attribute name="onmouseover">top.mn_hnt(event)</xsl:attribute>
						<xsl:attribute name="onmouseout">top.mn_hintout()</xsl:attribute>
						<xsl:if test="$meta/@top">
							<xsl:attribute name="onmouseover">fr_hint("hint_<xsl:value-of select="@name"/>",event)</xsl:attribute>
							<xsl:attribute name="onmouseout">fr_hintout()</xsl:attribute>
						</xsl:if>
					</xsl:if>					
					<label><xsl:attribute name="for"><xsl:value-of select="@name"/>_checkbox</xsl:attribute>
					<xsl:value-of select="$msg/msg[@name=current()/@name]"/></label>
					
				</td>
			</xsl:when>
			<xsl:when test="not(@fullwidth)"><td class="field-title"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td></xsl:when>
		</xsl:choose>

		<!-- field controls cell -->
		<td class="field-content">
			<xsl:if test="@fullwidth">
				<xsl:attribute name="colspan">2</xsl:attribute>
				<xsl:attribute name="width">100%</xsl:attribute>
				<xsl:if test="@name">
					<div class="fw-title">
						<xsl:attribute name="hint"><xsl:value-of select="$msg/msg[@name=concat('hint_',current()/@name)]"/></xsl:attribute>
						<xsl:attribute name="onmouseover">top.mn_hnt(event)</xsl:attribute>
						<xsl:attribute name="onmouseout">top.mn_hintout()</xsl:attribute>
						<xsl:if test="$meta/@top">
							<xsl:attribute name="onmouseover">fr_hint("hint_<xsl:value-of select="@name"/>",event)</xsl:attribute>
							<xsl:attribute name="onmouseout">fr_hintout()</xsl:attribute>
						</xsl:if>
						<xsl:value-of select="$msg/msg[@name=current()/@name]"/>
						<xsl:if test="textarea/@autocomplete"><xsl:text> / </xsl:text><a href="#" onmouseout="top.mn_hintout()" onmouseover="top.mn_hnt(event)" hint="{$amsg/msg[@name='hint_autocomplete']}" onclick="fr_qtemplate(event,document.frm.{textarea[@autocomplete]/@name}); return false;"><xsl:value-of select="$amsg/msg[@name='msg_autocomplete']"/></a></xsl:if>
						<xsl:if test="textarea/@quote"><xsl:text> / </xsl:text><a href="#" onmouseout="top.mn_hintout()" onmouseover="top.mn_hnt(event)" hint="{$amsg/msg[@name='hint_quote']}" onclick="fr_quote(document.frm.{textarea[@quote]/@name}); return false;"><xsl:value-of select="$amsg/msg[@name='msg_quote']"/></a></xsl:if>
					</div>					
				</xsl:if>
			</xsl:if>

			<xsl:apply-templates select="input[@type = 'hidden']"/>

			<table border="0" cellpadding="0" cellspacing="0">
				<xsl:variable name="type">
					<xsl:if test="input/@type='checkbox'">checkbox</xsl:if>
				</xsl:variable>
				<xsl:if test="input and not(input/@width) and $type != 'checkbox'"><xsl:attribute name="style">width:100%; table-layout: fixed;</xsl:attribute></xsl:if>
				<xsl:if test="select and not(select/@width)"><xsl:attribute name="style">width:100%; table-layout: fixed;</xsl:attribute></xsl:if>
				<xsl:if test="(textarea and not(textarea/@width)) or htmldata"><xsl:attribute name="style">width:100%; table-layout: fixed;</xsl:attribute></xsl:if>
				<tr>
					<xsl:for-each select="input[@type != 'hidden']|select|listbox|radio|textarea|desc|textdata|htmldata|link|mgrview|slider|captcha">
						<xsl:if test="position() != 1">
							<td width="4">
								<xsl:if test="@lmargin"><xsl:attribute name="width"><xsl:value-of select="@lmargin"/></xsl:attribute></xsl:if>
								<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
							</td>
						</xsl:if>
						<xsl:apply-templates select="."/>
					</xsl:for-each>
				</tr>
				
			</table>
		</td>
	</tr>
</xsl:template>

<xsl:template match="captcha">
	<xsl:variable name="public-key" select="/doc/recaptcha/text()"/>
	
	<xsl:if test="@name='recaptcha' and $public-key">
		<td align="center">
			<center>
				<script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k={$public-key}"/>
			</center>
		</td>
	</xsl:if>
</xsl:template>

<!-- Input TEXT form control -->
<xsl:template match="input[@type='text']">
	<td>
		<xsl:if test="@type='password'"><input type='text' class='input' tabindex='1' style='display:none; float:left;' name='{@name}gen' onchange='this.form.{@name}.value = this.value'><xsl:if test="@checkpasswd and not($meta/@top)"><xsl:attribute name="class">input2</xsl:attribute></xsl:if></input></xsl:if>
		<input tabindex="1" class="input">
			<xsl:if test="../@zoom or @unlimit or (@checkpasswd and not($meta/@top))"><xsl:attribute name="class">input</xsl:attribute></xsl:if>
			<xsl:if test="@width"><xsl:attribute name="style">width:<xsl:value-of select="@width"/>;</xsl:attribute></xsl:if>
			<xsl:if test="@event"><xsl:attribute name="onchange"><xsl:value-of select="@name"/>_event();</xsl:attribute></xsl:if>

			<xsl:choose>
				<xsl:when test="/doc/*[local-name()=current()/@name]"><xsl:attribute name="value"><xsl:value-of select="/doc/*[local-name()=current()/@name]"/></xsl:attribute></xsl:when>
				<xsl:otherwise><xsl:copy-of select="@value"/></xsl:otherwise>
			</xsl:choose>

			<xsl:for-each select="@*[name()!='value']"><xsl:copy/></xsl:for-each>
		</input>
		<xsl:if test="../@zoom">
			<textarea name="{@name}_list" class="textinput" rows="{../@zoom}" style="float:left; display:none;" onchange="fr_set_prop('{@name}')"/>
		</xsl:if>
	</td>

	<xsl:if test="@unlimit">
		<td width="16"><img src="ff-unlimit.gif" width="16" height="17" class="input-img" onclick="top.mn_hintout(); document.frm.{@name}.value='{@unlimit}'" onmousedown="this.src='ff-unlimit-a.gif'" onmouseup="this.src='ff-unlimit.gif'" hint="{$amsg/msg[@name='msg_unlimit']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"/></td>
	</xsl:if>
	<xsl:if test="@date">
		<td width="16"><img src="ff-calendar.gif" width="16" height="17" class="input-img" onclick="top.cl_show(document.frm.{@name},event);" onmousedown="this.src='ff-calendar-a.gif'" onmouseup="this.src='ff-calendar.gif'" hint="{$amsg/msg[@name='msg_calendar']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"/></td>
	</xsl:if>
	<xsl:if test="../@zoom">
		<td width="16" valign="top"><img src="ff-zoom.gif" width="16" height="17" class="input-img" onclick="fr_zoom_field(this,'{@name}');" cimg="ff-zoom" caimg="ff-unzoom" onmousedown="this.src=this.getAttribute('cimg')+'-a.gif'" onmouseup="this.src=this.getAttribute('caimg')+'.gif'" hint="{$amsg/msg[@name='msg_zoom']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"/></td>
	</xsl:if>
	<xsl:if test="@aimg">
		<td width="16" valign="top"><img src="{@aimg}" action="{@aimgaction}" width="16" height="17" class="input-img" onclick="fr_aimg(this,'{@name}','click')" onmousedown="fr_aimg(this,'{@name}','down')" onmouseup="fr_aimg(this,'{@name}','up')" hint="{$msg/msg[@name=current()/@aimghint]}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"/></td>
	</xsl:if>
</xsl:template>

<!-- Input PASSWORD form control -->
<xsl:template match="input[@type='password']">
	<td>
		<input type='text' class='input' tabindex='1' style='display:none; float:left;' name='{@name}gen' onchange='this.form.{@name}.value = this.value'><xsl:if test="@checkpasswd"><xsl:attribute name="class">input</xsl:attribute></xsl:if></input>
		<input tabindex="1" class="input" autocomplete="off">
			<xsl:if test="@checkpasswd"><xsl:attribute name="class">input</xsl:attribute></xsl:if>
			<xsl:if test="@width"><xsl:attribute name="style">width:<xsl:value-of select="@width"/>;</xsl:attribute></xsl:if>
			<xsl:if test="@event"><xsl:attribute name="onchange"><xsl:value-of select="@name"/>_event();</xsl:attribute></xsl:if>

			<xsl:choose>
				<xsl:when test="/doc/*[local-name()=current()/@name]"><xsl:attribute name="value"><xsl:value-of select="/doc/*[local-name()=current()/@name]"/></xsl:attribute></xsl:when>
				<xsl:when test="$meta//input[@checkpasswd = current()/@name] and /doc/*[local-name()=$meta//input[@checkpasswd = current()/@name]/@name]"><xsl:attribute name="value"><xsl:value-of select="/doc/*[local-name()=$meta//input[@checkpasswd = current()/@name]/@name]"/></xsl:attribute></xsl:when>
				<xsl:otherwise><xsl:copy-of select="@value"/></xsl:otherwise>
			</xsl:choose>
			<xsl:for-each select="@*[name()!='value']"><xsl:copy/></xsl:for-each>
		</input>
	</td>
	<xsl:if test="@checkpasswd and not($meta/@top)">
		<td width="16"><img src="ff-genpwd.gif" width="16" height="17" class="input-img" onclick="fr_gen_passwd('{@name}','{@checkpasswd}');" onmousedown="this.src='ff-genpwd-a.gif'" onmouseup="this.src='ff-genpwd.gif'"  hint="{$amsg/msg[@name='msg_genpwd']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"/></td>
	</xsl:if>
	<xsl:if test="@checkpasswd and $meta/@top">
		<td width="16"><img src="ff-genpwd.gif" width="16" height="17" class="input-img" onclick="fr_gen_passwd('{@name}','{@checkpasswd}');" onmousedown="this.src='ff-genpwd-a.gif'" onmouseup="this.src='ff-genpwd.gif'" onmouseover="fr_hint('msg_genpwd',event)" onmouseout="fr_hintout()"/></td>
	</xsl:if>
</xsl:template>

<!-- Input FILE form control -->
<xsl:template match="input[@type='file']">
	<td>
		<input tabindex="1" class="finput">
			<xsl:if test="@event"><xsl:attribute name="onchange"><xsl:value-of select="@name"/>_event();</xsl:attribute></xsl:if>
			<xsl:choose>
				<xsl:when test="/doc/*[local-name()=current()/@name]"><xsl:attribute name="value"><xsl:value-of select="/doc/*[local-name()=current()/@name]"/></xsl:attribute></xsl:when>
				<xsl:otherwise><xsl:copy-of select="@value"/></xsl:otherwise>
			</xsl:choose>
			<xsl:for-each select="@*[name()!='value']"><xsl:copy/></xsl:for-each>
		</input>
	</td>
</xsl:template>

<!-- Input CHECKBOX form control -->
<xsl:template match="input[@type='checkbox']">
	<td>
		<input tabindex="1" class="checkbox">
			<xsl:attribute name="id"><xsl:value-of select="@name"/>_checkbox</xsl:attribute>
			<xsl:choose>
				<xsl:when test="@hide or @show"><xsl:attribute name="onclick"><xsl:value-of select="@name"/>_gen_event();</xsl:attribute></xsl:when>
				<xsl:when test="@event"><xsl:attribute name="onclick"><xsl:value-of select="@name"/>_event();</xsl:attribute></xsl:when>
			</xsl:choose>
			<xsl:if test="/doc/*[local-name()=current()/@name]"><xsl:attribute name="checked">yes</xsl:attribute></xsl:if>
			<xsl:for-each select="@*[name()!='value']"><xsl:copy/></xsl:for-each>
		</input>
	</td>
</xsl:template>

<!-- Input HIDDEN form control -->
<xsl:template match="input[@type='hidden']">
	<input>
		<xsl:choose>
			<xsl:when test="/doc/*[local-name()=current()/@name]"><xsl:attribute name="value"><xsl:value-of select="/doc/*[local-name()=current()/@name]"/></xsl:attribute></xsl:when>
			<xsl:otherwise><xsl:copy-of select="@value"/></xsl:otherwise>
		</xsl:choose>
		<xsl:for-each select="@*[name()!='value']"><xsl:copy/></xsl:for-each>
	</input>
</xsl:template>

<!-- Textarea form control -->
<xsl:template match="textarea">
	<td>
		<textarea tabindex="1" class="textinput">
			<xsl:if test="@width"><xsl:attribute name="style">width:<xsl:value-of select="@width"/>;</xsl:attribute></xsl:if>
			<xsl:if test="@height"><xsl:attribute name="style">height:<xsl:value-of select="@height"/>;</xsl:attribute></xsl:if>
			<xsl:if test="@width and @height"><xsl:attribute name="style">width:<xsl:value-of select="@width"/>; height:<xsl:value-of select="@height"/>;</xsl:attribute></xsl:if>
			<xsl:if test="@autocomplete"><xsl:attribute name="onkeydown">fr_qtemplate(event);</xsl:attribute></xsl:if>
			<xsl:for-each select="@*"><xsl:copy/></xsl:for-each>
			<xsl:value-of select="/doc/*[local-name()=current()/@name]"/>
		</textarea>
	</td>
</xsl:template>






<!-- Select form control -->
<xsl:template match="select">
<xsl:choose>
<xsl:when test="@type='radio'">
	<xsl:variable name="rname" select="@name"/>
	<xsl:variable name="iff" select="if"/>
	<xsl:variable name="ev" select="@event"/>
	<td>
		<xsl:for-each select="/doc/slist[@name=$rname]/*">
			<xsl:variable name="oname" select="."/>
		
			<input type="radio" class="radio">
				<xsl:attribute name="onclick">
					<xsl:choose>
						<xsl:when test="$iff"><xsl:value-of select="$rname"/>_gen_event();</xsl:when>
						<xsl:when test="$ev"><xsl:value-of select="$rname"/>_event();</xsl:when>
					</xsl:choose>
				</xsl:attribute>			
			
				<xsl:attribute name="name"><xsl:value-of select="$rname"/></xsl:attribute>
				<xsl:choose>
					<xsl:when test="local-name()='val' and @key"><xsl:attribute name="value"><xsl:value-of select="@key"/></xsl:attribute></xsl:when>
					<xsl:when test="local-name()='msg' and @key"><xsl:attribute name="value"><xsl:value-of select="@key"/></xsl:attribute></xsl:when>
					<xsl:otherwise><xsl:attribute name="value"><xsl:value-of select="$oname"/></xsl:attribute></xsl:otherwise>
				</xsl:choose>	
				
				<xsl:choose>
					<xsl:when test="@key"><xsl:if test="string(/doc/*[local-name()=$rname]) = string(@key)"><xsl:attribute name="checked">Yes</xsl:attribute></xsl:if></xsl:when>
					<xsl:when test="/doc/*[local-name() = $rname][. = $oname]"><xsl:attribute name="checked">Yes</xsl:attribute></xsl:when>
					<xsl:otherwise>
						<xsl:if test="position()=1"><xsl:attribute name="checked">Yes</xsl:attribute></xsl:if> 
					</xsl:otherwise>
				</xsl:choose>				
			</input>
			
			<xsl:choose>
				<xsl:when test="local-name()='msg' and $msg/msg[@name=$oname]"><xsl:value-of select="$msg/msg[@name=$oname]"/></xsl:when>
				<xsl:otherwise><xsl:value-of select="$oname"/></xsl:otherwise>
			</xsl:choose>
			<br/>
		</xsl:for-each>
	</td>
</xsl:when>
<xsl:otherwise>
	<xsl:variable name="sname" select="@name"/>
	<td>
	<select tabindex="1" class="input">
		<xsl:if test="@size"><xsl:attribute name="class">listbox</xsl:attribute><xsl:attribute name="multiple">yes</xsl:attribute></xsl:if>
		<xsl:if test="@width"><xsl:attribute name="style">width:<xsl:value-of select="@width"/>;</xsl:attribute></xsl:if>
		<xsl:attribute name="onchange">
			<xsl:for-each select="../../field/select[@depend=current()/@name]/@name">fr_depend_list(this.form.<xsl:value-of select="."/>,top.<xsl:value-of select="."/>list,(function(o){ var x = o.options[o.selectedIndex]; return x ? x.value : null; })(this),null,'<xsl:value-of select="../@dependindex"/>');</xsl:for-each>
			<xsl:for-each select="../../field/select[@dependact=current()/@name]"><xsl:choose><xsl:when test="if"><xsl:value-of select="@name"/>_gen_event();</xsl:when><xsl:when test="@event"><xsl:value-of select="@name"/>_event();</xsl:when></xsl:choose></xsl:for-each>
			<xsl:choose>
				<xsl:when test="if"><xsl:value-of select="@name"/>_gen_event();</xsl:when>
				<xsl:when test="@event"><xsl:value-of select="@name"/>_event();</xsl:when>
			</xsl:choose>
		</xsl:attribute>

		<xsl:for-each select="@*"><xsl:copy/></xsl:for-each>

		<xsl:for-each select="/doc/slist[@name=$sname]/*">
			<xsl:variable name="oname" select="."/>

			<option>
				<xsl:choose>
					<xsl:when test="local-name()='val' and @key"><xsl:attribute name="value"><xsl:value-of select="@key"/></xsl:attribute></xsl:when>
					<xsl:when test="local-name()='msg' and @key"><xsl:attribute name="value"><xsl:value-of select="@key"/></xsl:attribute></xsl:when>
					<xsl:otherwise><xsl:attribute name="value"><xsl:value-of select="$oname"/></xsl:attribute></xsl:otherwise>
				</xsl:choose>

				<xsl:choose>
					<xsl:when test="@key"><xsl:if test="/doc/*[local-name()=$sname][. = current()/@key]"><xsl:attribute name="selected">1</xsl:attribute></xsl:if></xsl:when>
					<xsl:otherwise><xsl:if test="/doc/*[local-name()=$sname][. = $oname]"><xsl:attribute name="selected">1</xsl:attribute></xsl:if></xsl:otherwise>
				</xsl:choose>

				<xsl:choose>
					<xsl:when test="local-name()='msg' and $msg/msg[@name=$oname]">
						<xsl:value-of select="$msg/msg[@name=$oname]"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$oname"/>
					</xsl:otherwise>
				</xsl:choose>
			</option>
		</xsl:for-each>
	</select>
	</td>

	<xsl:if test="@urlopen"><td width="16"><img src="ff-openurl.gif" width="16" height="17" class="input-img" onclick="fr_url_open('{@name}',{@urlopen});" onmousedown="this.src='ff-openurl-a.gif'" onmouseup="this.src='ff-openurl.gif'" hint="{$amsg/msg[@name='msg_openurl']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"/></td></xsl:if>
	<xsl:if test="@size"><td width="16" valign="top">
		<img src="ff-plus.gif" width="16" height="17" class="input-img" onclick="fr_lb_select('{@name}',true);" onmousedown="this.src='ff-plus-a.gif'" onmouseup="this.src='ff-plus.gif'" hint="{$amsg/msg[@name='msg_plus']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"/><br/>
		<img src="ff-minus.gif" width="16" height="16" class="input-img" onclick="fr_lb_select('{@name}',false);" onmousedown="this.src='ff-minus-a.gif'" onmouseup="this.src='ff-minus.gif'" hint="{$amsg/msg[@name='msg_minus']}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()"/>
	</td></xsl:if>
</xsl:otherwise>
	
</xsl:choose>	
	
</xsl:template>





<!-- text message after form control -->
<xsl:template match="desc">
	<td class="desc" id="desc-{../@name}">
		<label for="{@name}_checkbox" hint="{$msg/msg[@name=concat('hint_',current()/../@name)]}" onmouseover="top.mn_hnt(event)" onmouseout="top.mn_hintout()">
			<xsl:if test="@id"><xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute></xsl:if>
			<xsl:value-of select="$msg/msg[@name=current()/@name]"/>
		</label>
	</td>
</xsl:template>

<!-- text data in form -->
<xsl:template match="textdata">
	<td class="textdata">
		<xsl:if test="@warning"><xsl:attribute name="class">textdata-warning</xsl:attribute></xsl:if>
		<xsl:for-each select="@*"><xsl:copy/></xsl:for-each>
		<xsl:choose>
			<xsl:when test="@type='msg'"><xsl:value-of select="$msg/msg[@name=current()/@name]" disable-output-escaping="yes"/></xsl:when>
			<xsl:when test="@type='data'"><xsl:value-of select="/doc/*[local-name()=current()/@name]" disable-output-escaping="yes"/></xsl:when>
			<xsl:when test="@type='msgdata'"><xsl:value-of select="$msg/msg[@name=/doc/*[local-name()=current()/@name]]" disable-output-escaping="yes"/></xsl:when>
		</xsl:choose>
	</td>
</xsl:template>

<!-- htmldata - scrolled div -->
<xsl:template match="htmldata">
	<td>
	<xsl:element name="div">
		<xsl:attribute name="class">htmldata</xsl:attribute>
		<xsl:choose>
			<xsl:when test="@width"><xsl:attribute name="style">width:<xsl:value-of select="@width"/>; height:<xsl:value-of select="@height"/>px;</xsl:attribute></xsl:when>
			<xsl:when test="ancestor::form/@maxwidth"><xsl:attribute name="style">width:100%; height:<xsl:value-of select="@height"/>px;</xsl:attribute></xsl:when>
			<xsl:when test="../@fullwidth"><xsl:attribute name="style">width:406px; height:<xsl:value-of select="@height"/>px;</xsl:attribute></xsl:when>
			<xsl:otherwise><xsl:attribute name="style">height:<xsl:value-of select="@height"/>px;</xsl:attribute></xsl:otherwise>
		</xsl:choose>
		<xsl:for-each select="@*"><xsl:copy/></xsl:for-each>

		<div class="htmldata-in"><xsl:value-of select="/doc/*[local-name()=current()/@name]" disable-output-escaping="yes"/></div>
	</xsl:element>
	<xsl:if test="@chheight"><div class="chheight" onmousedown="fr_md_chheight(event,'{@id}','{@chheight}')"><img src="e.gif" width="1" height="3"/></div></xsl:if>
	</td>
</xsl:template>

<xsl:template match="link">
	<td><a>
		<xsl:choose>
			<xsl:when test="@href"><xsl:attribute name="href"><xsl:value-of select="/doc/*[local-name()=current()/@name]" disable-output-escaping="yes"/>
			<xsl:if test="@name='tologon'">&amp;lang=<xsl:value-of select="/doc/@lang"/></xsl:if></xsl:attribute></xsl:when>
			<xsl:otherwise><xsl:attribute name="onclick"><xsl:value-of select="/doc/*[local-name()=current()/@name]" disable-output-escaping="yes"/></xsl:attribute></xsl:otherwise>
		</xsl:choose>
		<xsl:if test="@target"><xsl:attribute name="target"><xsl:value-of select="@target"/></xsl:attribute></xsl:if>
		<xsl:value-of select="$msg/msg[@name=current()/@name]" disable-output-escaping="yes"/>
	</a></td>
</xsl:template>

<xsl:template match="mgrview">
	<td>
		<div class="mgrview">
			<div id="mvlogo" style="position: relative; left: 9px; top: 6px; background: #2f8dd5; width: 33px; height: 20px"></div>
			<div id="mvtblhead" style="position: relative; left: 57px; top: 12px; background: #afcaec; width: 193px; height: 9px;"></div>
			<div id="mvform" style="position: relative; left: 72px; top: 23px; background: #4d80b6; width: 108px; height: 73px;">
				<div style="position: relative; left: 1px; top: 10px; background: #efefef; width: 106px; height: 62px;"></div>
			</div>
			<div id="mvtblfoot" style="position: relative; left: 57px; top: 66px; background: #afcaec; width: 193px; height: 9px;"></div>
		</div>
	</td>
</xsl:template>

<xsl:template match="slider">
	<td>
		<script language="JavaScript">obj<xsl:value-of select='@name'/> = new Slider( { id: "<xsl:value-of select='@name'/>", min: <xsl:value-of select='@min'/>, max: <xsl:value-of select='@max'/>, text: "<xsl:value-of select='@text'/>", change: "<xsl:value-of select='@change'/>" } );</script>
	</td>
</xsl:template>


<xsl:template match="error">
	<xsl:variable name="er" select="."/>
	<script language="javascript">
		var iserror = true;
		<xsl:if test="@obj">
            var aTmp = "<xsl:value-of select="mgr:fixquote(@obj)"/>";
            var bTmp = aTmp.replace(/[^A-Za-z0-9_]/g, '');
			if ( top["msg_obj_" + bTmp] ) { document.write( top["msg_obj_" + bTmp] );
			} else if ( "<xsl:value-of select="$msg/msg[@name=/doc/metadata/form//field[*/@name=current()/@obj]/@name]"/>" != "" ) {
				document.write(" <xsl:value-of select="$msg/msg[@name=/doc/metadata/form//field[*/@name=current()/@obj]/@name]"/>" );
				<xsl:if test="/doc/metadata/form/page">setTimeout("fr_pager(<xsl:for-each select="/doc/metadata/form/page"><xsl:if test="field/*/@name=$er/@obj"><xsl:value-of select="position()-1"/></xsl:if></xsl:for-each>);",1);</xsl:if>
				fr_focus = "<xsl:value-of select="@val"/>";
			} else { document.write("<xsl:value-of select="@obj"/>"); }
		</xsl:if>
		<xsl:if test="@val">
			<xsl:choose>
				<xsl:when test="$msg/msg[@name=/doc/metadata/form//field[*/@name=current()/@val]/@name]">
					document.write(" <xsl:value-of select="$msg/msg[@name=/doc/metadata/form//field[*/@name=current()/@val]/@name]"/>");
					<xsl:if test="/doc/metadata/form/page">setTimeout("fr_pager(<xsl:for-each select="/doc/metadata/form/page"><xsl:if test="field/*/@name=$er/@val"><xsl:value-of select="position()-1"/></xsl:if></xsl:for-each>);",1);</xsl:if>
					fr_focus = "<xsl:value-of select="@val"/>";
				</xsl:when>
				<xsl:otherwise>document.write(' <xsl:value-of select="@val"/>');</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
		document.write( ' '+top.msg_error_<xsl:value-of select="@code"/> );
	</script>
	
	<xsl:choose>
		<xsl:when test=".">
			<xsl:text> </xsl:text><xsl:value-of select="."/>
		</xsl:when>
		<xsl:when test="@msg">
			<xsl:value-of select="@msg"/>
			<!--<xsl:choose>
				<xsl:when test="$msg/msg[@name=concat('msg_error_',current()/@msg)]"><xsl:text> </xsl:text><xsl:value-of select="$msg/msg[@name=concat('msg_error_',current()/@msg)]"/></xsl:when>
				<xsl:otherwise><xsl:value-of select="@msg"/></xsl:otherwise>
			</xsl:choose>-->
		</xsl:when>
	</xsl:choose>

	<xsl:choose> 
		<xsl:when test="@report">
			<xsl:text> </xsl:text>
			<a href="javascript:void(0);" onclick="top.mn_cancel_form();top.mn_form_show('{$binary}?func=errorjournal.edit&amp;elid=' + escape('{@report}'));">
				<xsl:value-of select="/doc/addonmessages/msg[@name='msg_moreinfo']"/>
			</a>
		</xsl:when>
		<xsl:when test="@code = '8'">
			<xsl:variable name="err-desc-lang-code">
				<xsl:choose>
					<xsl:when test="/doc/@lang = 'ru' or /doc/@lang = 'fr'"><xsl:value-of select="/doc/@lang"/></xsl:when>
					<xsl:otherwise>en</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>
			
			<xsl:if test="@kb">
				<xsl:text> </xsl:text>
				<a href="http://{$err-desc-lang-code}.ispdoc.com/index.php/kb_{@msg}" target="_blank">
					<xsl:value-of select="/doc/addonmessages/msg[@name='msg_moreinfo']"/>
				</a>
			</xsl:if>
			<xsl:text> </xsl:text>
			
			<!-- a href="http://{$err-desc-lang-code}.ispdoc.com/index.php/kb_{@kb}" target="_blank">
				<xsl:value-of select="/doc/addonmessages/msg[@name='msg_moreinfo']"/>
			</a-->
		</xsl:when> 
	</xsl:choose>
	
</xsl:template>

<xsl:template match="metadata[@type='dashboard']">
	<table class="content-table">
	<tbody class="mainHead">
		<tr>
			<xsl:for-each select="$meta/coldata/col">
				<td>
					<div>
						<table cellpadding="0" cellspacing="0" border="0" class="thtbl">
						<tr>
							<td class="thtbl-1"><xsl:value-of select="$msg/msg[@name=current()/@name]"/></td>
							<td class="thtbl-2"><img src="e.gif" width="10" height="7" id="sortimg{position()-1}"/></td>
						</tr>
						</table>
					</div>
				</td>
			</xsl:for-each>
			<td class="lasttd">
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
		</tr>
	</tbody>
	<tbody class="mainBody">
		<xsl:for-each select="/doc/elem">
			<xsl:variable name="el" select="."/>
			<xsl:variable name="even" select="position() mod 2"/>

			<xsl:element name="tr">
				<xsl:attribute name="id"><xsl:value-of select="generate-id()"/></xsl:attribute>
				<xsl:if test="$even = 0"><xsl:attribute name="class">even</xsl:attribute></xsl:if>

				<xsl:for-each select="$meta/coldata/col">
					<xsl:variable name="col" select="."/>
					<xsl:variable name="cell-style">
						<xsl:if test='$el/*[local-name() = current()/@name]/@xprop'>padding: 2px 3px;</xsl:if>
						<xsl:choose>
							<xsl:when test="position() = 1 and position() = last()">border-left: 0px; border-right-color: #FFFFFF;</xsl:when>
							<xsl:when test="position() = 1">border-left: 0px;</xsl:when>
						</xsl:choose>
					</xsl:variable>
					
					<td>
						<xsl:attribute name="style"><xsl:value-of select="$cell-style"/></xsl:attribute>

						<xsl:choose>
							<!-- column is text data from element inner xml tag. @name contain name of xml tag -->
							<xsl:when test="@type='data'">
								<xsl:call-template name="coldata"><xsl:with-param name="el" select="$el"/><xsl:with-param name="col" select="$col"/></xsl:call-template>
							</xsl:when>
							<!-- column is message from msg_LANG.xml. @name contain part of message name -->
							<xsl:when test="@type='msg'">
								<xsl:call-template name="colmsg"><xsl:with-param name="el" select="$el"/><xsl:with-param name="col" select="$col"/></xsl:call-template>
							</xsl:when>
							<!-- column contain element properties as image. for example, site have php, cgi, ... -->
							<xsl:when test="prop">
								<xsl:call-template name="colprop"><xsl:with-param name="el" select="$el"/><xsl:with-param name="col" select="$col"/></xsl:call-template>
							</xsl:when>
							<!-- column contain indicator -->
							<xsl:when test="@type='indicator'">
								<xsl:attribute name="class">indtd</xsl:attribute>
								<xsl:call-template name="indicator">
									<xsl:with-param name="used" select="$el/*[local-name() = current()/@name]/@used"/>
									<xsl:with-param name="all" select="$el/*[local-name() = current()/@name]/@limit"/>
								</xsl:call-template>
							</xsl:when>
						</xsl:choose>
					</td>
				</xsl:for-each>
				<td>
					<xsl:choose>
						<xsl:when test="$even = 0"><xsl:attribute name="style">border-right-color: #EFEFEF;</xsl:attribute></xsl:when>
						<xsl:when test="$even = 1"><xsl:attribute name="style">border-right-color: #FFFFFF;</xsl:attribute></xsl:when>
					</xsl:choose>
					<xsl:for-each select="$meta/toolbar/toolbtn">
						<a>
							<xsl:attribute name="onclick">top.mn_load_list("<xsl:value-of select="$meta/@name"/>"); db_op_edit("<xsl:value-of select="@func"/>","<xsl:value-of select="$el/*[local-name()=$meta/@key]"/>")</xsl:attribute>
							<xsl:value-of select="$msg/msg[@name=concat('short_',current()/@name)]"/>
						</a><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
					</xsl:for-each>
				</td>
			</xsl:element>
		</xsl:for-each>
	</tbody>
	</table>
</xsl:template>

<xsl:template name="pngsrc">
	<xsl:param name="src"/><xsl:param name="animated"/>

	<xsl:choose>
		<xsl:when test="$animated = 'yes'">
			<xsl:attribute name="src"><xsl:value-of select="substring-before($src,'.png')"/>.gif</xsl:attribute>
		</xsl:when>
		<xsl:when test="$fixpng = 'yes'">
			<xsl:attribute name="src">e.gif</xsl:attribute>
			<xsl:attribute name="style">filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<xsl:value-of select="/doc/@theme"/><xsl:value-of select="/doc/@img"/><xsl:value-of select="$src"/>',sizingMethod='scale')</xsl:attribute>
		</xsl:when>
		<xsl:otherwise>
			<xsl:attribute name="src"><xsl:value-of select="$src"/></xsl:attribute>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

</xsl:stylesheet>