<?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>
<!-- personal-001 -->
    <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" class="main-bg" style="width: 100%; height: 100%;" summary="">
	<TR>
		<TD height="195" valign="top" style="background-image: url('images/header_bg.gif'); background-repeat: repeat-x;">
			<table cellpadding="0" cellspacing="0" border="0" summary="" style="width: 100%; height: 100%; background-image: url('images/header.jpg'); background-position: top right; background-repeat: no-repeat;">
				<tr>
					<td height="108" valign="bottom" style="padding-left: 18px;">
					<!-- LOGO -->
						<table cellpadding="0" cellspacing="0" summary="">
							<tr>
								<td class="company" valign="bottom"><xsl:value-of select="COMPANY-INFO/NAME" disable-output-escaping="yes"/></td>
								<td rowspan="2"><a href="./"><img src="images/{LOGO/@NAME}" alt="" border="0" style="margin-left: 5px;"/></a></td>
							</tr>
							<tr><td class="slogan" valign="top"><xsl:value-of select="COMPANY-INFO/SLOGAN" disable-output-escaping="yes"/></td></tr>
						</table>
					<!-- END LOGO -->
					</td>
				</tr>
				<tr>
					<td height="100%">
						<div style="width: 550px;">
						<!-- MENU -->
							<table cellpadding="0" cellspacing="0" align="center" summary="">
								<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 -->
						</div>
					</td>
				</tr>
				 <tr><td height="20"></td></tr>
			</table>
		</TD>
	</TR>
	<TR>
		<TD height="100%" name="SB_stretch" valign="top">
			<table cellpadding="0" cellspacing="0" border="0" summary="" style="width: 100%; height: 100%;">
				<tr>
					<td valign="bottom" style="background-image: url('images/lbg_t.gif'); background-repeat: no-repeat;"><img src="images/lbg_b.gif" border="0" alt=""/></td>
					<td valign="top">
						<table cellpadding="0" cellspacing="0" border="0" summary="" style="width: 146px; background-image: url('images/submenu_bg.gif'); background-repeat: repeat-y;">
							<tr><td><img src="images/submenu_tbg.gif" border="0" alt=""/></td></tr>
							<tr>
								<td style="padding: 0 3px;">
									<!-- SUBMENU -->
									<table cellpadding="0" cellspacing="0" width="100%" align="center" summary="">
										<xsl:call-template name="SUB-MENU"><xsl:with-param name="pageID" select="@ID"/></xsl:call-template>
									</table>
									<!-- END SUBMENU -->
								</td>
							</tr>
							<tr><td height="30"></td></tr>
							<tr><td><img src="images/submenu_bbg.gif" border="0" alt=""/></td></tr>
						</table>
					</td>
					<td valign="top"><img src="images/mbg_t.gif" border="0" alt=""/></td>
					<td style="background-image: url('images/bg_lbg.gif'); background-repeat: repeat-y;">
						<table cellpadding="0" cellspacing="0" border="0" summary="" style="width: 100%; height: 100%;">
							<tr><td valign="top" style="background-image: url('images/bg_lb.gif'); background-position: bottom; background-repeat: no-repeat;"><img src="images/bg_lt.gif" border="0" alt=""/></td></tr>
						</table>
					</td>
					<td width="100%" class="bg">
						<table cellpadding="0" cellspacing="0" border="0" summary="" style="width: 100%; height: 100%; background-image: url('images/bg_t.gif'); background-repeat: repeat-x;">
							<tr>
								<td valign="top" class="pageContent" style="background-image: url('images/bg_b.gif'); background-position: bottom; background-repeat: repeat-x; padding: 20px 0;">
									<!-- CONTENT -->
									<div class="text-header"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></div>
									<div style="width:1px; height:15px;"><spacer type="block" width="1" height="15"/></div>
									<xsl:apply-templates select="PAGE-CONTENT"/>
									<!-- END CONTENT -->
								</td>
							</tr>
						</table>
					</td>
					<td style="background-image: url('images/bg_rbg.gif'); background-repeat: repeat-y;">
						<table cellpadding="0" cellspacing="0" border="0" summary="" style="width: 100%; height: 100%; background-image: url('images/bg_rt.gif'); background-repeat: no-repeat;">
							<tr><td valign="bottom"><img src="images/bg_rb.gif" border="0" alt=""/></td></tr>
						</table>
					</td>
					<td valign="bottom" style="background-image: url('images/rbg_t.gif'); background-repeat: no-repeat;"><img src="images/rbg_b.gif" border="0" alt=""/></td>
				</tr>
			</table>
		</TD>
	</TR>
	<TR>
		<TD height="191" style="background-image: url('images/footer_bg.gif'); background-position: bottom; background-repeat: repeat-x;">
			<table cellpadding="0" cellspacing="0" border="0" summary="" style="width: 100%; height: 100%; background-image: url('images/footer_r.jpg'); background-position: right; background-repeat: no-repeat;">
				<tr>
					<td valign="bottom" style="background-image: url('images/footer_l.gif'); background-position: left; background-repeat: no-repeat; padding-bottom: 25px;">
					<!-- BOTTOM MENU -->
						<table cellpadding="0" cellspacing="0" summary="">
							<tr>
								<td width="30"><div style="width:5px; height:1px;"><spacer type="block" width="5" height="1"/></div></td>
								<xsl:call-template name="BOTTOM-MENU"/>
								<td width="30"><div style="width:5px; height:1px;"><spacer type="block" width="5" height="1"/></div></td>

							</tr>
						</table>
					<!-- END BOOTTOM MENU -->
					</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 class="asubmenu submenu-abg" style="padding-left: 20px; height: 16px;"><xsl:value-of select="@TITLE" disable-output-escaping="yes"/></td>
			</tr>
		</xsl:when>
		<xsl:otherwise>
			<xsl:if test="../MENU-ITEM[@ID=/LAYOUT/@ID] or ../../MENU-ITEM[@ID=/LAYOUT/@ID]">
				<tr>
					<td style="padding-left: 20px; height: 16px;"><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="2"></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}"><img src="images/bmenu_bullet.gif" border="0" alt=""/></a></td>
				<td width="5"></td>
				<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}"><img src="images/bmenu_bullet.gif" border="0" alt=""/></a></td>
				<td width="5"></td>
				<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="30"><div style="width:5px; height:1px;"><spacer type="block" width="5" height="1"/></div></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>

