<!--                                                                  -->
<!--  Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:include href="/app/tools/common/production/templates/global.xsl" />

    <xsl:include href="/app/tools/bookpub/templates/variables.xsl" />
    <xsl:include href="/app/tools/bookpub/templates/navigation.xsl" />
    <xsl:include href="/app/tools/bookpub/templates/id_to_name.xsl" />
    <xsl:include href="/app/tools/bookpub/templates/messaging.xsl" />
    <xsl:include href="/app/tools/bookpub/templates/shared_templates.xsl" />
    <xsl:include href="/app/tools/common/production/templates/inline_pop.xsl" />
    <xsl:include href="/app/tools/common/production/templates/list_nav.xsl" />
    <xsl:include href="/app/tools/bookpub/templates/base_includes.xsl" />
    <xsl:include href="/app/tools/bookpub/templates/search.xsl" />

    <xsl:template name="body">
        <xsl:call-template name="bookpubBaseIncludes" />
        <xsl:choose>
            <xsl:when test="not(Params/_inline)">
                <xsl:call-template name="inlinePop" />
                <xsl:call-template name="header" />
                <xsl:choose>
                    <xsl:when test="$accessDenied = 1">
                        <xsl:call-template name="contentAccessDenied" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:call-template name="navigation" />
                        <xsl:call-template name="content" />
                    </xsl:otherwise>
                </xsl:choose>
                <xsl:call-template name="footer" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="inlinePopLayout" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="contentAccessDenied">
        <div class="Layout" id="content">
            <div class="Layout-wrapper">
                <xsl:call-template name="sectionHeader" />

                <div class="Layout-body">
                    <xsl:call-template name="accessDeniedLayout" />
                </div>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="content">
        <div class="Layout" id="content">
            <div class="Layout-wrapper">
                <xsl:call-template name="sectionHeader" />
                <div>
                    <xsl:choose>
                        <xsl:when test="($area = 'tracker') or ($area = 'analytics') or ($area = 'catalog') or ($area = 'user' and $cmd = 'search') or ($area = 'matcher') or ($area = 'artist_statement_settings') or ($area = 'dashboard')">
                            <xsl:attribute name="class">Layout-body-simple</xsl:attribute>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:attribute name="class">Layout-body</xsl:attribute>
                        </xsl:otherwise>
                    </xsl:choose>
                    <xsl:choose>
                        <xsl:when test="$accessDenied = 1">
                            <xsl:call-template name="accessDeniedLayout" />
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:call-template name="pickLayout" />
                        </xsl:otherwise>
                    </xsl:choose>
                </div>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="argsLink">
        <xsl:param name="skip" select="''" />
        <xsl:param name="skip2" select="''" />
        <xsl:param name="skip3" select="''" />
        <xsl:param name="skip4" select="''" />
        <xsl:param name="skip5" select="''" />
        <xsl:param name="skip6" select="''" />
        <xsl:param name="baseURL" select="''" />
        <xsl:attribute name="href">
            <xsl:value-of select="$baseURL" />
            <xsl:for-each select="/Root/Params/*">
                <xsl:if test="name() != $skip and name() != $skip2 and name() != $skip3 and name() != $skip4 and name() != $skip5 and name() != $skip6 and name() != 'p'">&amp;<xsl:value-of select="name()" />=<xsl:value-of select="current()" /></xsl:if>
            </xsl:for-each>
        </xsl:attribute>
    </xsl:template>

    <xsl:template name="argsHref">
        <xsl:param name="skip" select="''" />
        <xsl:param name="skip2" select="''" />
        <xsl:param name="skip3" select="''" />
        <xsl:param name="skip4" select="''" />
        <xsl:param name="skip5" select="''" />
        <xsl:param name="skip6" select="''" />
        <xsl:param name="baseURL" select="''" />
        <xsl:value-of select="$baseURL" />
        <xsl:for-each select="/Root/Params/*">
            <xsl:if test="name() != $skip and name() != $skip2 and name() != $skip3 and name() != $skip4 and name() != $skip5 and name() != $skip6 and name() != 'p'">&amp;<xsl:value-of select="name()" />=<xsl:value-of select="current()" /></xsl:if>
        </xsl:for-each>
    </xsl:template>

</xsl:stylesheet>
