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

    <xsl:include href="/app/tools/raptor/templates/global.xsl" />
    <xsl:include href="/app/tools/raptor/templates/product_edit.xsl" />
    <xsl:include href="/app/tools/raptor/templates/product_show.xsl" />
    <xsl:include href="/app/tools/raptor/templates/product_search.xsl" />


    <xsl:template name="pickLayout">
        <xsl:if test="$cmd = 'show'">
            <xsl:call-template name="productViewLayout" />
        </xsl:if>
        <xsl:if test="$cmd = 'edit'">
            <xsl:call-template name="productEditLayout" />
        </xsl:if>
    </xsl:template>

    <xsl:template name="productViewLayout">
        <form action="/rps/product" name="product" id="product" method="post">
            <div class="section" id="productChart">
                <input type="hidden" name="submit" value="1" />
                <xsl:call-template name="productSearchFields" />
                <xsl:if test="normalize-space(Form/Album/AlbumID)">
                    <xsl:call-template name="productList" />
                </xsl:if>
            </div>
            <xsl:if test="normalize-space(Form/Album/AlbumID)">
                <xsl:for-each select="Form/ProductList/Product">
                    <xsl:call-template name="productView" />
                </xsl:for-each>
            </xsl:if>
        </form>
        <xsl:if test="Params/ProductID">
            <script type="text/javascript">
                toggleTrackTable('product<xsl:value-of select="Params/ProductID" />');
            </script>
        </xsl:if>
    </xsl:template>

    <xsl:template name="productEditLayout">
        <style type="text/css">@import url(/production/css/calendar.css);</style>
        <script type="text/javascript" src="/production/javascript/calendar/calendar.js"></script>
        <script type="text/javascript" src="/production/javascript/calendar/calendar-en.js"></script>
        <script type="text/javascript" src="/production/javascript/calendar/calendar-setup.js"></script>
        <script src="/production/javascript/validateProduct.js?t={$now}" type="text/javascript"></script>
        <form action="/rps/product" name="productEdit" id="productEdit" method="get">
            <input type="hidden" name="submit" value="1" />
            <input type="hidden" name="c" value="edit" />
            <xsl:call-template name="productEdit" />
            <xsl:call-template name="trackEdit" />
            <xsl:call-template name="buttonsEdit" />
        </form>
        <script type="text/javascript">
            Calendar.setup({
                inputField : "Form_Product_ReleaseDate", // id of the input field
                ifFormat : "%m/%d/%Y", // format of the input field (even if hidden, this format will be honored)
                daFormat: "%m/%d/%Y",// format of the displayed date
                button: "calendarIcon", // trigger button (well, IMG in our case)
                align: "Tl", // alignment (defaults to "Bl")
                singleClick: true
            });
        </script>
    </xsl:template>


    <xsl:template name="productSearchFields">
        <div id="searchFields">
            Catalog # <input type="text" name="Form_Album_CatalogNumber" id="Form_Album_CatalogNumber" maxlength="20">
            <xsl:attribute name="value">
                <xsl:choose>
                    <xsl:when test="Params/CatalogNumber">
                        <xsl:value-of select="Params/CatalogNumber" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="Form/Album/CatalogNumber" />
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
            </input>&#160;<a href="javascript:searcProduct('CatalogNumber')" title="Look up this Catalog #"><img src="/production/images/icons/magnify.gif" /></a>
            Title <input type="text" name="Form_Album_Title" id="Form_Album_Title">
            <xsl:attribute name="value">
                <xsl:choose>
                    <xsl:when test="Params/Title">
                        <xsl:value-of select="Params/Title" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="Form/Album/Title" />
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
            </input>&#160;<a href="javascript:searchProduct('Title')" title="Look up this Title"><img src="/production/images/icons/magnify.gif" /></a>
        </div>
    </xsl:template>

    <xsl:template name="productList">
        <h2>Products</h2>
        <table class="textChart hiOn">
            <tbody>
                <tr>
                    <xsl:if test="not(Form/ProductList/Product)">
                        <xsl:attribute name="class">textChartEmpty</xsl:attribute>
                    </xsl:if>
                    <th class="rowLeft" id="productType">Type</th>
                    <th id="productID">Product ID</th>
                    <th id="productUPC">UPC</th>
                    <th id="productDate">Release Date</th>
                    <th id="productPrice">Price Code</th>
                    <th id="productStatus">Status</th>
                </tr>
                <xsl:for-each select="Form/ProductList/Product">
                    <xsl:call-template name="productRow" />
                </xsl:for-each>
            </tbody>
        </table>
        <xsl:if test="Form/Album/AlbumID">
            <input type="button" id="addButton" onClick="location.href='product?c=edit&amp;AlbumID={Form/Album/AlbumID}'">
                <xsl:attribute name="value">
                    <xsl:choose>
                        <xsl:when test="Form/ProductList/Product">Create</xsl:when>
                        <xsl:otherwise>Add New</xsl:otherwise>
                    </xsl:choose>
                </xsl:attribute>
            </input>
        </xsl:if>
    </xsl:template>

    <xsl:template name="productView">
        <xsl:variable name="productID" select="ProductID" />
        <div class="trackView" id="product{ProductID}">
            <div class="sectionLeft">
                <h2>Product</h2>
                <table>
                    <xsl:if test="normalize-space(/Root/Messages/Message/Code) and /Root/Params/ProductID = ProductID">
                        <tr>
                            <td colspan="3">
                                <p class="success">Product ID '<xsl:value-of select="ProductCode" />' successfully updated!</p>
                            </td>
                        </tr>
                    </xsl:if>
                    <tr>
                        <td id="leftCol"><strong>Type</strong></td>
                        <td id="middleCol">
                            <xsl:variable name="productTypeID" select="ProductTypeID" />
                            <xsl:value-of select="/Root/Form/TypeList/Type[ProductTypeID = $productTypeID]/Description" />
                        </td>
                        <td class="catalogInfo"><strong>Created</strong>&#160;<xsl:value-of select="CreatedDate" /></td>
                    </tr>
                    <tr>
                        <td><strong>Product ID</strong></td>
                        <td><xsl:value-of select="ProductCode" /></td>
                        <td class="catalogInfo">
                            <xsl:if test="ModifiedDate != CreatedDate"><strong>Modified</strong>&#160;<xsl:value-of select="ModifiedDate" /></xsl:if>
                            <xsl:if test="ModifiedDate = CreatedDate"><strong>By</strong>&#160;<xsl:value-of select="ModifiedBy" /></xsl:if>
                        </td>
                    </tr>
                    <tr>
                        <td><strong>UPC</strong></td>
                        <td><xsl:value-of select="UPC" /></td>
                        <td class="catalogInfo"><xsl:if test="ModifiedDate != CreatedDate"><strong>By</strong>&#160;<xsl:value-of select="ModifiedBy" /></xsl:if></td>
                    </tr>
                    <tr>
                        <td><strong>Release Date</strong></td>
                        <td colspan="2"><xsl:value-of select="ReleaseDate" /></td>
                    </tr>
                    <tr>
                        <td><strong>Price Code</strong></td>
                        <td colspan="2">
                            <xsl:variable name="productPriceID" select="ProductPriceID" />
                            <xsl:value-of select="/Root/Form/PriceList/Price[ProductPriceID = $productPriceID]/Description" />
                        </td>
                    </tr>
                    <tr>
                        <td><strong>Status</strong></td>
                        <td colspan="2">
                            <xsl:variable name="productStatusID" select="ProductStatusID" />
                            <xsl:value-of select="/Root/Form/StatusList/Status[ProductStatusID = $productStatusID]/Description" />
                        </td>
                    </tr>
                </table>&#160;
            </div>
            <div class="textChart">
                <h2>Tracks</h2>
                <table class="textChart" id="productTrackTable">
                    <tbody>
                        <tr>
                            <th class="rowLeft" id="trackIncl">Incl</th>
                            <th id="trackNum">Track</th>
                            <th id="trackName">Name</th>
                            <th id="trackLength">Length</th>
                            <th id="discNum">Disc #</th>
                            <th id="discTrack">Disc Track</th>
                        </tr>
                        <xsl:for-each select="/Root/Form/Album/TrackList/Track">
                            <xsl:call-template name="trackViewRow">
                                <xsl:with-param name="productID"><xsl:value-of select="$productID" /></xsl:with-param>
                            </xsl:call-template>
                        </xsl:for-each>
                    </tbody>
                </table>
            </div>
            <xsl:call-template name="buttonsView">
                <xsl:with-param name="productID"><xsl:value-of select="$productID" /></xsl:with-param>
            </xsl:call-template>
        </div>
    </xsl:template>

    <xsl:template name="buttonsView">
        <div class="section">
            <table class="buttons">
                <tr>
                    <td>
                        <div class="defaultButtonTL">
                            <div class="defaultButtonTR">
                                <div class="defaultButtonBL">
                                    <div class="defaultButtonBR">
                                        <input type="button" value="Edit" onClick="javascript:location.href='product?AlbumID={/Root/Form/Album/AlbumID}&amp;ProductID={$productID}&amp;c=edit'" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                    <td>
                        <input type="button" value="Delete" onClick="javascript:inlinePop()" />
                    </td>
                    <td>
                        <input type="button" value="Cancel" onClick="javascript:toggleTrackTable()" />
                    </td>
                </tr>
            </table>
        </div>
    </xsl:template>

    <xsl:template name="productRow">
        <tr class="row{position() mod 2}" onClick="javascript:toggleTrackTable('product{ProductID}')" onMouseOver="this.style.cursor = 'pointer'">
            <xsl:variable name="productTypeID" select="ProductTypeID" />
            <td class="rowLeft"><xsl:value-of select="/Root/Form/TypeList/Type[ProductTypeID = $productTypeID]/Description" /></td>
            <td><xsl:value-of select="ProductCode" /></td>
            <td><xsl:value-of select="UPC" /></td>
            <td><xsl:value-of select="ReleaseDate" /></td>
            <xsl:variable name="productPriceID" select="ProductPriceID" />
            <td><xsl:value-of select="/Root/Form/PriceList/Price[ProductPriceID = $productPriceID]/Description" /></td>
            <xsl:variable name="productStatusID" select="ProductStatusID" />
            <td><xsl:value-of select="/Root/Form/StatusList/Status[ProductStatusID = $productStatusID]/Description" /></td>
        </tr>
    </xsl:template>

    <xsl:template name="trackViewRow">
        <xsl:variable name="trackID" select="TrackID" />
        <tr class="row{position() mod 2}">
            <td class="rowLeft">
                <xsl:if test="/Root/Form/ProductList/Product[ProductID = $productID]/TrackList/Track[TrackID = $trackID]/Included = 1">
                    <img src="/production/images/check.gif" alt="Included" />
                </xsl:if>
            </td>
            <td><xsl:if test="TrackNumber &lt; 10">0</xsl:if><xsl:value-of select="TrackNumber" /></td>
            <td><xsl:value-of select="Title" /></td>
            <td><xsl:value-of select="Length" /></td>
            <td><xsl:value-of select="/Root/Form/ProductList/Product[ProductID = $productID]/TrackList/Track[TrackID = $trackID]/DiscNumber" /></td>
            <td><xsl:value-of select="/Root/Form/ProductList/Product[ProductID = $productID]/TrackList/Track[TrackID = $trackID]/DiscTrack" /></td>
        </tr>
    </xsl:template>

    <xsl:template name="inlinePopHTML">
        <form action="/app/product" id="popupContainer">
            <input type="hidden" name="c" value="delete" />
            <input type="hidden" name="file" value="" />
            <span id="confirmDeleteMessage"></span>
            <p>
                Are you sure you want to delete this product?
            </p>
            <table class="buttons">
                <tr>
                    <td>
                        <div class="defaultButtonTL">
                            <div class="defaultButtonTR">
                                <div class="defaultButtonBL">
                                    <div class="defaultButtonBR">
                                        <input type="button" name="delete" value="Yes, delete this product" onClick="javascript:alert('This doesn\'t work yet, but check back soon!')" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                    <td><input type="button" value="No, I'm not sure" onclick="hideInlinePop()" /></td>
                </tr>
            </table>
        </form>
    </xsl:template>

    <xsl:template name="productEdit">
        <xsl:if test="normalize-space(Form/Album/AlbumID)">
            <input type="hidden" name="AlbumID" value="{Form/Album/AlbumID}" />
        </xsl:if>
        <xsl:if test="normalize-space(Form/Product/ProductID)">
            <input type="hidden" name="ProductID" value="{Form/Product/ProductID}" />
        </xsl:if>
        <div class="sectionLeft">
            <table>
                <tr>
                    <td colspan="3">
                        <xsl:if test="Messages/Message/Code = 'form_submit_success'">
                            <span class="success">Catalog # <xsl:value-of select="Form/Album/CatalogNumber" /> has been successfully <xsl:choose><xsl:when test="Params/new">created.<br /><a href="catalog?">Click here</a> to add another item to the catalog.<br /></xsl:when><xsl:otherwise>updated.</xsl:otherwise></xsl:choose>
                        </span><br />
                    </xsl:if>
                    <span class="error" id="errorGeneral">
                        <xsl:if test="/Root//*[@e]">
                            Please fix the errors below.<br />
                        </xsl:if>
                    </span>
                </td>
            </tr>
            <tr>
                <td id="leftCol"><label for="Form_Product_ProductTypeID">Type*</label></td>
                <td id="middleCol">
                    <xsl:call-template name="productError">
                        <xsl:with-param name="path">Form/Product/ProductTypeID</xsl:with-param>
                        <xsl:with-param name="name">Form_Product_ProductTypeID</xsl:with-param>
                        <xsl:with-param name="displayName">Type</xsl:with-param>
                    </xsl:call-template>
                    <select name="Form_Product_ProductTypeID">
                        <option value="">Choose...</option>
                        <xsl:for-each select="Form/TypeList/Type">
                            <option value="{ProductTypeID}">
                                <xsl:if test="ProductTypeID = /Root/Form/Product/ProductTypeID">
                                    <xsl:attribute name="selected">selected</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="Description" />
                            </option>
                        </xsl:for-each>
                    </select>
                </td>
                <td class="catalogInfo">
                    <xsl:if test="normalize-space(Form/Product/CreatedDate)">
                        <strong>Created</strong>&#160;<xsl:value-of select="Form/Product/CreatedDate" />
                    </xsl:if>
                </td>
            </tr>
            <tr>
                <td><label for="Form_Product_ProductID">Product ID*</label></td>
                <td>
                    <xsl:call-template name="productError">
                        <xsl:with-param name="path">Form/Product/ProductCode</xsl:with-param>
                        <xsl:with-param name="name">Form_Product_ProductCode</xsl:with-param>
                        <xsl:with-param name="displayName">Product ID</xsl:with-param>
                    </xsl:call-template>
                    <input type="text" name="Form_Product_ProductCode" id="Form_Product_ProductCode" value="{Form/Product/ProductCode}" />
                </td>
                <td class="catalogInfo">
                    <xsl:if test="normalize-space(Form/Product/ModifiedDate)">
                        <xsl:if test="Form/Product/ModifiedDate != Form/Product/CreatedDate">
                            <strong>Modified</strong>&#160;<xsl:value-of select="Form/Product/ModifiedDate" />
                        </xsl:if>
                        <xsl:if test="Form/Product/ModifiedDate = Form/Product/CreatedDate">
                            <strong>By</strong>&#160;<xsl:value-of select="Form/Product/ModifiedBy" />
                        </xsl:if>
                    </xsl:if>
                </td>
            </tr>
            <tr>
                <td><label for="Form_Product_UPC">UPC*</label></td>
                <td>
                    <xsl:call-template name="productError">
                        <xsl:with-param name="path">Form/Product/UPC</xsl:with-param>
                        <xsl:with-param name="name">Form_Product_UPC</xsl:with-param>
                        <xsl:with-param name="displayName">UPC</xsl:with-param>
                    </xsl:call-template>
                    <input type="text" name="Form_Product_UPC" id="Form_Product_UPC" value="{Form/Product/UPC}" />
                </td>
                <td class="catalogInfo">
                    <xsl:if test="normalize-space(Form/Product/ModifiedBy) and Form/Product/ModifiedDate != Form/Product/CreatedDate">
                        <strong>By</strong>&#160;<xsl:value-of select="Form/Product/ModifiedBy" />
                    </xsl:if>
                </td>
            </tr>
            <tr>
                <td><label for="Form_Product_ReleaseDate">Release Date</label></td>
                <td colspan="2" class="Product_ReleaseDate">
                    <xsl:call-template name="productError">
                        <xsl:with-param name="path">Form/Product/ReleaseDate</xsl:with-param>
                        <xsl:with-param name="name">Form_Product_ReleaseDate</xsl:with-param>
                        <xsl:with-param name="displayName">Release Date</xsl:with-param>
                    </xsl:call-template>
                    <input type="text" name="Form_Product_ReleaseDate" id="Form_Product_ReleaseDate">
                        <xsl:attribute name="value">
                            <xsl:choose>
                                <xsl:when test="normalize-space(Form/Product/ReleaseDate)">
                                    <xsl:value-of select="Form/Product/ReleaseDate" />
                                </xsl:when>
                                <xsl:otherwise>
                                    <xsl:value-of select="Form/TodaysDate" />
                                </xsl:otherwise>
                            </xsl:choose>
                        </xsl:attribute>
                    </input>
                    <img src="/production/images/icons/calendar.gif" id="calendarIcon" class="calendarIcon"  title="Select Release Date" />
                </td>
            </tr>
            <tr>
                <td><label for="Form_Product_ProductPriceID">Price Code</label></td>
                <td colspan="2">
                    <xsl:call-template name="productError">
                        <xsl:with-param name="path">Form/Product/ProductPriceID</xsl:with-param>
                        <xsl:with-param name="name">Form_Product_ProductPriceID</xsl:with-param>
                        <xsl:with-param name="displayName">Price Code</xsl:with-param>
                    </xsl:call-template>
                    <select name="Form_Product_ProductPriceID">
                        <option value="">Choose...</option>
                        <xsl:for-each select="Form/PriceList/Price">
                            <option value="{ProductPriceID}">
                                <xsl:if test="ProductPriceID = /Root/Form/Product/ProductPriceID">
                                    <xsl:attribute name="selected">selected</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="Description" />
                            </option>
                        </xsl:for-each>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label for="Form_Product_ProductStatusID">Status*</label></td>
                <td colspan="2">
                    <xsl:call-template name="productError">
                        <xsl:with-param name="path">Form/Product/ProductStatusID</xsl:with-param>
                        <xsl:with-param name="name">Form_Product_ProductStatusID</xsl:with-param>
                        <xsl:with-param name="displayName">Status</xsl:with-param>
                    </xsl:call-template>
                    <select name="Form_Product_ProductStatusID">
                        <xsl:for-each select="Form/StatusList/Status">
                            <option value="{ProductStatusID}">
                                <xsl:if test="ProductStatusID = /Root/Form/Product/ProductStatusID">
                                    <xsl:attribute name="selected">selected</xsl:attribute>
                                </xsl:if>
                                <xsl:value-of select="Description" />
                            </option>
                        </xsl:for-each>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <br />*Required field
                </td>
            </tr>
        </table>
    </div>
    </xsl:template>

    <xsl:template name="trackEdit">
        <div class="textChart">
            <h2>Tracks</h2>
            <xsl:call-template name="trackErrorMessages" />
            <table class="textChart" id="productTrackTable">
                <tbody>
                    <tr>
                        <th class="rowLeft" id="trackIncl">Incl</th>
                        <th id="trackNum">Track</th>
                        <th id="trackName">Name</th>
                        <th id="trackLength">Length</th>
                        <th id="discNum">Disc #</th>
                        <th id="discTrack">Disc Track</th>
                    </tr>
                    <xsl:for-each select="/Root/Form/Album/TrackList/Track">
                        <xsl:call-template name="trackEditRow" />
                    </xsl:for-each>
                </tbody>
            </table>
        </div>
    </xsl:template>

    <xsl:template name="trackEditRow">
        <xsl:variable name="trackID" select="TrackID" />
        <input type="hidden" name="Form_Product_TrackList_Track_{@i}_TrackID" value="{$trackID}" />
        <tr class="row{position() mod 2}">
            <td class="rowLeft Included">
                <input type="checkbox" name="Trigger_Form_Product_TrackList_Track_{@i}_Included" id="Trigger_Form_Product_TrackList_Track_{@i}_Included" value="1" onClick="checkCheckBox(this,'Form_Product_TrackList_Track_{@i}_Included')">
                    <xsl:if test="not(/Root/Form/Product/TrackList/Track) or /Root/Form/Product/TrackList/Track[TrackID = $trackID]/Included = 1">
                        <xsl:attribute name="checked">checked</xsl:attribute>
                    </xsl:if>
                </input>
                <input type="hidden" name="Form_Product_TrackList_Track_{@i}_Included" id="Form_Product_TrackList_Track_{@i}_Included">
                    <xsl:if test="not(/Root/Form/Product/TrackList/Track) or /Root/Form/Product/TrackList/Track[TrackID = $trackID]/Included = 1">
                        <xsl:attribute name="value">1</xsl:attribute>
                    </xsl:if>
                </input>
            </td>
            <td class="trackNumber"><xsl:if test="TrackNumber &lt; 10">0</xsl:if><xsl:value-of select="TrackNumber" /></td>
            <td class="trackTitle"><xsl:value-of select="Title" /></td>
            <td class="length"><xsl:value-of select="Length" /></td>
            <td class="discNumber">
                <xsl:if test="/Root/Form/Product/TrackList/Track[TrackID = $trackID]/DiscNumber/@e">
                    <xsl:attribute name="class">discNumber errorInput</xsl:attribute>
                </xsl:if>
                <input type="text" name="Form_Product_TrackList_Track_{@i}_DiscNumber" id="Form_Product_TrackList_Track_{@i}_DiscNumber" value="{/Root/Form/Product/TrackList/Track[TrackID = $trackID]/DiscNumber}" />
            </td>
            <td class="discTrack">
                <xsl:if test="/Root/Form/Product/TrackList/Track[TrackID = $trackID]/DiscTrack/@e">
                    <xsl:attribute name="class">discTrack errorInput</xsl:attribute>
                </xsl:if>
                <input type="text" name="Form_Product_TrackList_Track_{@i}_DiscTrack" id="Form_Product_TrackList_Track_{@i}_DiscTrack">
                    <xsl:attribute name="value">
                        <xsl:choose>
                            <xsl:when test="normalize-space(/Root/Form/Product/TrackList/Track[TrackID = $trackID]/DiscTrack)">
                                <xsl:value-of select="/Root/Form/Product/TrackList/Track[TrackID = $trackID]/DiscTrack" />
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="TrackNumber" />
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:attribute>
                </input>
            </td>
        </tr>
    </xsl:template>

    <xsl:template name="buttonsEdit">
        <div class="section">
            <table class="buttons">
                <tr>
                    <td>
                        <div class="defaultButtonTL">
                            <div class="defaultButtonTR">
                                <div class="defaultButtonBL">
                                    <div class="defaultButtonBR">
                                        <input type="submit">
                                            <xsl:choose>
                                                <xsl:when test="normalize-space(Form/Product/ProductID)">
                                                    <xsl:attribute name="value">Update</xsl:attribute>
                                                </xsl:when>
                                                <xsl:otherwise>
                                                    <xsl:attribute name="value">Create</xsl:attribute>
                                                </xsl:otherwise>
                                            </xsl:choose>
                                        </input>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                    <td>
                        <input type="reset" value="Clear" />
                    </td>
                    <td>
                        <input type="button" value="Cancel" onClick="javascript:history.go(-1)" />
                    </td>
                </tr>
            </table>
        </div>
    </xsl:template>

    <xsl:template name="productError">
        <span id="ERROR{$name}" class="error">
            <xsl:if test="dyn:evaluate($path)[@e]">
                <xsl:value-of select="$displayName" /> <xsl:call-template name="fieldError"><xsl:with-param name="errorCode" select="dyn:evaluate($path)/@e" /></xsl:call-template>
            </xsl:if>
        </span>
    </xsl:template>

    <xsl:template name="trackErrorMessages">
        <div class="error" id="trackErrorTop">
            <xsl:if test="Form/Product/TrackList/Track/DiscNumber[@e = 'field_invalid']">Disc Number is invalid.<br /></xsl:if>
            <xsl:if test="Form/Product/TrackList/Track/DiscTrack[@e = 'field_invalid']">Disc Track is invalid.<br /></xsl:if>
        </div>
    </xsl:template>

</xsl:stylesheet>

