<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:template name="uiClientLogo">

        <xsl:variable name="clientName">
            <xsl:choose>
                <!-- the same logo for bkpub and dtmvtest -->
                <xsl:when test="User/ClientNameClean = 'bkpub' or User/ClientNameClean = 'dtmvtest'">
                    <xsl:text>bkpub</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="User/ClientNameClean" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="clientCleanFileName">
            <xsl:value-of select="$clientName" />
            <xsl:text>.</xsl:text>
            <xsl:text>gif</xsl:text>
        </xsl:variable>

        <xsl:variable name="clientCleanFileNamePNG">
            <xsl:value-of select="$clientName" />
            <xsl:text>.</xsl:text>
            <xsl:text>png</xsl:text>
        </xsl:variable>

        <xsl:variable name="logoSrc">
            <xsl:choose>
                <xsl:when test="User/ClientName = 'Demo Client'">
                    <xsl:text>/production/images/logos/</xsl:text>
                    <xsl:choose>
                        <xsl:when test="Params/label = 1 or User/LabelID = 1">
                            <xsl:text>elektra.gif</xsl:text>
                        </xsl:when>
                        <xsl:when test="Params/label = 2 or User/LabelID = 2">
                            <xsl:text>epitaph.gif</xsl:text>
                        </xsl:when>
                        <xsl:when test="Params/label = 3 or User/LabelID = 3">
                            <xsl:text>subpop.gif</xsl:text>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="$clientCleanFileName" />
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:when>
                <xsl:when test="Client/MainPage = '/rps/main'">
                    <xsl:if test="normalize-space(Form/LogoSourceWeb)">
                        <xsl:value-of select="Form/LogoSourceWeb" />?v=<xsl:value-of select="/Root/Session" />
                    </xsl:if>
                </xsl:when>
                <xsl:when test="User/ClientID = 346">
                    <xsl:text>/production/images/logos/</xsl:text><xsl:value-of select="$clientCleanFileNamePNG" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>/production/images/logos/</xsl:text><xsl:value-of select="$clientCleanFileName" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:if test="normalize-space($logoSrc)">
            <img
                class="ClientLogo LoadableImage js-tooltip"
                title="{User/ClientNameClean}"
                alt="{User/ClientName}"
                src="{$logoSrc}"
            />
        </xsl:if>
    </xsl:template>

</xsl:stylesheet>
