<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="html" indent="no"/>
<xsl:strip-space elements="*"/>
	<!--MENU-->
	<xsl:template match="MENU" mode="top">
		<xsl:apply-templates select="MENU-ITEM"  mode="top"/>
	</xsl:template>
 

	<!--MENU-ITEM-->
	<xsl:template match="MENU-ITEM"  mode="top">
			<xsl:choose>
            <!-- when vizited inside-->
            	<xsl:when test="MENU-ITEM[@ID=/LAYOUT/@ID]" >
    				<td><a href="{@HREF}" class="amenu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>					
                </xsl:when>
                <!-- when active-->
                <xsl:when test="MENU-ITEM[@ID=/LAYOUT/@ID] or @ID=/LAYOUT/@ID" >
    				<td><span class="amenu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></span></td>					
                </xsl:when>
                <xsl:otherwise>
    				<td><a href="{@HREF}" class="menu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>					
                </xsl:otherwise>
            </xsl:choose>
            <xsl:if test="position()!=last()">
   				<td width="10"></td>					
   				<td><img src="images/separator.png" width="14" height="8"/></td>
   				<td width="10"></td>
  	   		</xsl:if>
	</xsl:template>


	<xsl:template match="MENU-ITEM" mode="sub">
        <xsl:choose>
            <xsl:when test="@ID=/LAYOUT/@ID" >
   				<td><span class="asubmenu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></span></td>					
   				<xsl:if test="position()!=last()">
    				<td width="10"></td>					
    				<td><img src="images/submenu_separator.gif"/></td>
    				<td width="10"></td>
	   			</xsl:if>
            </xsl:when>
            <xsl:otherwise>
				<xsl:if test="../MENU-ITEM[@ID=/LAYOUT/@ID] or ../../MENU-ITEM[@ID=/LAYOUT/@ID]">
	   				<td><a href="{@HREF}" class="submenu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>					
    				<xsl:if test="position()!=last()">
        				<td width="10"></td>					
        				<td><img src="images/submenu_separator.gif"/></td>
        				<td width="10"></td>
	 	   			</xsl:if>
				</xsl:if>
            </xsl:otherwise>
		</xsl:choose>
	</xsl:template>

</xsl:stylesheet>
