<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--                                                                  -->
<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="shared.xsl" />
    <xsl:include href="/app/tools/common/production/templates/list_nav.xsl" />


    <xsl:template name="pickLayout">

        <link href="/production/css/rps/paginated_statements.css?v=1" rel="stylesheet" type="text/css" />        
    
        <xsl:call-template name="helpLink" />
        
        <br />
        
        <xsl:if test="Statement/Pagination/NumPages &gt; 1">
            <xsl:call-template name="numericListNav">
                <xsl:with-param name="pagination">/Root/Statement/Pagination</xsl:with-param>
                <xsl:with-param name="extraParams">&amp;MechanicalStatementID=<xsl:value-of select="/Root/Params/MechanicalStatementID" /></xsl:with-param>
            </xsl:call-template>
        </xsl:if>
          
        <xsl:for-each select="Statement/Table">       
            <xsl:call-template name="statementTable" />    
        </xsl:for-each>             

        <br />

        <input type="button" name="Back" value="Back to Statements" onClick="location.href='mechanical?MechanicalRunID={Run/MechanicalRunID}&amp;c=show&amp;PayorID={Run/PayorID}'" />
        
        <br /><br />

    </xsl:template>
    

    <xsl:template name="statementTable">
        <table class="{Class}">
            <xsl:for-each select="Row">
                <tr class="{Class}">
                    <xsl:for-each select="Cell">
                        <xsl:call-template name="statementCell">
                            <xsl:with-param name="cell" select="." />
                        </xsl:call-template>
                    </xsl:for-each>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>    
    
    
    <xsl:template name="statementCell">
        <xsl:param name="cell" />
        <td class="{$cell/Class}">
            <xsl:choose>
                <xsl:when test="$cell/Class = 'SUBTOTAL_ROW'">
                    <xsl:attribute name="colspan">20</xsl:attribute>
                </xsl:when>
                <xsl:when test="$cell/Class = 'PUBLISHER_ROW'">
                    <xsl:attribute name="colspan">20</xsl:attribute>
                </xsl:when>                
                <xsl:when test="$cell/Class = 'BLANK_ROW'">
                    <xsl:attribute name="colspan">21</xsl:attribute>
                </xsl:when>                
            </xsl:choose>
            <xsl:choose>
                <xsl:when test="normalize-space($cell/LinkValue) or normalize-space($cell/TitleValue)">
                    <a>
                        <xsl:if test="normalize-space($cell/LinkValue)">
                            <xsl:attribute name="href"><xsl:value-of select="$cell/LinkValue" /></xsl:attribute>
                        </xsl:if>
                        <xsl:if test="normalize-space($cell/TitleValue)">
                            <xsl:attribute name="title"><xsl:value-of select="$cell/TitleValue" /></xsl:attribute>
                        </xsl:if>                        
                        <xsl:value-of select="$cell/DisplayValue" disable-output-escaping="yes" />
                    </a>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$cell/DisplayValue" disable-output-escaping="yes" />
                </xsl:otherwise>
            </xsl:choose>    
        </td>
    </xsl:template>
      
    
</xsl:stylesheet>

