﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:variable name="HostName" select="normalize-space(AjaxRequest/HostName)"></xsl:variable>
		<xsl:variable name="TemplateURL" select="normalize-space(AjaxRequest/TemplateURL)"></xsl:variable>
		<xsl:variable name="Authenticated" select="normalize-space(AjaxRequest/Authenticated)"></xsl:variable>
		<xsl:variable name="SeletecTab" select="normalize-space(AjaxRequest/Params/SelectedLink)"></xsl:variable>

		<xsl:variable name="SelectedLink">
			<xsl:choose>
				<xsl:when test="$SeletecTab = ''">
					<xsl:text>goals</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$SeletecTab"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<table id="divWorkingAreaHeader_ActionLink" height="100%" cellspacing="0" cellpadding="0" class="tableMaster smallerFont">
			<tr>
				<xsl:variable name="count" select="7"/>

				<xsl:for-each select="(//*)[position() &lt;= $count]">

					<xsl:variable name="TabName">
						<xsl:choose>
							<xsl:when test="position()=1">
								<xsl:text>home</xsl:text>
							</xsl:when>
							<xsl:when test="position()=2">
								<xsl:text>goals</xsl:text>
							</xsl:when>
							<xsl:when test="position()=3">
								<xsl:text>about</xsl:text>
							</xsl:when>
							<xsl:when test="position()=4">
								<xsl:text>videos</xsl:text>
							</xsl:when>
							<xsl:when test="position()=5">
								<xsl:text>app</xsl:text>
							</xsl:when>
							<xsl:when test="position()=6">
								<xsl:text>store</xsl:text>
							</xsl:when>
							<xsl:when test="position()=7">
								<xsl:text>contact</xsl:text>
							</xsl:when>
						</xsl:choose>
					</xsl:variable>

					<xsl:variable name="DisplayName">
						<xsl:choose>
							<xsl:when test="position()=1">
								<xsl:text>home</xsl:text>
							</xsl:when>
							<xsl:when test="position()=2">
								<xsl:text>goals</xsl:text>
							</xsl:when>
							<xsl:when test="position()=3">
								<xsl:text>about</xsl:text>
							</xsl:when>
							<xsl:when test="position()=4">
								<xsl:text>videos</xsl:text>
							</xsl:when>
							<xsl:when test="position()=5">
								<xsl:text>our app</xsl:text>
							</xsl:when>
							<xsl:when test="position()=6">
								<xsl:text>store</xsl:text>
							</xsl:when>
							<xsl:when test="position()=7">
								<xsl:text>contact</xsl:text>
							</xsl:when>
						</xsl:choose>
					</xsl:variable>

					<xsl:variable name="tabClass">
						<xsl:choose>
							<xsl:when test="$TabName = $SelectedLink">
								<xsl:text>selectedTopHeaderText</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>defaultTopHeaderText</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>

					<xsl:variable name="tabLink">
						<xsl:choose>
							<xsl:when test="$TabName != 'goals' and $TabName != 'Goals'">
								<xsl:text>http://www.thesecretofhappiness.com/</xsl:text>
								<xsl:value-of select="$TabName"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>http://</xsl:text>
								<xsl:value-of select="$HostName"/>
								<xsl:text>/</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>

					<td id="imgTab_{position()}" nowrap="nowrap" class="verticallyMiddle textCenter">
						<a href="{$tabLink}" class="decorationNone paddingLeft15 paddingRight15 onMouseOver" style="display:block;">
							<div class="{$tabClass}">
								<xsl:value-of select="$DisplayName"/>
							</div>
						</a>
					</td>
				</xsl:for-each>

			
			</tr>
		</table>
	</xsl:template>
</xsl:stylesheet>
