﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:import href="../Version_2_0/ModuleHeaders.xslt"/>
    <xsl:template match="/">
        <xsl:variable name="ItemID" select="normalize-space(AjaxRequest/Params/ItemID)" />
        <xsl:variable name="HostName" select="normalize-space(AjaxRequest/HostName)" />
        <xsl:variable name="TemplateURL" select="normalize-space(AjaxRequest/TemplateURL)" />
        <xsl:variable name="BrandKey" select="normalize-space(AjaxRequest/Brand/Detail/BrandKey)" />
        <xsl:variable name="BrandID" select="normalize-space(AjaxRequest/Brand/Detail/BrandID)" />
        <xsl:variable name="CommunityID" select="normalize-space(AjaxRequest/Brand/Detail/CommunityItemID)" />
        <xsl:variable name="PortalTypeID" select="normalize-space(AjaxRequest/Brand/Detail/PortalTypeID)" />
        <xsl:variable name="CommunityAdmin" select="AjaxRequest/UserRoles/Role[RoleName = 'Community Admin']"></xsl:variable>

        <table class="tableMaster" cellpadding="0" cellspacing="0">
            <tr>
                <td class="verticallyMiddle">
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'MyProfile']) &gt; 0">
                        <div>
                            <xsl:call-template name="moduleHeadersTemplate">
                                <xsl:with-param name="Header" select="AjaxRequest/Labels/Label[labelKey = 'MyProfile']/displayLabel"></xsl:with-param>
                                <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                            </xsl:call-template>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'AboutMe']) &gt; 0">
                        <xsl:choose>
                            <xsl:when test="AjaxRequest/Labels/Label[labelKey = 'AboutMe']/displayLabel = 'About Me'">
                                <div id="div_AboutMe" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                                     onmouseover="document.getElementById('div_AboutMe').className='moduleSubHeaderOptionHover';"
                                     onmouseout="document.getElementById('div_AboutMe').className='moduleSubHeaderOption';"
                                     onclick="portal_HighlightSelectedOption('{$ItemID}','div_AboutMe','#58595B');
                                              LoadCoachInfoWizard('LoadAboutCoach','{$BrandID}','divClientPortalOperations_Container','-99');">
                                    <span style="padding-left:20px;">
                                        <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'AboutMe']/displayLabel"></xsl:value-of>
                                    </span>
                                </div>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:choose>
                                    <xsl:when test="$PortalTypeID = 5 or $PortalTypeID = 6">
                                        <div id="div_AboutMe" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                                             onmouseover="document.getElementById('div_AboutMe').className='moduleSubHeaderOptionHover';"
                                             onmouseout="document.getElementById('div_AboutMe').className='moduleSubHeaderOption';"
                                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_AboutMe','#58595B');
                                                      LoadCoachInfoWizard('LoadAboutTournament','{$BrandID}','divClientPortalOperations_Container','-99');">
                                            <span style="padding-left:20px;">
                                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'AboutMe']/displayLabel"></xsl:value-of>
                                            </span>
                                        </div>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <div id="div_AboutMe" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                                             onmouseover="document.getElementById('div_AboutMe').className='moduleSubHeaderOptionHover';"
                                             onmouseout="document.getElementById('div_AboutMe').className='moduleSubHeaderOption';"
                                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_AboutMe','#58595B');
                                                      LoadCoachInfoWizard('LoadAboutBrand','{$BrandID}','divClientPortalOperations_Container','-99');">
                                            <span style="padding-left:20px;">
                                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'AboutMe']/displayLabel"></xsl:value-of>
                                            </span>
                                        </div>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </xsl:otherwise>
                        </xsl:choose>

                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'OurLocations']) &gt; 0">
                        <div id="div_OurLocations" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_OurLocations').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_OurLocations').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_OurLocations','#58595B');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'OurLocations']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'MyServices']) &gt; 0">
                        <div id="div_MyServices" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_MyServices').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_MyServices').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_MyServices','#58595B');
                                      LoadCoachInfoWizard('LoadMyServices','{$BrandID}','divClientPortalOperations_Container','-99');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'MyServices']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'MyPackages']) &gt; 0">
                        <div id="div_MyPackages" name="PortalMenuOption"  style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_MyPackages').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_MyPackages').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_MyPackages','#58595B');
                                      LoadCoachInfoWizard('LoadMyPackages','{$BrandID}','divClientPortalOperations_Container','-99');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'MyPackages']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'MyImage']) &gt; 0">
                        <div id="div_MyImage" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_MyImage').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_MyImage').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_MyImage','#58595B');
                                      LoadCoachInfoWizard('LoadMyImage','{$BrandID}','divClientPortalOperations_Container','-99');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'MyImage']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>
					<xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'Pages']) &gt; 0">
						<div id="div_Pages" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_Pages').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_Pages').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_Pages','#58595B');
                                      portal_LoadPages('{$ItemID}','{$BrandID}','divClientPortalOperations_Container');">
							<span style="padding-left:20px;">
								<xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'Pages']/displayLabel"></xsl:value-of>
							</span>
						</div>
					</xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'OpenProfilePage']) &gt; 0">
                        <div id="div_Profile" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_Profile').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_Profile').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_Profile','#58595B');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'OpenProfilePage']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'ViewMyprofile']) &gt; 0">
                        <div id="div_ViewProfile" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_ViewProfile').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_ViewProfile').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_ViewProfile','#58595B');">
                            <a href="http://{$HostName}/{$BrandKey}" class="moduleSubHeaderOption decorationNone paddingLeft20"
                               target="_blank">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'ViewMyprofile']/displayLabel"></xsl:value-of>
                            </a>
                        </div>
                    </xsl:if>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'OurAssociates']) &gt; 0">
                        <div>
                            <xsl:call-template name="moduleHeadersTemplate">
                                <xsl:with-param name="Header" select="AjaxRequest/Labels/Label[labelKey = 'OurAssociates']/displayLabel"></xsl:with-param>
                                <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                            </xsl:call-template>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'ManagePermissions']) &gt; 0">
                        <div id="div_Permission" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_Permission').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_Permission').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_Permission','#58595B');
                                      Dashboard_GoalShareIt('divClientPortalOperations_Container','{$ItemID}');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'ManagePermissions']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'ManagerRelationships']) &gt; 0">
                        <div id="divRelationships" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('divRelationships').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('divRelationships').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','divRelationships','#58595B');
                                      portal_LoadManagerRelationships('divClientPortalOperations_Container','{$ItemID}');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'ManagerRelationships']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'Media']) &gt; 0">
                        <div>
                            <xsl:call-template name="moduleHeadersTemplate">
                                <xsl:with-param name="Header" select="AjaxRequest/Labels/Label[labelKey = 'Media']/displayLabel"></xsl:with-param>
                                <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                            </xsl:call-template>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'WebPages']) &gt; 0">
                        <div id="div_WebPages" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_WebPages').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_WebPages').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_WebPages','#58595B');
                                      ClientPortal_LoadClinetCommunityData('Article','{$BrandID}','divClientPortalOperations_Container');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'WebPages']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>
                    <xsl:if test="count(AjaxRequest/Labels/Label[labelKey = 'Videos']) &gt; 0">
                        <div id="div_Videos" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_Videos').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_Videos').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_Videos','#58595B');
                                      ClientPortal_LoadClinetCommunityData('Video','{$BrandID}','divClientPortalOperations_Container');">
                            <span style="padding-left:20px;">
                                <xsl:value-of select="AjaxRequest/Labels/Label[labelKey = 'Videos']/displayLabel"></xsl:value-of>
                            </span>
                        </div>
                    </xsl:if>					
                </td>
            </tr>
            <tr>
                <td>
                    <div>
                        <xsl:call-template name="moduleHeadersTemplate">
                            <xsl:with-param name="Header">
                                <xsl:text>Communication</xsl:text>
                            </xsl:with-param>
                            <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                        </xsl:call-template>
                    </div>
                    <div>
                        <div id="div_Responses" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                             onmouseover="document.getElementById('div_Responses').className='moduleSubHeaderOptionHover';"
                             onmouseout="document.getElementById('div_Responses').className='moduleSubHeaderOption';"
                             onclick="portal_HighlightSelectedOption('{$ItemID}','div_Responses','#58595B');
                                      clientPortal_DisplaySavedResponsesList('{$ItemID}','divClientPortalOperations_Container');">
                            <span style="padding-left:20px;">
                                Saved Responses
                            </span>
                        </div>
                    </div>
                </td>
            </tr>
            <xsl:if test="$CommunityAdmin">
                <tr>
                    <td>
                        <div id="div_Surveys" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                                onmouseover="document.getElementById('div_Surveys').className='moduleSubHeaderOptionHover';"
                                onmouseout="document.getElementById('div_Surveys').className='moduleSubHeaderOption';"
                                onclick="portal_HighlightSelectedOption('{$ItemID}','div_Surveys','#58595B');
                                     portal_DisplaySurveys('{$ItemID}','divClientPortalOperations_Container'); ">
                            <span style="padding-left:20px;">
                                Worksheets
                            </span>
                        </div>
                    </td>
                </tr>
            </xsl:if>
            <xsl:choose>
                <xsl:when test="$PortalTypeID = 4">
                    <tr>
                        <td>
                            <div>
                                <xsl:call-template name="moduleHeadersTemplate">
                                    <xsl:with-param name="Header">
                                        <xsl:text>Metrics</xsl:text>
                                    </xsl:with-param>
                                    <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                                </xsl:call-template>
                            </div>
                            <div>
                                <div id="div_Metric" name="PortalMenuOption" style="padding-top:5px;padding-left:10px;padding-bottom:5px;" class="moduleSubHeaderOption"
                                     onmouseover="document.getElementById('div_Metric').className='moduleSubHeaderOptionHover';"
                                     onmouseout="document.getElementById('div_Metric').className='moduleSubHeaderOption';"
                                     onclick="portal_HighlightSelectedOption('{$ItemID}','div_Metric','#58595B');
                                              corporatePortal_LoadMetrics('{$ItemID}','divClientPortalOperations_Container');">
                                    <span style="padding-left:20px;">
                                        Metrics
                                    </span>
                                </div>
                            </div>

                        </td>
                    </tr>
                </xsl:when>
            </xsl:choose>
        </table>
    </xsl:template>
</xsl:stylesheet>