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

    <xsl:template name="songSearchLayout">
        <xsl:call-template name="searchFormInline" />
    </xsl:template>

    <xsl:template name="searchResults">
        <div class="SongSearch">
            <h4>Search Results</h4>
            <xsl:call-template name="searchNoResult" />
            <xsl:call-template name="searchNav" >
                <xsl:with-param name="form">songSearch</xsl:with-param>
                <xsl:with-param name="area">song</xsl:with-param>
                <xsl:with-param name="withText">true</xsl:with-param>
            </xsl:call-template>

            <div class="SongSearch-table">

                <xsl:if test="count(Song) != 0">
                    <table class="Table">
                        <thead>
                            <tr class="Table-row Table-row-header">
                                <xsl:if test="Params/_inline">
                                    <th class="Table-col Table-col-select Table-col-select-wide">Select</th>
                                </xsl:if>
                                <th class="Table-col SongSearch-title-col">
                                    <xsl:if test="not(Params/_inline)">
                                        <xsl:attribute name="class">rowLeft</xsl:attribute>
                                    </xsl:if>
                                    Title
                                </th>
                                <th class="Table-col SongSearch-iswc-col">ISWC</th>
                                <th class="Table-col SongSearch-composer-col">Composer</th>
                            </tr>
                        </thead>
                    </table>

                    <div>
                        <xsl:if test="count(Song) &gt; 9">
                            <xsl:attribute name="class">Table-wrapper Table-wrapper-srolltop</xsl:attribute>
                        </xsl:if>
                        <table class="Table">
                            <tbody>
                                <xsl:for-each select="Song">
                                    <xsl:variable name="disabled">
                                        <xsl:if test="SongID = /Root/Params/Disable">1</xsl:if>
                                    </xsl:variable>
                                    <tr class="Table-row Table-row-data">
                                        <xsl:attribute name="class">
                                            <xsl:if test="$disabled = 1">Table-row-data Table-row-disabled</xsl:if>
                                        </xsl:attribute>
                                        <xsl:if test="/Root/Params/_inline">
                                            <td class="Table-col Table-col-select Table-col-select-wide">

                                                <xsl:call-template name="uiRadio">
                                                    <xsl:with-param name="disabled">
                                                        <xsl:if test="$disabled = 1">
                                                            <xsl:text>true</xsl:text>
                                                        </xsl:if>
                                                    </xsl:with-param>
                                                    <xsl:with-param name="name" select="'songMatch'"/>
                                                    <xsl:with-param name="onClick">
                                                        modifyField('selectMatch','enable');
                                                    </xsl:with-param>
                                                    <xsl:with-param name="value" select="position()"/>
                                                </xsl:call-template>

                                            </td>
                                            <script type="text/javascript">
                                                match<xsl:value-of select="position()" /> = new Object();
                                                match<xsl:value-of select="position()" />['SongID'] = '<xsl:value-of select="SongID" />';
                                                match<xsl:value-of select="position()" />['Title'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="Title" /></xsl:call-template>';
                                                match<xsl:value-of select="position()" />['ISWC'] = '<xsl:value-of select="ISWC" />' ;
                                                match<xsl:value-of select="position()" />['ComposerName'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="ComposerName" /></xsl:call-template>';
                                                match<xsl:value-of select="position()" />['ComposerID'] = '<xsl:value-of select="ComposerID" />';
                                                matchCollection['position<xsl:value-of select="position()" />'] = match<xsl:value-of select="position()" />;
                                            </script>
                                        </xsl:if>
                                        <td class="Table-col SongSearch-title-col">
                                            <xsl:value-of select="Title" />
                                        </td>
                                        <td class="Table-col SongSearch-iswc-col"><xsl:value-of select="ISWC" /></td>
                                        <td class="Table-col SongSearch-composer-col"><xsl:value-of select="ComposerName" /></td>
                                    </tr>
                                </xsl:for-each>
                            </tbody>
                        </table>
                        <xsl:if test="Params/_inline">
                            <script type="text/javascript">
                                window.matchCollection = matchCollection;
                            </script>
                        </xsl:if>
                    </div>
                </xsl:if>
            </div>
        </div>
        <xsl:if test="count(Song) != 0 and Params/_inline">
            <xsl:call-template name="buttons">
                <xsl:with-param name="type" select="'stick'" />
            </xsl:call-template>
        </xsl:if>
    </xsl:template>

</xsl:stylesheet>
