<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="yes" encoding="iso-8859-1"/>

<xsl:template match="navigation">
<![CDATA[
menunum=0;menus=new Array();_d=document;function addmenu(){menunum++;menus[menunum]=menu;}function dumpmenus(){mt="<script language=javascript>";for(a=1;a<menus.length;a++){mt+=" menu"+a+"=menus["+a+"];"}mt+="<\/script>";_d.write(mt)}
effect = "Fade(duration=0);Alpha(style=0,opacity=100);Shadow(color='#999999', Direction=135, Strength=0)" 
timegap=500      // The time delay for menus to remain visible
followspeed=5    // Follow Scrolling speed
followrate=40   // Follow Scrolling Rate
suboffset_top=0;  // Sub menu offset Top position 
suboffset_left=0;  // Sub menu offset Left position
//font_meas = "px"
style1=[    
"5E5E5E",    // Mouse Off Font Color
"DCDCDC",    // Mouse Off Background Color
"ffffff",    // Mouse On Font Color
"999999",    // Mouse On Background Color
"DCDCDC ",    // Menu Border Color 
"11px",     // Font Size (default is px but you can specify mm, pt or a percentage)
"normal",    // Font Style (italic or normal)
"normal",    // Font Weight (bold or normal)
"Verdana, Geneva, Arial, Helvetica, sans-serif",  // Font Name
2,      // Menu Item Padding
"bilder/pfeil_rot.gif",  // Sub Menu Image (Leave this blank if not needed)
,      // 3D Border & Separator bar
"66ffff",    // 3D High Color
"000099",    // 3D Low Color
"",      // Current Page Item Font Color (leave this blank to disable)
"",      // Current Page Item Background Color (leave this blank to disable)
"",      // Top Bar image (Leave this blank to disable)
"ffffff",    // Menu Header Font Color (Leave blank if headers are not needed)
"E2EFFB",    // Menu Header Background Color (Leave blank if headers are not needed)
]
addmenu(menu=[  // This is the array that contains your menu properties and details
"mainmenu",   // Menu Name - This is needed in order for the menu to be called
138,    // Menu Top - The Top position of the menu in pixels
,     // Menu Left - The Left position of the menu in pixels
,     // Menu Width - Menus width in pixels
,     // Menu Border Width 
,     // Screen Position - here you can use "center;left;right;middle;top;bottom" or a combination of "center:middle"
style1,    // Properties Array - this is set higher up, as above
,     // Always Visible - allows the menu item to be visible at all time (1=on/0=off)
"left",    // Alignment - sets the menu elements text alignment, values valid here are: left, right or center
effect,    // Filter - Text variable for setting transitional effects on menu activation - see above for more info
,     // Follow Scrolling - Tells the menu item to follow the user down the screen (visible at all times) (1=on/0=off)
1,      // Horizontal Menu - Tells the menu to become horizontal instead of top to bottom style (1=on/0=off)
,     // Keep Alive - Keeps the menu visible until the user moves over another menu or clicks elsewhere on the page (1=on/0=off)
,     // Position of TOP sub image left:center:right
,     // ..Now Obsolete..
,     // Right To Left - Used in Hebrew for example. (1=on/0=off)
,     // Open the Menus OnClick - leave blank for OnMouseover (1=on/0=off)
,     // ID of the div you want to hide on MouseOver (useful for hiding form elements)
,     // Reserved for future use
,     // Reserved for future use
,     // Reserved for future use
])

]]>

<xsl:apply-templates select="//menupunkt"/>
<![CDATA[ dumpmenus() ]]>
</xsl:template>
<xsl:template match="menupunkt">
<xsl:variable name="href1"><xsl:apply-templates select="ebene1/a/@href"/></xsl:variable>
<xsl:variable name="ebene1">
<xsl:choose>
 <xsl:when test="contains(ebene1/a, ' ')"><xsl:value-of select="substring-before(ebene1/a, ' ')"/></xsl:when>
 <xsl:otherwise><xsl:value-of select="ebene1/a"/></xsl:otherwise>
 
</xsl:choose>

</xsl:variable>

<!-- <xsl:if test="ebene1 != ''"> -->
 <![CDATA[ addmenu(menu=["]]><xsl:value-of select="substring(normalize-space($ebene1), 2)"/><![CDATA[",,,128,2,"",style1,,"left",effect,,,,,,,,,,,,]]>
<!-- </xsl:if> -->
<xsl:for-each select="ebene2">
 
 <xsl:variable name="href2"><xsl:apply-templates select="a/@href"/></xsl:variable>
 <xsl:variable name="linkname"><xsl:apply-templates select="a"/></xsl:variable>
  
 <xsl:if test=". != ''">
  ,"<xsl:value-of select="normalize-space($linkname)"/><![CDATA[","]]><xsl:value-of select="normalize-space($href2)"/><![CDATA[",,,0]]>
 </xsl:if>
 
</xsl:for-each>
<!-- xsl:if test="ebene1 != ''"><![CDATA[])]]></xsl:if> -->
<![CDATA[])]]>
</xsl:template>

</xsl:stylesheet>
