<?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="*"/>
	<xsl:include href="buttons.xsl"/>
	<!-- LAYOUT -->
	<xsl:template match="LAYOUT">
		<xsl:variable name="cID" select="@ID"/>

		<html>
		<head>
			<title><xsl:value-of select="@SITE-TITLE" disable-output-escaping="yes"/> - <xsl:value-of select="@TITLE" disable-output-escaping="yes"/></title>
			<xsl:apply-templates select="META-TAGS"/>
			<link href="css/styles.css" rel="stylesheet" type="text/css"/>
		</head>
        <body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0">

        <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" class="alltable">
        	<tr bgcolor="#ffffff">
        		<td width="55" height="119"><img src="images/spacer.gif" width="55" height="40" /></td>
        		<td colspan="4" style="padding-left:28px;">
        			<table cellpadding="0" cellspacing="0" border="0">
        				<tr>
        					<td style="padding-right:8px;"><a href="./"><img src="images/{LOGO/@NAME}" border="0" alt=""/></a></td>
				        	<td>
				        		<div class="mycompany"><xsl:value-of select="COMPANY-INFO/NAME" disable-output-escaping="yes"/></div>
				        		<div class="slogan"><xsl:value-of select="COMPANY-INFO/SLOGAN" disable-output-escaping="yes"/></div>
				        	</td>
        				</tr>
        			</table>
        		</td>
        		<td width="55"><img src="images/spacer.gif" width="55" height="40" /></td>
        	</tr>
       		<tr bgcolor="#ffffff">
        		<td height="181"></td>
       		  <td width="100%" style="background:#ffffff url(images/menu_gr_bg.gif) bottom right;">
        		<div style="width:277; height:0px;"><spacer/></div>
   			  <table cellpadding="0" cellspacing="0" border="0" width="181" height="100%" class="menu-bg">
                  <tr>
                    <td valign="top" align="right" style="padding:6px;"><!-- MENU -->
                        <!-- CALL MAIN-MENU-->
                        <xsl:call-template name="TOP-MENU"/>
                        <!-- END MENU -->
                    </td>
                  </tr>
                </table></td>
        		<td width="384" height="288" colspan="3" rowspan="3" align="right">
        			<img src="images/top.jpg" /></td>
        		<td></td>
        	</tr>
	        <tr bgcolor="#ffffff">
		        <td height="11"></td>
		        <td width="100%"></td>
		        <td></td>
	        </tr>
	        <tr>
		        <td height="96"></td>
		        <td width="100%" class="pageheader" style="padding:0px 20px 0px 43px; background:#c8c8c8 url(images/pageheader.gif) left center no-repeat;">
		        	<xsl:value-of select="@TITLE" disable-output-escaping="yes"/>
		        </td>
		        <td></td>
	        </tr>
	        <tr>
	        	<td height="100%"></td>
	        	<td width="100%" height="100%" colspan="4" valign="top"><table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="100%" height="100%" valign="top" bgcolor="#ffffff" class="thatext" style="padding:20px 40px 20px 12px;">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="100%" valign="top" class="thatext"><xsl:apply-templates select="PAGE-CONTENT"/></td>
</tr>
	        		</table>
					  
					  </td>
                      <td width="11" height="100%"><img src="images/spacer.gif" width="11" height="10" /></td>
                      <td width="181" valign="top" class="bottom-bg1"><table border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td><img src="images/spacer.gif" width="181" height="10" /></td>
                        </tr>
                        <tr>
                          <td valign="top" style="padding:5px 16px 5px 4px;">
				<!-- SUBMENU -->
		
		   				<!-- CALL SUB-MENU-->
		   				<xsl:call-template name="SUB-MENU">
		   					<xsl:with-param name="pageID" select="@ID"/>
		   				</xsl:call-template>
		
		    		<!-- END SUBMENU -->			
						  
						  </td>
                        </tr>
                      </table></td>
                    </tr>
                  </table>
				</td>
	        	<td></td>
	        </tr>
	        <tr>
		        <td height="10"></td>
		        <td colspan="4" height="10"><img src="images/spacer.gif" width="50" height="10" /></td>
		        <td></td>
	        </tr>
	        <tr>
		        <td height="27"><img src="images/spacer.gif" width="55" height="27" /></td>
		        <td colspan="4" class="bottom-bg" align="center" valign="top">
		    		<!-- BOTTOM MENU -->
		
			   			<!--CALL BOTTOM-MENU -->
		   				<xsl:call-template name="BOTTOM-MENU"/>
		
		    		<!-- END BOOTTOM MENU -->
		
		        </td>
		        <td></td>
	        </tr>
	        <tr>
		        <td height="40"><img src="images/spacer.gif" width="55" height="40" /></td>
		        <td colspan="4" class="copy" align="center">
		        	<xsl:value-of select="COPYRIGHT" disable-output-escaping="yes"/>
		        	<div style="width:661px; height:0px;"><spacer/></div>
		        </td>
		        <td width="55"></td>
	        </tr>
        </table>


        </body>
		</html>

	</xsl:template>

   				
	<!--TOP-MENU-->
   				
   				
	<xsl:template name="TOP-MENU">
		<xsl:apply-templates select="MENU" mode="top"/>			
	</xsl:template>
  
    					
	<xsl:template name="SUB-MENU">
		<xsl:param name="pageID"/>
		<xsl:choose>
			<xsl:when test="//MENU/MENU-ITEM[@ID = $pageID]/MENU-ITEM">
				<xsl:apply-templates select="//MENU/MENU-ITEM[@ID = $pageID]/MENU-ITEM" mode="sub"/>
			</xsl:when>
			<xsl:when test="//MENU/MENU-ITEM/MENU-ITEM[@ID = $pageID]">
				<xsl:variable name="parentID" select="//MENU/MENU-ITEM/MENU-ITEM[@ID = $pageID]/../@ID"/>
				<xsl:apply-templates select="//MENU/MENU-ITEM[@ID=$parentID]/MENU-ITEM" mode="sub"/>
			</xsl:when>
		<xsl:otherwise>
			<!-- no op -->
		</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

   				
	<xsl:template name="BOTTOM-MENU">
       	<table cellpadding="0" cellspacing="0" border="0" height="27">
       	<tr>
			<xsl:apply-templates select="MENU" mode="bottom"/>			
       	</tr>
       	</table>
	</xsl:template>


	<xsl:template match="MENU" mode="bottom">
		<xsl:apply-templates select="MENU-ITEM"  mode="bottom"/>
	</xsl:template>


	<xsl:template match="MENU-ITEM"  mode="bottom">
   		<xsl:choose>
           <!-- when vizited inside-->
           	<xsl:when test="MENU-ITEM[@ID=/LAYOUT/@ID]" >
            	<td class="bottommenuitemactive"><a href="{@HREF}"><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 class="bottommenuitemactive"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></td>
            </xsl:when>
            <xsl:otherwise>
            	<td class="bottommenuitem"><a href="{@HREF}"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="position()!=last()">
          	<td style="padding:0px 3px;"><img src="images/2nd_mark_light.gif" width="12" height="12" border="0" alt=""/></td>
        </xsl:if>
	</xsl:template>


	<!--META-TAGS-->
	<xsl:template match="META-TAGS">
		<xsl:apply-templates mode="meta-tags"/>
	</xsl:template>
	
	<xsl:template match="*" mode="meta-tags">
		<meta name="{local-name(.)}">
			<xsl:attribute name="content"><xsl:value-of select="."/></xsl:attribute>
		</meta>
	</xsl:template>
	<!--PAGE-CONTENT-->
	<xsl:template match="PAGE-CONTENT">
		<xsl:comment> EDITABLE CONTENT </xsl:comment>
		<xsl:apply-templates mode="meta-tags"/>
	</xsl:template>
	     	
</xsl:stylesheet>	
