<!--                                                                  -->
<!--  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="section">
      <h2>Search Results</h2>
      <xsl:call-template name="searchNav" >
        <xsl:with-param name="form">songSearch</xsl:with-param>
        <xsl:with-param name="area">song</xsl:with-param>
      </xsl:call-template>
      <xsl:call-template name="searchText" />
      <xsl:if test="count(Song) != 0">
        <table class="textChart">
          <tr class="textChartTop">
            <xsl:if test="Params/_inline">
              <th class="rowLeft selectCol">Select</th>
            </xsl:if>
            <th class="titleCol">
              <xsl:if test="not(Params/_inline)">
                <xsl:attribute name="class">rowLeft</xsl:attribute>
              </xsl:if>
              Title
            </th>
            <th class="iswcCol">ISWC</th>
            <th class="composerCol">Composer</th>
            <xsl:if test="count(Song) &gt; 9">
              <th class="scrollCol"></th>
            </xsl:if>
          </tr>
        </table>

        <div>
        <xsl:if test="count(Song) &gt; 9">
          <xsl:attribute name="class">scrollPop</xsl:attribute>
        </xsl:if>
        <table class="textChart textChartBottom">
          <xsl:for-each select="Song">
            <xsl:variable name="disabled">
              <xsl:if test="SongID = /Root/Params/Disable">1</xsl:if>
            </xsl:variable>
            <tr>
              <xsl:attribute name="class">
                row<xsl:value-of select="position() mod 2" /><xsl:if test="position() = 1"> firstRow</xsl:if><xsl:if test="$disabled = 1"> disabledRow</xsl:if>
              </xsl:attribute>
              <xsl:if test="/Root/Params/_inline">
                <td class="rowLeft selectCol">
                  <input type="radio" name="songMatch" value="{position()}" onClick="modifyField('selectMatch','enable');">
                    <xsl:if test="$disabled = 1">
                      <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                  </input>
                </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>
                <xsl:attribute name="class">
                  <xsl:if test="not(/Root/Params/_inline)">rowLeft titleCol</xsl:if>
                  <xsl:if test="/Root/Params/_inline">titleCol</xsl:if>
                </xsl:attribute>
                <xsl:value-of select="Title" />
              </td>
              <td class="iswcCol"><xsl:value-of select="ISWC" /></td>
              <td class="composerCol"><xsl:value-of select="ComposerName" /></td>
            </tr>
          </xsl:for-each>
        </table>
        <xsl:if test="Params/_inline">
          <script type="text/javascript">
            window.matchCollection = matchCollection;
          </script>
        </xsl:if>
        </div>
      </xsl:if>
    </div>
    <xsl:if test="count(Song) != 0 and Params/_inline">
      <xsl:call-template name="buttons" />
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>
