<!--                                                                  -->
<!--  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="masterSearchLayout">
    <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">masterSearch</xsl:with-param>
          <xsl:with-param name="area">master</xsl:with-param>
        </xsl:call-template>
      <xsl:call-template name="searchText" />
      <xsl:if test="count(Master) != 0">
        <xsl:if test="Params/_inline">
          <p>
            Selecting a master will cause a song to be automatically selected.
          </p>
        </xsl:if>
        <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="artistCol">Artist</th>
            <th class="isrcCol">ISRC</th>
            <th class="lengthCol">Length</th>
            <xsl:if test="count(Master) &gt; 9">
              <th class="scrollCol"></th>
            </xsl:if>
          </tr>
        </table>

        <div>
        <xsl:if test="count(Master) &gt; 9">
          <xsl:attribute name="class">scrollPop</xsl:attribute>
        </xsl:if>
        <table class="textChart textChartBottom">
          <xsl:for-each select="Master">
            <xsl:variable name="disabled">
              <xsl:if test="MasterID = /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="masterMatch" 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()" />['MasterID'] = '<xsl:value-of select="MasterID" />';
                  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()" />['ISRC'] = '<xsl:value-of select="ISRC" />';
                  match<xsl:value-of select="position()" />['DateRecorded'] = '<xsl:value-of select="DateRecorded" />';
                  match<xsl:value-of select="position()" />['ArtistName'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="ArtistName" /></xsl:call-template>';
                  match<xsl:value-of select="position()" />['ArtistID'] = '<xsl:value-of select="ArtistID" />';
                  match<xsl:value-of select="position()" />['Duration'] = '<xsl:value-of select="Duration" />';
                  match<xsl:value-of select="position()" />Song = new Object();
                  match<xsl:value-of select="position()" />Song['SongID'] = '<xsl:value-of select="Song/SongID" />';
                  match<xsl:value-of select="position()" />Song['Title'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="Song/Title" /></xsl:call-template>';
                  match<xsl:value-of select="position()" />Song['ISWC'] = '<xsl:value-of select="Song/ISRC" />';
                  match<xsl:value-of select="position()" />Song['ComposerName'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="Song/ComposerName" /></xsl:call-template>';
                  match<xsl:value-of select="position()" />Song['ComposerID'] = '<xsl:value-of select="Song/ComposerID" />';
                  match<xsl:value-of select="position()" />['Song'] = match<xsl:value-of select="position()" />Song;
                  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 left titleCol</xsl:if>
                  <xsl:if test="/Root/Params/_inline">left titleCol</xsl:if>
                </xsl:attribute>
                <xsl:value-of select="Title" />
              </td>
              <td class="artistCol"><xsl:value-of select="ArtistName" /></td>
              <td class="isrcCol"><xsl:value-of select="ISRC" /></td>
              <td class="lengthCol"><xsl:value-of select="Duration" /></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(Master) != 0 and Params/_inline">
      <xsl:call-template name="buttons" />
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>
