<!--                                                                  -->
<!--  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="payeeSearchLayout">
        <xsl:choose>
            <xsl:when test="Params/_inline">
                <xsl:call-template name="searchFormInline" />
            </xsl:when>
            <xsl:otherwise>
                <xsl:call-template name="searchResultsFull" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template name="resultsHeader">
        <table class="textChart" id="resultsHeader">
            <tr class="textChartTop">
                <th class="selectCol">Select</th>
                <th class="payeeNameCol">Name</th>
                <th class="clientAccountCol">Client Account #</th>
                <xsl:if test="count(ArtistPayee) &gt; 9">
                    <th class="scrollCol"></th>
                </xsl:if>
            </tr>
        </table>
    </xsl:template>

    <xsl:template name="searchResults">
        <div class="section" id="payeeSearchInline">
            <xsl:if test="not(Params/Query) and count(ArtistPayee) = 0">
                <p>No payees have been created.</p>
            </xsl:if>
            <h2>Search Results</h2>
            <xsl:call-template name="searchText" />
            <xsl:if test="count(ArtistPayee) != 0">
                <xsl:call-template name="resultsHeader" />
                <div>
                    <xsl:if test="count(ArtistPayee) &gt; 9">
                        <xsl:attribute name="class">scrollPop</xsl:attribute>
                    </xsl:if>
                    <table class="textChart textChartBottom textChartResults">
                        <xsl:for-each select="ArtistPayee">
                            <tr class="row{position() mod 2}">
                                <td class="selectCol">
                                    <input type="radio" name="payeeMatch" value="{position()}" 		onClick="modifyField('selectMatch','enable');" />
                                </td>
                                <script type="text/javascript">
                                    match<xsl:value-of select="position()" /> = new Object();
                                    match<xsl:value-of select="position()" />['ArtistPayeeID'] = '<xsl:value-of select="ArtistPayeeID" />';
                                    match<xsl:value-of select="position()" />['Name'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="Name" /></xsl:call-template>';
                                    matchCollection['position<xsl:value-of select="position()" />'] = match<xsl:value-of select="position()" />;
                                </script>
                                <td class="payeeNameCol"><xsl:value-of select="Name" /></td>
                                <td class="clientAccountCol"><xsl:value-of select="ClientAccountID" /></td>
                            </tr>
                        </xsl:for-each>
                    </table>
                </div>
                <script type="text/javascript">
                    window.matchCollection = matchCollection;
                </script>
            </xsl:if>
        </div>
        <xsl:if test="count(ArtistPayee) != 0">
            <xsl:call-template name="buttons" />
        </xsl:if>
    </xsl:template>

    <xsl:template name="searchResultsFull">
        <div class="section">
            <xsl:choose>
                <xsl:when test="not(Params/Query) and count(ArtistPayee) = 0">
                    <p>No payees have been created.</p>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:if test="Params/Query">
                        <h2>Search Results</h2>
                    </xsl:if>
                    <xsl:call-template name="searchNav" />
                    <xsl:call-template name="searchText" />
                    <xsl:if test="count(ArtistPayee) != 0">
                        <table class="textChart hiOn">
                            <tr>
                                <th class="rowLeft">Name</th>
                                <th>Client Account #</th>
                                <th class="editCol">Edit</th>
                            </tr>
                            <xsl:for-each select="ArtistPayee">
                                <tr class="row{position() mod 2}">
                                    <td class="rowLeft">
                                        <a href="payee?ArtistPayeeID={ArtistPayeeID}&amp;c=show"><xsl:value-of select="Name" /></a>
                                    </td>
                                    <td>
                                        <xsl:value-of select="ClientAccountID" />
                                    </td>
                                    <td class="icon">
                                        <a href="payee?c=edit&amp;ArtistPayeeID={ArtistPayeeID}" title="Edit">
                                            <img src="/production/images/icons/office/Edit-(16x16).gif" />
                                        </a>
                                    </td>
                                </tr>
                            </xsl:for-each>
                        </table>
                    </xsl:if>
                    <xsl:call-template name="searchNav" />
                    <xsl:if test="normalize-space(Pagination/Previous) or normalize-space(Pagination/Next)">
                        <br class="superBreak" />
                        <br />
                    </xsl:if>
                </xsl:otherwise>
            </xsl:choose>
        </div>
    </xsl:template>

</xsl:stylesheet>

