<!--                                                                  -->
<!--  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="show.xsl" />
  <xsl:include href="search.xsl" />
  <xsl:include href="edit.xsl" />
	<xsl:include href="main.xsl" />
	<xsl:include href="list.xsl" />
	<xsl:include href="../shared_layouts/payors.xsl" />

  <xsl:template name="pickLayout">
    <xsl:choose>
      <xsl:when test="$cmd = 'edit'">
        <xsl:call-template name="payeeEditLayout" />
      </xsl:when>
      <xsl:when test="$cmd = 'show'">
        <xsl:call-template name="payeeViewLayout" />
      </xsl:when>
      <xsl:when test="$cmd = 'main'">
        <xsl:call-template name="payeeMainLayout" />
      </xsl:when>
			<xsl:when test="$cmd = 'list'">
				<xsl:call-template name="payeeListLayout" />
			</xsl:when>
      <xsl:when test="$cmd = 'account'">
        <xsl:call-template name="payorTransactionLayout" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="payeeSearchLayout" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

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

  <xsl:template name="cancelButton">
    <xsl:choose>
      <xsl:when test="$cmd = 'edit'">
        <xsl:if test="not(normalize-space(Form/ArtistPayee/ArtistPayeeID))">
          <input name="submitButton" id="addAnotherButton" type="submit" value="Create and Add Another" onClick="modifyFieldValue('ReturnTo','/rps/payee?c=edit&amp;msg=success|form_submit_success');" />
        </xsl:if>
        <xsl:if test="Params/ArtistPayeeID">
        <input type="button" value="Return to Payee" onClick="location.href='payee?ArtistPayeeID={Params/ArtistPayeeID}&amp;c=show'" />
        </xsl:if>
        <xsl:if test="not(Params/ArtistPayeeID)">
        <input type="button" value="Back to Payees" onClick="location.href='payee'" />
        </xsl:if>
      </xsl:when>
      <xsl:when test="$cmd = 'account'">
          <input type="button" value="Return to Payee" onClick="location.href='payee?ArtistPayeeID={Params/ArtistPayeeID}&amp;c=show'" />
      </xsl:when>
      <xsl:when test="$cmd = 'show'">
        <input type="button" name="Back" value="Back to Payees" onClick="location.href='/rps/payee'" />
      </xsl:when>
      <xsl:otherwise>
        <input type="button" name="Cancel" value="Cancel" onClick="hideInlinePop()" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>
