<?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="yes" encoding="utf-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<xsl:strip-space elements="*"/>
<xsl:include href="buttons.xsl"/>

<xsl:template match="LAYOUT">
	<xsl:variable name="cID" select="@ID"/>
	<HTML>
<!-- xec-03 -->
    <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 MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" RIGHTMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0">	
<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" bgcolor="White" style="width: 100%; height: 100%;">
	<TR>
		<TD height="43" style="background-image: url('images/tbg.gif'); background-repeat: no-repeat;">
		<!-- MENU -->
			<table cellpadding="0" cellspacing="0" border="0" align="right">
				<tr>
					<td width="30"><div style="width:5px; height:1px;"><spacer type="block" width="5" height="1"/></div></td>
					<xsl:call-template name="TOP-MENU"/>
					<td width="30"><div style="width:5px; height:1px;"><spacer type="block" width="5" height="1"/></div></td>
					
				</tr>
			</table>
		<!-- END MENU -->
		</TD>
	</TR>
	<TR>
		<TD height="121" valign="top" style="background-image: url('images/header.jpg'); background-position: right; background-repeat: no-repeat;">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" height="121" style="background-image: url('images/header_l.gif'); background-repeat: no-repeat;">
				<tr>
					<td valign="top" style="padding-left: 45px;">
						<!-- LOGO -->
						<table cellpadding="0" cellspacing="0">
							<tr>
								<td rowspan="2"><a href="./"><img src="images/{LOGO/@NAME}" border="0" style="margin-right: 5px;"/></a></td>
								<td class="company" valign="bottom"><xsl:value-of select="COMPANY-INFO/NAME" disable-output-escaping="yes"/></td>
							</tr>
							<tr><td class="slogan" align="right" valign="top"><xsl:value-of select="COMPANY-INFO/SLOGAN" disable-output-escaping="yes"/></td></tr>
						</table>
						<!-- END LOGO -->
					</td>
				</tr>
			</table>
		</TD>
	</TR>
	<TR>
		<TD height="100%" name="SB_stretch" valign="top" style="background-image: url('images/bg_b.gif'); background-position: bottom; background-repeat: repeat-x;">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" style="background-image: url('images/bg_r.gif'); background-position: right; background-repeat: repeat-y;">
				<tr>
					<td style="background-image: url('images/bg_l.gif'); background-position: left; background-repeat: repeat-y;">
						<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" style="background-image: url('images/bg_br.jpg'); background-position: bottom right; background-repeat: no-repeat;">
							<tr>
								<td style="background-image: url('images/header_b.jpg'); background-position: top right; background-repeat: no-repeat;">
									<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" style="background-image: url('images/bg_bl.jpg'); background-position: bottom left; background-repeat: no-repeat;">
										<tr>
											<td valign="top" style="background-image: url('images/bg_tl.jpg'); background-position: top left; background-repeat: no-repeat;">
												<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
													<tr valign="top">
														<td style="padding: 90px 80px 305px 80px;">
															<!-- SUBMENU -->
																<table cellpadding="0" cellspacing="0" border="0" width="100%">
																	<xsl:call-template name="SUB-MENU"><xsl:with-param name="pageID" select="@ID"/></xsl:call-template>
																</table>
															<!-- END SUBMENU -->
															<div style="width:150px; height:1px;"><spacer type="block" width="150" height="1"/></div>
														</td>
														<td width="100%" style="padding-right: 50px;">
															<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
																<tr>
																	<td height="105" class="text-header"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/><img src="images/txtheader_bg.gif" border="0" alt="" align="absmiddle" style="margin-left: 5px;"/></td>
																</tr>
																<tr><td height="18"></td></tr>
																<tr>
																	<td height="100%" valign="top" class="pageContent">
																		<!-- CONTENT -->
																		<xsl:apply-templates select="PAGE-CONTENT"/>
																		<!-- END CONTENT -->																		
																	</td>
																</tr>
																<tr><td height="45"></td></tr>
																<tr>
																	<td height="135" valign="top">		
																		<!-- BOTTOM MENU -->
																		<table cellpadding="0" cellspacing="0" align="right">
																			<tr>
																				<xsl:call-template name="BOTTOM-MENU"/>
																			</tr>
																		</table>		
																		<!-- END BOOTTOM MENU -->		
																		<div style="width:1px; height:10px;"><spacer type="block" width="1" height="10"/></div>
																		<br clear="all"/>
																		<!-- FOOTER -->
																		<div align="right" class="footer"><xsl:value-of select="COPYRIGHT" disable-output-escaping="yes"/></div>
																		<!-- END FOOTER -->														
																	</td>
																</tr>
															</table>
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</TD>
	</TR>
</TABLE>
	</BODY>

	</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="22" class="submenu-abg" style="padding: 3px 3px 3px 5px; background-image: url('images/submenu_abg.gif');"><span class="asubmenu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></span></td>
			</tr>
		</xsl:when>
		<xsl:otherwise>
			<xsl:if test="../MENU-ITEM[@ID=/LAYOUT/@ID] or ../../MENU-ITEM[@ID=/LAYOUT/@ID]">
			<tr>
				<td height="22" class="submenu-bg" style="padding: 3px 3px 3px 5px; background-image: url('images/submenu_bg.gif'); background-repeat: repeat-x;"><a href="{@HREF}" class="submenu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
			</tr>
			</xsl:if>
		</xsl:otherwise>
	</xsl:choose>
	<xsl:if test="position()!=last()">
		<tr><td height="6"></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] or @ID=/LAYOUT/@ID">
			<td><a href="{@HREF}" class="abmenu" id="abmenu"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
           </xsl:when>
           <!-- when active-->
           
           <xsl:otherwise>
 			<td><a href="{@HREF}" class="bmenu" id="bmenu{position()}"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></a></td>
           </xsl:otherwise>
       </xsl:choose>
  		<xsl:if test="position()!=last()">
			<td width="5"></td>
			<td class="bmenu">|</td>
			<td width="5"></td>
  		</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="." disable-output-escaping="yes"/></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>
