<!--                                                                  -->
<!--  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="" encoding="utf-8" />

    <xsl:include href="/app/tools/rps/templates/global.xsl" />
    <xsl:include href="shared.xsl" />


    <xsl:template name="pickLayout">
        <div class="StatementsDocuments MainBaseSection" id="statement">
            <xsl:call-template name="helpLink">
                <xsl:with-param name="helpCommand">show_mechanical</xsl:with-param>
            </xsl:call-template>
            <xsl:call-template name="pdfInlineLayout" />
            <xsl:call-template name="buttons" />
        </div>
    </xsl:template>


    <xsl:template name="pdfInlineLayout">

        <xsl:variable name="labelView">
            <xsl:choose>
                <xsl:when test="not(normalize-space(Params/_pubView))">1</xsl:when>
                <xsl:otherwise>0</xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <section class="StatementsDocuments-publisher">
            <a href="/rps/publisher?PublisherID={Statement/Publisher/PublisherID}&amp;c=show">
                <xsl:value-of select="Statement/Publisher/PublisherName" />
                <xsl:if test="Statement/Publisher/IsAdmin = 1"> (Admin)</xsl:if>
            </a>
        </section>

        <ul class="StatementsDocuments-download ControlsList">
            <li class="ControlsList-item">
                <xsl:call-template name="uiDownloadLink">
                    <xsl:with-param name="text" select="'Full Statement View PDF'" />
                    <xsl:with-param name="url">
                        <xsl:text>/rps/statement?c=pdf_mechanical&amp;MechanicalStatementID=</xsl:text>
                        <xsl:value-of select="Statement/MechanicalStatementID" />
                        <xsl:text>&amp;_full=1</xsl:text>
                    </xsl:with-param>
                </xsl:call-template>
            </li>
            <li class="ControlsList-item">
                <xsl:call-template name="uiDownloadLink">
                    <xsl:with-param name="text" select="'Publisher View PDF'" />
                    <xsl:with-param name="url">
                        <xsl:text>/rps/statement?c=pdf_mechanical&amp;MechanicalStatementID=</xsl:text>
                        <xsl:value-of select="Statement/MechanicalStatementID" />
                    </xsl:with-param>
                </xsl:call-template>
            </li>
            <li class="ControlsList-item">
                <xsl:call-template name="uiDownloadLink">
                    <xsl:with-param name="text" select="'Publisher View TXT'" />
                    <xsl:with-param name="url">
                        <xsl:text>?c=text_mechanical&amp;MechanicalStatementID=</xsl:text>
                        <xsl:value-of select="Statement/MechanicalStatementID" />
                    </xsl:with-param>
                </xsl:call-template>
            </li>
        </ul>

        <section class="StatementsDocuments-view-switch ControlsGroup">
            <div class="ControlsGroup-item">
                <xsl:call-template name="uiButton">
                    <xsl:with-param name="content" select="'Full View'" />
                    <xsl:with-param name="active">
                        <xsl:if test="$labelView = 1">
                            <xsl:text>true</xsl:text>
                        </xsl:if>
                    </xsl:with-param>
                    <xsl:with-param name="url">
                        <xsl:text>/rps/statement?c=show_mechanical_pdf&amp;MechanicalStatementID=</xsl:text>
                        <xsl:value-of select="Statement/MechanicalStatementID" />
                    </xsl:with-param>
                </xsl:call-template>
            </div>
            <div class="ControlsGroup-item">
                <xsl:call-template name="uiButton">
                    <xsl:with-param name="content" select="'Publisher View'" />
                    <xsl:with-param name="active">
                        <xsl:if test="$labelView != 1">
                            <xsl:text>true</xsl:text>
                        </xsl:if>
                    </xsl:with-param>
                    <xsl:with-param name="url">
                        <xsl:text>/rps/statement?c=show_mechanical_pdf&amp;MechanicalStatementID=</xsl:text>
                        <xsl:value-of select="Statement/MechanicalStatementID" />
                        <xsl:text>&amp;_pubView=1</xsl:text>
                    </xsl:with-param>
                </xsl:call-template>
            </div>
        </section>

        <xsl:variable name="pdfType">
            <xsl:if test="$labelView = 1">
                <xsl:text>Label</xsl:text>
            </xsl:if>
            <xsl:if test="$labelView = 0">
                <xsl:text>Publisher</xsl:text>
            </xsl:if>
        </xsl:variable>

        <xsl:variable name="pdfName">
            <xsl:if test="$labelView = 1">
                <xsl:value-of select="Statement/LabelViewPDF" />
            </xsl:if>
            <xsl:if test="$labelView = 0">
                <xsl:value-of select="Statement/PublisherViewPDF" />
            </xsl:if>
        </xsl:variable>

        <div id="statementHolder" class="StatementsDocuments-preview-wrapper">
            <object
                class="StatementsDocuments-preview"
                data="/rps/statement/us_mechanical_pdf/{Statement/MechanicalStatementID}/{$pdfType}/{$pdfName}#pagemode=thumbs&amp;toolbar=1&amp;navpanes=1"
                id="statementFrame"
                type="application/pdf"
            />
        </div>

    </xsl:template>

    <xsl:template name="submitButton">
    </xsl:template>

    <xsl:template name="cancelButton">
        <xsl:call-template name="uiButton">
            <xsl:with-param name="content" select="'Back to Statements'" />
            <xsl:with-param name="className" select="'Form-button'" />
            <xsl:with-param name="name" select="'Back'" />
            <xsl:with-param name="url">
                <xsl:text>mechanical?MechanicalRunID=</xsl:text>
                <xsl:value-of select="Statement/MechanicalRun/MechanicalRunID" />
                <xsl:text>&amp;c=show&amp;PayorID=</xsl:text>
                <xsl:value-of select="Statement/MechanicalRun/PayorID" />
            </xsl:with-param>
        </xsl:call-template>
    </xsl:template>


</xsl:stylesheet>

