<?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:variable name="position"><xsl:value-of select="position()" /></xsl:variable>
   		<xsl:choose>
           <!-- when vizited inside-->
           	<xsl:when test="MENU-ITEM[@ID=/LAYOUT/@ID]" >
        		<table cellpadding="0" cellspacing="0" border="0">
        		<tr>
        		<td class="menuitemactive"><a href="{@HREF}"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
        		<td class="menumark"><a href="{@HREF}"><img src="images/mark.gif" width="18" height="13" border="0" alt=""/></a></td>
        		</tr>
        		</table>
            </xsl:when>
            <!-- when active-->
            <xsl:when test="MENU-ITEM[@ID=/LAYOUT/@ID] or @ID=/LAYOUT/@ID" >
        		<table cellpadding="0" cellspacing="0" border="0">
        		<tr>
        		<td class="menuitemactive"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></td>
        		<td class="menumark"><img src="images/mark.gif" width="18" height="13" border="0" alt=""/></td>
        		</tr>
        		</table>
            </xsl:when>
            <xsl:otherwise>
        		<table cellpadding="0" cellspacing="0" border="0">
        		<tr>
        		<td class="menuitem"><a href="{@HREF}"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
        		<td class="menumark"><a href="{@HREF}"><img src="images/mark.gif" width="18" height="13" border="0" alt=""/></a></td>
        		</tr>
        		</table>
            </xsl:otherwise>
        </xsl:choose>
	</xsl:template>

   				

	<xsl:template match="MENU-ITEM" mode="sub">
        <xsl:choose>
            <xsl:when test="@ID=/LAYOUT/@ID" >
            	<table cellpadding="0" cellspacing="0" border="0">
            	<tr>
            	<td class="secondmenumark"><img src="images/2nd_mark_dark.gif" width="12" height="12" border="0" alt=""/></td>
            	<td class="secondmenuitemactive"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></td>
            	</tr>
            	</table>
            </xsl:when>
            <xsl:otherwise>
				<xsl:if test="../MENU-ITEM[@ID=/LAYOUT/@ID] or ../../MENU-ITEM[@ID=/LAYOUT/@ID]">
                	<table cellpadding="0" cellspacing="0" border="0">
                	<tr>
                	<td class="secondmenumark"><a href="{@HREF}"><img src="images/2nd_mark_dark.gif" width="12" height="12" border="0" alt=""/></a></td>
                	<td class="secondmenuitem"><a href="{@HREF}"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
                	</tr>
                	</table>
				</xsl:if>
            </xsl:otherwise>
		</xsl:choose>
	</xsl:template>



</xsl:stylesheet>
