<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:template match="/">		
			<xsl:apply-templates select="menubars" />		
	</xsl:template>
	<xsl:template match="menubars">		
	<TABLE cellSpacing="0" cellspacing="1" class="TopMenus">
			<TR ALIGN='left' VALIGN='center'>			
				<xsl:for-each select="menus">				
					<A ID='start'>
						<TD ALIGN='left'>
						<DIV class='clsMenuBarCells'>
							<xsl:choose>
								<xsl:when test="items">
									<xsl:attribute name="ONMOUSEOVER">startIts('menus<xsl:value-of select="position()"/>',this,0)</xsl:attribute>
									<xsl:value-of select="name" />
								</xsl:when>
								<xsl:when test="link">
									<xsl:attribute name="ONMOUSEOVER">hideDivs(0);</xsl:attribute>
									<xsl:attribute name="ONMOUSEOUT">stateChanges('',this,'',event)</xsl:attribute>
									<xsl:attribute name="ONCLICK">Selects('<xsl:value-of select="link" />','<xsl:value-of select="VisitedMenu" />','<xsl:value-of select="MId" />','<xsl:value-of select="name" />','<xsl:value-of select="AccessRights" />','<xsl:value-of select="menuname" />','<xsl:value-of select="MyMenu" />','<xsl:value-of select="HelpPath" />','<xsl:value-of select="ScrId" />','<xsl:value-of select="MenuPath" />','<xsl:value-of select="ScreenType" />',event)</xsl:attribute>
									<xsl:value-of select="name" />
								</xsl:when>
							</xsl:choose>
						 </DIV>	
						</TD>
					</A>					
				</xsl:for-each>
			</TR>
		</TABLE>
		<!-- write out the hidden divs for submenus -->
		<xsl:for-each select="menus">
			<xsl:call-template name="submenu">
				<xsl:with-param name="parent">menus</xsl:with-param>
				<xsl:with-param name="level">0</xsl:with-param>								
			</xsl:call-template>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="submenu">
		<xsl:param name="parent" />
		<xsl:param name="level" />		
		<xsl:variable name="name">
			<xsl:value-of select="$parent" />
			<xsl:value-of select="position()" />
		</xsl:variable>
		<DIV ID='submenu' CLASS='clsMenus'>					
			<xsl:attribute name='ID'>
				<xsl:value-of select="$name" />
			</xsl:attribute>			
			<xsl:for-each select="items">			
				<xsl:choose>					
					<xsl:when test="items"> <!-- submenu -->															
					<xsl:if test="position() &lt;= last()">																					
							<SPAN CLASS='cellOffs' ONMOUSEOUT="stateChanges('',this,'',event)">													
									<xsl:attribute name="ID"><xsl:value-of select="$name" />_span<xsl:value-of select="position()" /></xsl:attribute>
									<xsl:attribute name="Tag"><xsl:value-of select="position()" /></xsl:attribute>
									<xsl:attribute name="ONMOUSEOVER">stateChanges('<xsl:value-of select="$name" /><xsl:value-of select="position()" />',this, '<xsl:value-of select="$level+1" />',event);</xsl:attribute>
									<IMG ALIGN="right" VSPACE="2" HEIGHT="10" WIDTH="10" BORDER="0" SRC="/Images/rarrow.gif" NAME='arrow' />					
									<xsl:value-of select="name" />							
							</SPAN>
							<BR />
						</xsl:if>										
					</xsl:when>
					<xsl:otherwise> <!-- leaf -->
					<xsl:if test="position() &lt;= last()">																										
						<SPAN CLASS='cellOffs' onMouseOut="stateChanges('',this,'',event)">							
							<xsl:attribute name="Tag"><xsl:value-of select="position()" /></xsl:attribute>		
							<xsl:attribute name="ONMOUSEOVER">stateChanges('',this,'',<xsl:value-of select="position()" />,event);hideDivs(<xsl:value-of select="$level+1" />)</xsl:attribute>
							<xsl:attribute name="ID"><xsl:value-of select="$name" />_span<xsl:value-of select="position()" /></xsl:attribute>							
							<xsl:attribute name="ONCLICK">Selects('<xsl:value-of select="link" />','<xsl:value-of select="VisitedMenu" />','<xsl:value-of select="MId" />','<xsl:value-of select="name" />','<xsl:value-of select="AccessRights" />','<xsl:value-of select="menuname" />','<xsl:value-of select="MyMenu" />','<xsl:value-of select="HelpPath" />','<xsl:value-of select="ScrId"/>','<xsl:value-of select="MenuPath" />','<xsl:value-of select="ScreenType" />',event)</xsl:attribute>							
							<xsl:value-of select="name" />												
						</SPAN>											
						<BR />	
					</xsl:if>								
					</xsl:otherwise>
				</xsl:choose>				
			</xsl:for-each>
		</DIV>
		<!-- recurse submenus -->
		<xsl:for-each select="items">
			<xsl:if test="items">
				<xsl:call-template name="submenu">
					<xsl:with-param name="parent">
						<xsl:value-of select="$name" />
					</xsl:with-param>
					<xsl:with-param name="level">
						<xsl:value-of select="$level+1" />
					</xsl:with-param>					
				</xsl:call-template>
			</xsl:if>
		</xsl:for-each>		
	<link rel="stylesheet" type="text/css" href="/Styles/NewSubMenu.css"></link>
	<script language="javascript" src="/Scripts/NewSubMenu.js"></script>
	</xsl:template>		
</xsl:stylesheet>

  
  