<!--                                                                  -->
<!--  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:output method="html" indent="no" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML 4.01//EN" encoding="utf-8" />

  <xsl:include href="/app/tools/rps/templates/global.xsl" />
  <xsl:include href="edit.xsl" />
  <xsl:include href="show.xsl" />
  <xsl:include href="search.xsl" />

  <xsl:template name="pickLayout">
    <xsl:choose>
      <xsl:when test="$cmd = 'edit'">
        <xsl:call-template name="songEditLayout" />
      </xsl:when>
      <xsl:when test="$cmd = 'show'">
        <xsl:call-template name="songViewLayout" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="songSearchLayout" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="submitButton">
    <xsl:choose>
      <xsl:when test="$cmd = 'edit'">
        <input name="submit" type="submit" id="popSubmitButton">
          <xsl:attribute name="value">
            <xsl:if test="normalize-space(Form/Song/SongID)">Update</xsl:if>
            <xsl:if test="not(normalize-space(Form/Song/SongID))">Create</xsl:if>
          </xsl:attribute>
        </input>
      </xsl:when>
      <xsl:when test="$cmd = 'show'">
        <input type="button" value="Edit" onClick="javascript:location.href='song?SongID={Form/Song/SongID}&amp;c=edit'" />
      </xsl:when>
      <xsl:otherwise>
        <input type="button" name="selectMatch" id="selectMatch" value="Use this {$area}" disabled="true" onClick="modifyField('selectMatch','disable'); useMatch('{$area}')" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="cancelButton">
    <xsl:choose>
      <xsl:when test="$cmd = 'edit'">
        <input type="button" value="Cancel">
          <xsl:attribute name="onClick">
            <xsl:choose>
              <xsl:when test="Params/_inline">hideInlinePop()</xsl:when>
              <xsl:otherwise>javascript:history.go(-1)</xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>
        </input>
      </xsl:when>
      <xsl:when test="$cmd = 'show'">
        <input type="button" name="Delete" value="Delete" onClick="alert('This doesn\'t work yet')" />
      </xsl:when>
      <xsl:otherwise>
        <input type="button" name="Cancel" value="Cancel" onClick="hideInlinePop()" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>

