<!--                                                                  -->
<!--  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="contractListLayout">
        <div class="section">
            <xsl:if test="count(PayorList/Payor) &gt; 1">
                <xsl:call-template name="payorSelectForm" />
            </xsl:if>
            <xsl:call-template name="listNav" />
            <xsl:choose>
                <xsl:when test="count(DistributorContract) = 0">
                    <p>No contracts are available under this heading.</p>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:call-template name="contractTable">
                        <xsl:with-param name="contract" select="DistributorContract" />
                    </xsl:call-template>
                    <xsl:call-template name="listNav" />
                </xsl:otherwise>
            </xsl:choose>
        </div>
    </xsl:template>

    <xsl:template name="payorSelectForm">
        <div class="listSelect">
            <form action="/rps/distributor_contract" method="get">
                <input type="hidden" name="page" value="{Params/page}" />
                <input type="hidden" name="c" value="list" />
                Now Viewing:
                <select name="payor">
                    <option value="">All Payors</option>
                    <xsl:for-each select="PayorList/Payor">
                        <option value="{PayorID}">
                            <xsl:if test="PayorID = /Root/Params/payor">
                                <xsl:attribute name="selected">selected</xsl:attribute>
                            </xsl:if>
                            <xsl:value-of select="Name" />
                        </option>
                    </xsl:for-each>
                </select>
                <input type="submit" name="go" value="Go" />
            </form>
        </div>
    </xsl:template>

</xsl:stylesheet>
