<?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"/>

<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>
<!--start-->
<body style="margin:0px;background-image: url('images/body_bg.gif');background-repeat: repeat;">
<center>
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="background-image: url('images/body_bg.gif');background-repeat: repeat;">
  <tr>
    <td height="210" valign="middle">
<table width="100%" height="210" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="250" align="right" style="padding-left:20px;padding-right:10px;">
<!-- LOGO -->
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center"><a href="./"><img src="images/{LOGO/@NAME}" border="0" alt=""/></a>
</td>
</tr>
<tr>
<td align="center" class="company"><xsl:value-of select="COMPANY-INFO/NAME" disable-output-escaping="yes"/>
</td>
</tr>
<tr>
<td align="center" valign="top" class="slogan"><xsl:value-of select="COMPANY-INFO/SLOGAN" disable-output-escaping="yes"/>
</td>
</tr>
</table>
<!-- END LOGO -->
<div style="height:1px;width:220px;"></div>
</td>
            <td align="center" ><img src="images/header.gif" width="513" height="168" /></td>
            <td align="center" ><div style="height:20px;width:20px;"></div></td>
          </tr>
        </table></td>
  </tr>
  <tr>
    <td><table width="100%" height="150" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="20"><div style="height:25px;width:20px;"></div></td>
        <td  width="100%" align="center" style="background-image: url('images/menu_bg.gif');background-repeat: repeat-x;">
		<!-- MENU -->
          <table cellpadding="0" cellspacing="0" align="center">
            <tr>
<xsl:call-template name="TOP-MENU"/>
            </tr>
          </table>
          <!-- END MENU -->
		  </td>
        <td width="20"><div style="height:25px;width:20px;"></div></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td width="100%" height="100%" valign="top">
	<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="20"><div style="height:25px;width:20px;"></div></td>
        <td width="100%" height="100%" align="center" valign="top" style="padding:20px 20px 20px 45px">
		<table border="0" align="right" cellpadding="0" cellspacing="0">
        <tr>
          <td align="left" class="text-header" style="padding-right:15px;"><img src="images/txtheader_bullet.gif"/></td>
          <td class="text-header"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/> </td>
        </tr>
      </table>
	  <div style="height:1px;clear:both"><span></span></div>
	          <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%" align="center">
          <tr>
            <td class="pageContent" name="SB_stretch" width="100%" height="100%" valign="top"><xsl:apply-templates select="PAGE-CONTENT"/> </td>
          </tr>
      </table>
		</td>
        <td width="225" align="center" valign="top" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center" style="background-image: url('images/submenu_bg.gif');background-repeat: repeat;"><div style="height:25px;width:px;"></div>
                <!-- SUBMENU -->
                <table cellpadding="0" cellspacing="0" width="150">
                  <xsl:call-template name="SUB-MENU"> <xsl:with-param name="pageID" select="@ID"/> </xsl:call-template>
                </table>
                <!-- END SUBMENU -->
                <div style="height:15px;width:px;"></div></td>
          </tr>
          <tr>
            <td align="center" style="background-image: url('images/footer_bg.gif');background-repeat: repeat;"><div style="height:15px;width:px;"></div>
                <table width="90%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="center" valign="top"><!-- FOOTER -->
                        <div align="center" class="copyright" style="padding-right:10px;"><xsl:value-of select="COPYRIGHT" disable-output-escaping="yes"/> </div>
                        <!-- END FOOTER -->
                        <div style="height:5px;width:px;"></div>
</td>
                  </tr>
                </table>
                <div style="height:15px;width:px;"></div></td>
          </tr>
          <tr>
            <td><img src="images/footer_botbg.gif" />
                <div style="height:25px;width:225px;"></div></td>
          </tr>
        </table></td>
        <td width="20"><div style="height:25px;width:20px;"></div></td>
      </tr>
    </table></td>
  </tr>
</table>
</center>
</body>
<!--end-->
</html>
</xsl:template>


<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:choose>
</xsl:template>
	
<xsl:template match="MENU-ITEM" mode="sub">
	<xsl:choose>
		<xsl:when test="@ID=/LAYOUT/@ID" >
<tr>
<td height="20" style="padding-left: 1px; align:left;">
<span class="menu"><span class="submenua"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></span></span>
</td>
<td height="15" style="padding-left: 1px; align:left;"><div style="height:px;width:5px;"></div></td>
<td width="30" height="15" align="center" class="submenu-bg" style="padding-left: 1px; align:left;">
<xsl:if test="position()&lt;10">0</xsl:if>
<xsl:value-of select="position()"/>
</td>
</tr>
		</xsl:when>
		<xsl:otherwise>
		<xsl:if test="../MENU-ITEM[@ID=/LAYOUT/@ID] or ../../MENU-ITEM[@ID=/LAYOUT/@ID]">
<tr>
<td height="20" style="padding-left: 1px; align:left;">
<span class="menu"><a href="{@HREF}" class="submenu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></span></td>
<td height="20" style="padding-left: 1px; align:left;"><div style="height:px;width:5px;"></div></td>
<td width="30" height="20" align="center" class="submenu" style="padding-left: 1px; align:left;">
<xsl:if test="position()&lt;10">0</xsl:if>
<xsl:value-of select="position()"/>
</td>
</tr>
		</xsl:if>
		</xsl:otherwise>
	</xsl:choose>
	<xsl:if test="position()!=last()">
<tr>
<td colspan="4" height="15"><div class="menu-hr" style="height:1px;"><span></span></div></td>
</tr>
	</xsl:if>
</xsl:template>	

<xsl:template name="BOTTOM-MENU">   		
	<xsl:apply-templates select="MENU" mode="bottom"/>			
</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]" >
<tr>
<td height="35" align="center"><a href="{@HREF}" class="bmenu" ><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
</tr>
	   </xsl:when>

           <!-- when active-->
           <xsl:when test="MENU-ITEM[@ID=/LAYOUT/@ID] or @ID=/LAYOUT/@ID" >
<tr>
<td height="35" align="center"><span class="bmenua" ><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></span></td>
</tr>
           </xsl:when>
           <xsl:otherwise>

<tr>
<td height="35" align="center"><a href="{@HREF}" class="bmenu" ><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
</tr>

	   </xsl:otherwise>
       </xsl:choose>
  		<xsl:if test="position()!=last()">
  		</xsl:if>
</xsl:template>
	
<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>


<xsl:template match="PAGE-CONTENT">
	<xsl:comment> EDITABLE CONTENT </xsl:comment>
	<xsl:apply-templates mode="meta-tags"/>
</xsl:template>
	     	
</xsl:stylesheet>
