<!--                                                                  -->
<!--  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="trackPresubmitLayout">
    <xsl:choose>
      <xsl:when test="DuplicateMasters">
        <script type="text/javascript">
          match = new Object();
          match['MasterID'] = '<xsl:value-of select="DuplicateMasters/MasterID" />';
          match['Title'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="DuplicateMasters/Title" /></xsl:call-template>';
          match['ISRC'] = '<xsl:value-of select="DuplicateMasters/ISRC" />';
          match['DateRecorded'] = '<xsl:value-of select="DuplicateMasters/DateRecorded" />';
          match['ArtistName'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="DuplicateMasters/ArtistName" /></xsl:call-template>';
          match['ArtistID'] = '<xsl:value-of select="DuplicateMasters/ArtistID" />';
          match['Duration'] = '<xsl:value-of select="DuplicateMasters/Duration" />';
          matchSong = new Object();
          matchSong['SongID'] = '<xsl:value-of select="DuplicateMasters/Song/SongID" />';
          matchSong['Title'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="DuplicateMasters/Song/Title" /></xsl:call-template>';
          matchSong['ISWC'] = '<xsl:value-of select="DuplicateMasters/Song/ISRC" />';
          matchSong['ComposerName'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="DuplicateMasters/Song/ComposerName" /></xsl:call-template>';
          matchSong['ComposerID'] = '<xsl:value-of select="DuplicateMasters/Song/ComposerID" />';
          match['Song'] = matchSong;
        </script>
        <form>
          <div class="section">
            <p>
              An existing master was found that closely matched what you entered.  You can associate this track with the existing master or proceed with creating a new master.
            </p>
          </div>
          <div class="section">
            <table class="buttons">
              <tr>
                <td>
                  <input type="button" value="Use Existing" onClick="presubmitTrackExisting('master')" />
                </td>
                <td>
                  <input type="button" value="Create New" onClick="presubmitTrackNew()" />
                </td>
              </tr>  
            </table>
          </div>
        </form>
      </xsl:when>
      <xsl:when test="DuplicateSongs">
        <script type="text/javascript">
          match = new Object();
          match['SongID'] = '<xsl:value-of select="DuplicateSongs/SongID" />';
          match['Title'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="DuplicateSongs/Title" /></xsl:call-template>';
          match['ISWC'] = '<xsl:value-of select="DuplicateSongs/ISWC" />' ;
          match['ComposerName'] = '<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="DuplicateSongs/ComposerName" /></xsl:call-template>';
          match['ComposerID'] = '<xsl:value-of select="DuplicateSongs/ComposerID" />';
        </script>
        <form>
          <div class="section">
            <p>
              An existing song was found that closely matched what you entered.  You can associate this track with the existing song or proceed with creating a new song.
            </p>
          </div>
          <div class="section">
            <p>
              <input type="button" name="Existing" value="Use Existing" onClick="presubmitTrackExisting('song')" /><xsl:text> </xsl:text><input type="button" name="New" value="Create New" onClick="presubmitTrackNew()" />
            </p>
          </div>
        </form>
      </xsl:when>
      <xsl:otherwise>noInlinePop</xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>

