<!--                                                                  -->
<!--  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:variable name="lockedRecord">
        <xsl:choose>
            <xsl:when test="$cmd != 'copy' and /Root/Form/TrackLicense/Status = 2">1</xsl:when>
            <xsl:when test="$openRuns &gt; 0">1</xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose>
    </xsl:variable>


    <xsl:template name="pickLayout">
        <xsl:call-template name="licenseValidation" />
        <form name="licenseEdit" id="licenseEdit" method="post" action="{$area}">
            <input type="hidden" name="formSubmit" value="1" />
            <input type="hidden" name="c" value="{$cmd}" />
            <input type="hidden" name="Form_TrackLicense_Type" value="{Form/TrackLicense/Type}" />
            <input type="hidden" name="LicenseType" value="{Form/TrackLicense/Type}" />

            <xsl:if test="Params/ReturnTo">
                <input type="hidden" name="ReturnTo" value="{Params/ReturnTo}" />
            </xsl:if>
            <xsl:if test="Params/TrackID and $cmd != 'copy'">
                <input type="hidden" name="TrackID" value="{Params/TrackID}" />
            </xsl:if>
            <xsl:if test="normalize-space(Form/TrackLicense/TrackLicenseID) and $cmd != 'copy'">
                <input type="hidden" name="TrackLicenseID" value="{Form/TrackLicense/TrackLicenseID}" />
            </xsl:if>

            <div class="section">
		        <xsl:call-template name="openRunStatusMessage" />
                <xsl:call-template name="helpLink">
                    <xsl:with-param name="extraParams">&amp;licenseType=<xsl:value-of select="$licenseType" /></xsl:with-param>
                </xsl:call-template>
                <xsl:if test="$cmd = 'edit'">
                    <xsl:call-template name="trackView">
                        <xsl:with-param name="track" select="Form/Track" />
                        <xsl:with-param name="albumTitle" select="Form/Track/AlbumName" />
                    </xsl:call-template>
                </xsl:if>
                <xsl:if test="$cmd = 'copy'">
                    <script type="text/javascript">
                        requireField("TrackID","At least one track  must be selected.<br />");
                    </script>
                    <xsl:if test="$licenseType = 'ccomp'">
                        <input type="hidden" name="ControlledCompositionID" value="{Form/TrackLicense/ControlledCompositionID}" />
                    </xsl:if>

                    <input type="hidden" name="TrackLicenseID" value="{Params/TrackLicenseID}" />

                    <xsl:call-template name="errorMessageGeneral" />

                    <xsl:if test="count(//@e) = 1">
                        <span class="error">License could not be copied to selected track(s).</span>
                    </xsl:if>

                    <xsl:call-template name="licenseCopyTracks" />
                </xsl:if>
                <br />
                <xsl:call-template name="trackLicenseSection" />
                <br /><br />
            </div>
            <xsl:call-template name="buttons" />
        </form>
    </xsl:template>


    <xsl:template name="licenseValidation">
        <xsl:choose>
            <xsl:when test="$licenseType = 'ccomp'">
                <script type="text/javascript" src="/production/javascript/validateControlledComp.js?v=1"></script>
            </xsl:when>
            <xsl:when test="$licenseType = 'public'">
                <script type="text/javascript" src="/production/javascript/validatePublicDomain.js?v=1"></script>
            </xsl:when>
            <xsl:otherwise>
                <script type="text/javascript" src="/production/javascript/validateLicense.js?v=2"></script>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>


    <xsl:template name="trackLicenseSection">
        <xsl:choose>
            <xsl:when test="$licenseType = 'ccomp'">
                <xsl:if test="normalize-space(Params/ControlledCompositionID)">
                    <input type="hidden" name="ControlledCompositionID" value="{Params/ControlledCompositionID}" />
                    <input type="hidden" name="Form_TrackLicense_ControlledCompositionID" value="{Params/ControlledCompositionID}" />
                </xsl:if>
            </xsl:when>
        </xsl:choose>
        <fieldset>
            <legend><xsl:value-of select="$licenseUpper" /></legend>
            <p class="formHeader">
                <xsl:call-template name="licenseInstructions" />
            </p>
            <hr />
            <div class="insideFieldset">
                <xsl:if test="$cmd != 'copy'">
                    <xsl:call-template name="errorMessageGeneral" />
                </xsl:if>
                <xsl:if test="$licenseType = 'ccomp' and Form/TrackLicense/NoValidRegion">
					<p class="errorGeneral messageBox">
						A US-only Region is needed for this license.
					</p>
                </xsl:if>
                <xsl:call-template name="column1Edit" />
                <xsl:if test="$licenseType = 'license' or $licenseType = 'ringtone'">
                    <xsl:call-template name="licenseColumn2" />
                </xsl:if>
            </div>
        </fieldset>
    </xsl:template>


    <xsl:template name="licenseInstructions">
        <xsl:choose>
            <xsl:when test="$cmd = 'copy'">
                Editing the <xsl:value-of select="$licenseLower" /> on this page will not affect the original <xsl:value-of select="$licenseLower" />.
            </xsl:when>
            <xsl:otherwise>
                <xsl:if test="Form/TrackLicense/Status = 1 or Form/TrackLicense/Status = 3">
                    Edit <xsl:value-of select="$licenseLower" /> information here.
                </xsl:if>
                <xsl:if test="Form/TrackLicense/Status = ''">
                    Enter <xsl:value-of select="$licenseLower" /> information here.
                </xsl:if>
                <xsl:if test="Form/TrackLicense/Status = 2">
                    This <xsl:value-of select="$licenseLower" /> is used in a pending statement and may not be edited at this time.
                </xsl:if>
                <xsl:if test="Form/TrackLicense/ParentTrackLicenseID &gt; 0">
                    (This <xsl:value-of select="$licenseLower" /> is an updated version of a <a href="/rps/license?c=show&amp;TrackLicenseID={Form/TrackLicense/ParentTrackLicenseID}">previous <xsl:value-of select="$licenseLower" /></a>.)
                </xsl:if>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>


    <xsl:template name="column1Edit">
        <div class="column1">
            <table>

                <xsl:if test="$licenseType = 'license'">
                    <xsl:call-template name="licenseColumn1" />
                </xsl:if>

                <xsl:if test="$licenseType = 'ccomp'">
                    <xsl:call-template name="ccompColumn1" />
                </xsl:if>

                <xsl:if test="$licenseType = 'public'">
                    <xsl:call-template name="publicColumn1" />
                </xsl:if>

                <xsl:if test="$licenseType = 'ringtone'">
                    <xsl:call-template name="ringtoneColumn1" />
                </xsl:if>

                <tr>
                    <td colspan="2">
                    <br />*Required field
                    </td>
                </tr>
            </table>
        </div>
    </xsl:template>


    <xsl:template name="licenseColumn1">
        <xsl:call-template name="productTypeField" />
        <xsl:call-template name="regionField" />
        <xsl:call-template name="shareField" />
        <xsl:call-template name="payorField" />
        <xsl:call-template name="publisherField" />
        <xsl:call-template name="adminField" />
        <xsl:call-template name="agentField" />
        <xsl:call-template name="directField" />
        <xsl:call-template name="issuerLicenseField" />

        <xsl:if test="$area = 'ca_license'">
            <xsl:call-template name="issuerSongField" />
        </xsl:if>

        <xsl:call-template name="crossedField" />
        <xsl:call-template name="statusField" />
        <tr><td colspan="2"><hr /></td></tr>
        <xsl:call-template name="dateSentField" />
        <xsl:call-template name="dateReceivedField" />
        <xsl:call-template name="dateIssuedField" />
        <xsl:call-template name="termStartField" />
        <xsl:call-template name="termEndField" />
    </xsl:template>


    <xsl:template name="licenseColumn2">
        <div class="column2">
            <table>
                <xsl:call-template name="rateTypeField" />
                <xsl:call-template name="ratePercentField" />
                <xsl:call-template name="rateBasisField" />
                <xsl:call-template name="pennyRateField" />
                <xsl:if test="$licenseType = 'license'">
                    <tr><td colspan="2"><hr /></td></tr>
                    <xsl:call-template name="reserveField" />
                    <xsl:call-template name="liquidationScheduleFields" />                
                    <xsl:call-template name="digitalReservesField" />
                </xsl:if>
                <tr><td colspan="2"><hr /></td></tr>
                <xsl:call-template name="salesPercentField" />
                <xsl:call-template name="freeGoodsField" />
                <xsl:call-template name="miscField" />
                <tr><td colspan="2"><hr /></td></tr>
                <xsl:call-template name="commentsField" />
            </table>
        </div>
    </xsl:template>


    <xsl:template name="ccompColumn1">
        <xsl:call-template name="regionField" />
        <xsl:call-template name="shareField" />
        <xsl:call-template name="payorField" />
        <xsl:call-template name="publisherField" />
        <xsl:call-template name="adminField" />
        <xsl:call-template name="agentField" />
        <xsl:call-template name="directField" />
        <xsl:call-template name="issuerLicenseField" />
        <xsl:call-template name="statusField" />
        <tr><td colspan="2"><hr /></td></tr>
        <xsl:call-template name="dateSentField" />
        <xsl:call-template name="dateReceivedField" />
        <xsl:call-template name="dateIssuedField" />
        <xsl:call-template name="termStartField" />
        <xsl:call-template name="termEndField" />
    </xsl:template>


    <xsl:template name="publicColumn1">
        <xsl:call-template name="shareField" />
        <xsl:call-template name="statusField" />
    </xsl:template>


    <xsl:template name="ringtoneColumn1">
        <xsl:call-template name="ringtoneField" />
        <xsl:call-template name="regionField" />
        <xsl:call-template name="shareField" />
        <xsl:call-template name="payorField" />
        <xsl:call-template name="publisherField" />
        <xsl:call-template name="adminField" />
        <xsl:call-template name="agentField" />
        <xsl:call-template name="directField" />
        <xsl:call-template name="issuerLicenseField" />
        <xsl:call-template name="statusField" />
        <tr><td colspan="2"><hr /></td></tr>
        <xsl:call-template name="dateSentField" />
        <xsl:call-template name="dateReceivedField" />
        <xsl:call-template name="dateIssuedField" />
        <xsl:call-template name="termStartField" />
        <xsl:call-template name="termEndField" />
    </xsl:template>


    <xsl:template name="productTypeField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_ProductTypeID">*Product Type:</label></td>
            <td class="rightCol">
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/ProductTypeID</xsl:with-param>
                    <xsl:with-param name="displayName">Product Type</xsl:with-param>
                </xsl:call-template>
                <select name="Form_TrackLicense_ProductTypeID" id="Form_TrackLicense_ProductTypeID">
                    <xsl:if test="$licenseType = 'license'">
                        <xsl:attribute name="onChange">digitalReservesTest(this.value)</xsl:attribute>
                    </xsl:if>
                    <xsl:if test="$lockedRecord = 1 or ($cmd != 'copy' and Form/TrackLicense/InUse = 1)">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                    <option value="">All Products</option>

                    <option value="255">
                        <xsl:if test="Form/TrackLicense/ProductTypeID = 255">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
    	                &#160;&#160;All Physical Products
                    </option>

                    <xsl:for-each select="Form/TypeList/Type[Type = 1]">
                        <option value="{ProductTypeID}">
                            <xsl:if test="ProductTypeID = /Root/Form/TrackLicense/ProductTypeID">
                                <xsl:attribute name="selected">selected</xsl:attribute>
                            </xsl:if>
                            &#160;&#160;&#160;&#160;<xsl:value-of select="Description" />
                        </option>
                    </xsl:for-each>

                    <option value="254">
                        <xsl:if test="Form/TrackLicense/ProductTypeID = 254">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
    	                &#160;&#160;All Digital Products
                    </option>

                    <xsl:for-each select="Form/TypeList/Type[Type = 2 and ProductTypeID != 15]">
                        <option value="{ProductTypeID}">
                            <xsl:if test="ProductTypeID = /Root/Form/TrackLicense/ProductTypeID">
                                <xsl:attribute name="selected">selected</xsl:attribute>
                            </xsl:if>
                            &#160;&#160;&#160;&#160;<xsl:value-of select="Description" />
                        </option>
                    </xsl:for-each>

                </select>
                <xsl:call-template name="helpIcon">
  	                <xsl:with-param name="tip">If &quot;All Products&quot; or a Digital product is selected, Region&lt;br&gt;must include only United States and/or Canada.</xsl:with-param>
                </xsl:call-template>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="ringtoneField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_ProductTypeID">Product Type:</label></td>
            <td class="readOnlyCol">
                RING
                <input type="hidden" name="Form_TrackLicense_ProductTypeID" id="Form_TrackLicense_ProductTypeID" value="15" />
                <xsl:call-template name="helpIcon">
  	                <xsl:with-param name="tip">Region must include only United States and/or Canada.</xsl:with-param>
                </xsl:call-template>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="regionField">
        <tr>
            <td class="leftCol"><label for="RegionName">*Region:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/RegionID</xsl:with-param>
                    <xsl:with-param name="displayName">Region</xsl:with-param>
                </xsl:call-template>
		  	    <input type="hidden" name="Form_TrackLicense_RegionID" id="Form_TrackLicense_RegionID" >
		  		    <xsl:attribute name="value">
						<xsl:choose>
							<xsl:when test="Form/TrackLicense/TrackLicenseID = ''">
								<xsl:value-of select="/Root/Form/RegionList/Region[IsDefaultMechanicalLicenseRegion = 1]/RegionID" />
							</xsl:when>
			    		    <xsl:when test="Form/TrackLicense/RegionID != 0">
		    				    <xsl:value-of select="Form/TrackLicense/RegionID" />
		    			    </xsl:when>
		    		    </xsl:choose>
					</xsl:attribute>
				</input>
				<xsl:choose>
				    <xsl:when test="$lockedRecord = 1">
				        <img src="/production/images/icons/office/Addressbook-Disabled-(16x16).gif" height="16" width="16" class="lookupIcon" />
				    </xsl:when>
				    <xsl:otherwise>
		  	            <a href="javascript:matchLicenseRegion()" title="Region Lookup" id="regionLookup"><img src="/production/images/icons/office/Addressbook-(16x16).gif" height="16" width="16" class="lookupIcon" /></a>
		  	        </xsl:otherwise>
		  	    </xsl:choose>
		  	    <div id="regionNameWrapper" class="lookupText">
		  		    <xsl:variable name="defaultRegionName" select="Form/RegionList/Region[IsDefaultMechanicalLicenseRegion = 1]/Name" />
	  		        <xsl:choose>
	  			        <xsl:when test="Form/TrackLicense/TrackLicenseID = ''">
	  				        <xsl:choose>
	  					        <xsl:when test="substring($defaultRegionName,26,1)">
	  						        <abbr title="{$defaultRegionName}"><xsl:value-of select="substring($defaultRegionName,1,25)" />...</abbr>
	  					        </xsl:when>
	  					        <xsl:otherwise>
	  						        <xsl:value-of select="$defaultRegionName" />
	  					        </xsl:otherwise>
	  				        </xsl:choose>
	  			        </xsl:when>
					    <xsl:when test="Form/TrackLicense/RegionID != 0">
						    <xsl:variable name="regionID" select="Form/TrackLicense/RegionID" />
						    <xsl:variable name="regionName" select="/Root/Form/RegionList/Region[RegionID = $regionID]/Name" />
	  				        <xsl:choose>
	  					        <xsl:when test="substring($regionName,26,1)">
	  						        <abbr title="{$regionName}"><xsl:value-of select="substring($regionName,1,25)" />...</abbr>
	  					        </xsl:when>
	  					        <xsl:otherwise>
	  						        <xsl:value-of select="$regionName" />
	  					        </xsl:otherwise>
	  				        </xsl:choose>
					    </xsl:when>
				    </xsl:choose>
	  	        </div>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="shareField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_Share">*Share:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/Share</xsl:with-param>
                    <xsl:with-param name="displayName">Share</xsl:with-param>
                </xsl:call-template>
                <input type="text" class="percentField" name="Form_TrackLicense_Share" id="Form_TrackLicense_Share">
										<xsl:if test="Form/TrackLicense/Share != '0'">
												<xsl:attribute name="value"><xsl:value-of select="Form/TrackLicense/Share" /></xsl:attribute>
										</xsl:if>
										<xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>%
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="payorField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_PayorID">Payor:</label></td>
            <td>
    			<select name="Form_TrackLicense_PayorID" id="Form_TrackLicense_PayorID">
                    <xsl:if test="$lockedRecord = 1 or ($cmd != 'copy' and Form/TrackLicense/InUse = 1)">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
    				<xsl:for-each select="Form/PayorList/Payor">
    					<option value="{PayorID}">
    						<xsl:if test="PayorID = /Root/Form/TrackLicense/PayorID">
    							<xsl:attribute name="selected">selected</xsl:attribute>
    						</xsl:if>
    						<xsl:value-of select="Name" />
    					</option>
    				</xsl:for-each>
    			</select>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="publisherField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_PublisherID">*Publisher:</label></td>
            <td nowrap="nowrap">
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/PublisherID</xsl:with-param>
                    <xsl:with-param name="displayName">Publisher</xsl:with-param>
                </xsl:call-template>
          	    <input type="hidden" name="Form_TrackLicense_PublisherID" id="Form_TrackLicense_PublisherID" value="{Form/TrackLicense/PublisherID}" />
				<xsl:choose>
				    <!-- <xsl:when test="$lockedRecord = 1 or Form/TrackLicense/InUse = 1"> -->
				    <xsl:when test="$lockedRecord = 1">
				        <a title="Publisher cannot be changed for this license.">
				            <img src="/production/images/icons/office/Addressbook-Disabled-(16x16).gif" height="16" width="16" class="lookupIcon" />
				        </a>
				    </xsl:when>
				    <xsl:otherwise>
          	            <a href="javascript:matchLicensePublisher('{$area}')" title="Publisher Lookup" id="publisherLookup"><img src="/production/images/icons/office/Addressbook-(16x16).gif" height="16" width="16" class="lookupIcon" /></a>
          	        </xsl:otherwise>
          	    </xsl:choose>
          	    <div id="publisherNameWrapper" class="lookupText">
              		<xsl:choose>
              			<xsl:when test="normalize-space(Form/TrackLicense/PublisherID) and substring(Form/TrackLicense/Publisher/PublisherName,26,1)">
              				<abbr title="{Form/TrackLicense/Publisher/PublisherName}"><xsl:value-of select="substring(Form/TrackLicense/Publisher/PublisherName,1,25)" />...</abbr>
              			</xsl:when>
              			<xsl:when test="normalize-space(Form/TrackLicense/PublisherID)">
              				<xsl:value-of select="Form/TrackLicense/Publisher/PublisherName" />
              			</xsl:when>
              			<xsl:otherwise>
              				(none)
              			</xsl:otherwise>
              		</xsl:choose>
          	    </div>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="adminField">
        <tr>
      	    <td class="leftCol">Admin:</td>
      	    <td class="readOnlyCol">
      		    <span id="PublisherAdmin">
                    <xsl:if test="Form/TrackLicense/PublisherDirect = 1">
                        <xsl:attribute name="class">subtle</xsl:attribute>
                    </xsl:if>
			        <xsl:value-of select="Form/TrackLicense/Publisher/AdminName" />
      		    </span>
      	    </td>
        </tr>
    </xsl:template>


    <xsl:template name="agentField">
        <tr>
      	    <td class="leftCol">Agent:</td>
      	    <td class="readOnlyCol">
      		    <span id="PublisherAgent">
                    <xsl:if test="Form/TrackLicense/PublisherDirect = 1">
                        <xsl:attribute name="class">subtle</xsl:attribute>
                    </xsl:if>
			        <xsl:value-of select="Form/TrackLicense/Publisher/AgentName" />
      		    </span>
      	    </td>
        </tr>
    </xsl:template>


    <xsl:template name="directField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_PublisherDirect">Publisher Direct:</label></td>
            <td>
                <input type="checkbox" name="Trigger_Form_TrackLicense_PublisherDirect" value="1" onClick="checkCheckBox(this,'Form_TrackLicense_PublisherDirect'); toggleAdminAgent(this);">
                    <xsl:if test="Form/TrackLicense/PublisherDirect = 1">
                        <xsl:attribute name="checked">checked</xsl:attribute>
                    </xsl:if>
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>
                <input type="hidden" name="Form_TrackLicense_PublisherDirect" id="Form_TrackLicense_PublisherDirect">
                    <xsl:if test="Form/TrackLicense/PublisherDirect = 1">
                        <xsl:attribute name="value">1</xsl:attribute>
                    </xsl:if>
                </input>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="issuerLicenseField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_IssuerLicenseID">Issuer License ID:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/IssuerLicenseID</xsl:with-param>
                    <xsl:with-param name="displayName">Issuer License ID</xsl:with-param>
                </xsl:call-template>
                <input type="text" name="Form_TrackLicense_IssuerLicenseID" id="Form_TrackLicense_IssuerLicenseID" value="{Form/TrackLicense/IssuerLicenseID}">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="issuerSongField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_IssuerSongID">Issuer Song ID:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/IssuerSongID</xsl:with-param>
                    <xsl:with-param name="displayName">Issuer Song ID</xsl:with-param>
                </xsl:call-template>
                <input type="text" name="Form_TrackLicense_IssuerSongID" id="Form_TrackLicense_IssuerSongID" value="{Form/TrackLicense/IssuerSongID}">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="crossedField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_CrossCollateralized">Crossed:</label></td>
            <td>
                <select name="Form_TrackLicense_CrossCollateralized" id="Form_TrackLicense_CrossCollateralized">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
			        <option value="0">No</option>
					<option value="1">
                        <xsl:if test="Form/TrackLicense/CrossCollateralized = 1">
						    <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
					    Yes
					</option>
                </select>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="statusField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_Inactive">Status:</label></td>
            <td>
                <select name="Form_TrackLicense_Inactive" id="Form_TrackLicense_Inactive">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
			        <option value="0">Active</option>
				    <option value="1">
                        <xsl:if test="Form/TrackLicense/Inactive = 1">
					        <xsl:attribute name="selected">selected</xsl:attribute>
	                    </xsl:if>
					    Inactive
				    </option>
                </select>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="dateSentField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_DateSent">Date Sent:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/DateSent</xsl:with-param>
                    <xsl:with-param name="displayName">Date Sent</xsl:with-param>
                </xsl:call-template>
                <span id="Form_TrackLicense_DateSent_TD">
                    <xsl:variable name="dateSentPath">Form/TrackLicense/DateSent</xsl:variable>
                    <input type="text" class="dateField" name="Form_TrackLicense_DateSent" id="Form_TrackLicense_DateSent" value="{dyn:evaluate($dateSentPath)}">
                        <xsl:if test="$lockedRecord = 1">
                            <xsl:attribute name="disabled">disabled</xsl:attribute>
                        </xsl:if>
                    </input>
                </span>
                <xsl:if test="$lockedRecord = 0">
                    <a title="Select Date Sent">
                        <img src="/production/images/icons/office/Calendar-(16x16).gif" height="16" width="16" class="calendarIcon" id="calendarIconDateSent"/>
                    </a>
				    <xsl:call-template name="calendar">
					    <xsl:with-param name="fieldID">Form_TrackLicense_DateSent</xsl:with-param>
					    <xsl:with-param name="buttonID">calendarIconDateSent</xsl:with-param>
					</xsl:call-template>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="dateReceivedField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_DateReceived">Date Received:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/DateReceived</xsl:with-param>
                    <xsl:with-param name="displayName">Date Received</xsl:with-param>
                </xsl:call-template>
                <span id="Form_TrackLicense_DateReceived_TD">
                    <xsl:variable name="dateReceivedPath">Form/TrackLicense/DateReceived</xsl:variable>
                    <input type="text" class="dateField" name="Form_TrackLicense_DateReceived" id="Form_TrackLicense_DateReceived" value="{dyn:evaluate($dateReceivedPath)}">
                        <xsl:if test="$lockedRecord = 1">
                            <xsl:attribute name="disabled">disabled</xsl:attribute>
                        </xsl:if>
                    </input>
                </span>
                <xsl:if test="$lockedRecord = 0">
                    <a title="Select Date Received">
                        <img src="/production/images/icons/office/Calendar-(16x16).gif" height="16" width="16" class="calendarIcon" id="calendarIconDateReceived" />
          	        </a>
    			    <xsl:call-template name="calendar">
    			        <xsl:with-param name="fieldID">Form_TrackLicense_DateReceived</xsl:with-param>
    				    <xsl:with-param name="buttonID">calendarIconDateReceived</xsl:with-param>
    		        </xsl:call-template>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="dateIssuedField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_DateIssued">Date Issued:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/DateIssued</xsl:with-param>
                    <xsl:with-param name="displayName">Date Issued</xsl:with-param>
                </xsl:call-template>
                <span id="Form_TrackLicense_DateIssued_TD">
                    <xsl:variable name="dateIssuedPath">Form/TrackLicense/DateIssued</xsl:variable>
                    <input type="text" class="dateField" name="Form_TrackLicense_DateIssued" id="Form_TrackLicense_DateIssued" value="{dyn:evaluate($dateIssuedPath)}">
                        <xsl:if test="$lockedRecord = 1">
                            <xsl:attribute name="disabled">disabled</xsl:attribute>
                        </xsl:if>
                    </input>
                </span>
                <xsl:if test="$lockedRecord = 0">
                    <a title="Select Date Issued">
                        <img src="/production/images/icons/office/Calendar-(16x16).gif" height="16" width="16" class="calendarIcon" id="calendarIconDateIssued" />
                    </a>
				    <xsl:call-template name="calendar">
					    <xsl:with-param name="fieldID">Form_TrackLicense_DateIssued</xsl:with-param>
						<xsl:with-param name="buttonID">calendarIconDateIssued</xsl:with-param>
					</xsl:call-template>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="termStartField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_TermStart">Term Start:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/TermStart</xsl:with-param>
                    <xsl:with-param name="displayName">Term Start</xsl:with-param>
                </xsl:call-template>
                <span id="Form_TrackLicense_TermStart_TD">
                    <xsl:variable name="termStartPath">Form/TrackLicense/TermStart</xsl:variable>
                    <input type="text" class="dateField" name="Form_TrackLicense_TermStart" id="Form_TrackLicense_TermStart" value="{dyn:evaluate($termStartPath)}">
                        <xsl:if test="$lockedRecord = 1">
                            <xsl:attribute name="disabled">disabled</xsl:attribute>
                        </xsl:if>
                    </input>
                </span>
                <xsl:if test="$lockedRecord = 0">
                    <a title="Select Term Start">
                        <img src="/production/images/icons/office/Calendar-(16x16).gif" height="16" width="16" class="calendarIcon" id="calendarIconTermStart" />
                    </a>
					<xsl:call-template name="calendar">
						<xsl:with-param name="fieldID">Form_TrackLicense_TermStart</xsl:with-param>
						<xsl:with-param name="buttonID">calendarIconTermStart</xsl:with-param>
					</xsl:call-template>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="termEndField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_TermEnd">Term End:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/TermEnd</xsl:with-param>
                    <xsl:with-param name="displayName">Term End</xsl:with-param>
                </xsl:call-template>
                <span id="Form_TrackLicense_TermEnd_TD">
                    <xsl:variable name="termEndPath">Form/TrackLicense/TermEnd</xsl:variable>
                    <input type="text" class="dateField" name="Form_TrackLicense_TermEnd" id="Form_TrackLicense_TermEnd" value="{dyn:evaluate($termEndPath)}">
                        <xsl:if test="$lockedRecord = 1">
                            <xsl:attribute name="disabled">disabled</xsl:attribute>
                        </xsl:if>
                    </input>
                </span>
                <xsl:if test="$lockedRecord = 0">
                    <a title="Select Term End">
                        <img src="/production/images/icons/office/Calendar-(16x16).gif" height="16" width="16" class="calendarIcon" id="calendarIconTermEnd" />
                    </a>
				    <xsl:call-template name="calendar">
					    <xsl:with-param name="fieldID">Form_TrackLicense_TermEnd</xsl:with-param>
						<xsl:with-param name="buttonID">calendarIconTermEnd</xsl:with-param>
				    </xsl:call-template>
                </xsl:if>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="rateTypeField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_RateType">*Rate Type:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/RateType</xsl:with-param>
                    <xsl:with-param name="displayName">Rate Type</xsl:with-param>
                </xsl:call-template>
                <xsl:if test="normalize-space(Form/TrackLicense/RateType)">
                    <script type="text/javascript">
                        <xsl:choose>
                            <xsl:when test="Form/TrackLicense/RateType = 3">
                                requireField('Form_TrackLicense_PennyRate','Penny Rate must be entered.<br />');
                            </xsl:when>
                            <xsl:otherwise>
                                requireField('Form_TrackLicense_RateBasis','Rate Basis must be selected.<br />');
                                requireField('Form_TrackLicense_RatePercentage','Rate Percent cannot be blank.<br />');
                            </xsl:otherwise>
                        </xsl:choose>
                    </script>
                </xsl:if>
                <select name="Form_TrackLicense_RateType" id="Form_TrackLicense_RateType" onChange="checkLicenseRateType(this);">
                    <xsl:if test="$lockedRecord = 1 or ($cmd != 'copy' and Form/TrackLicense/InUse = 1)">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                    <option value="">Choose...</option>

                    <xsl:if test="$licenseType = 'license'">
                        <option value="1">
                            <xsl:if test="Form/TrackLicense/RateType = 1">
                                <xsl:attribute name="selected">selected</xsl:attribute>
                            </xsl:if>
                            <xsl:value-of select="$licenseCountry" /> Stat Rate
                        </option>
                        <option value="2">
                            <xsl:if test="Form/TrackLicense/RateType = 2">
                                <xsl:attribute name="selected">selected</xsl:attribute>
                            </xsl:if>
                            <xsl:value-of select="$licenseCountry" /> Minimum Stat
                        </option>
                    </xsl:if>

                    <xsl:if test="$licenseType = 'ringtone'">
                        <option value="1">
                            <xsl:if test="Form/TrackLicense/RateType = 1">
                                <xsl:attribute name="selected">selected</xsl:attribute>
                            </xsl:if>
                            <xsl:value-of select="$licenseCountry" /> Ring Rate
                        </option>
                    </xsl:if>

                    <option value="3">
                        <xsl:if test="Form/TrackLicense/RateType = 3">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
					    Penny Rate (<xsl:value-of select="$licenseCurrency" />)
                    </option>
                </select>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="ratePercentField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_RatePercentage">*Rate Percent:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/RatePercentage</xsl:with-param>
                    <xsl:with-param name="displayName">Rate Percent</xsl:with-param>
                </xsl:call-template>
                <input type="text" class="percentField" name="Form_TrackLicense_RatePercentage" id="Form_TrackLicense_RatePercentage" value="{Form/TrackLicense/RatePercentage}">
                    <xsl:if test="$lockedRecord = 1 or Form/TrackLicense/RateType = 3 or ($cmd != 'copy' and Form/TrackLicense/InUse = 1)">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>%
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="rateBasisField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_RateBasis">*Rate Basis:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/RateBasis</xsl:with-param>
                    <xsl:with-param name="displayName">Rate Basis</xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/LockDate</xsl:with-param>
                    <xsl:with-param name="displayName">Lock Date</xsl:with-param>
                </xsl:call-template>
                <select name="Form_TrackLicense_RateBasis" id="Form_TrackLicense_RateBasis" onChange="checkLicenseRateBasis(this);">
                    <xsl:if test="$lockedRecord = 1 or Form/TrackLicense/RateType = 3 or ($cmd != 'copy' and Form/TrackLicense/InUse = 1)">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                    <option value="">Choose...</option>
                    <option value="2">
                        <xsl:if test="Form/TrackLicense/RateBasis = 2">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
                        Lock Date
                    </option>
                    <option value="1">
                        <xsl:if test="Form/TrackLicense/RateBasis = 1">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
                        Sales Date
                    </option>
                </select>
                <xsl:variable name="disableLockDate">
                    <xsl:if test="$lockedRecord = 1 or Form/TrackLicense/RateBasis != 2 or Form/TrackLicense/RateBasis = '' or Form/TrackLicense/RateType = 3 or ($cmd != 'copy' and Form/TrackLicense/InUse = 1)">1</xsl:if>
	            </xsl:variable>
			    <span id="lockDate">
			        <label for="Form_TrackLicense_LockDate">Lock Date:</label>
	                <input type="text" class="dateField" name="Form_TrackLicense_LockDate" id="Form_TrackLicense_LockDate" value="{Form/TrackLicense/LockDate}">
	                    <xsl:if test="$disableLockDate = 1">
	                        <xsl:attribute name="disabled">disabled</xsl:attribute>
	                    </xsl:if>
	                </input>
	                <xsl:if test="$lockedRecord = 0">
	                    <a title="Select Lock Date">
	                        <img src="/production/images/icons/office/Calendar-(16x16).gif" height="16" width="16" class="calendarIcon" id="calendarIconLockDate">
	                	        <xsl:if test="$disableLockDate = 1">
	                		        <xsl:attribute name="class">hidden</xsl:attribute>
	              		        </xsl:if>
	              	        </img>
	                    </a>
    					<xsl:call-template name="calendar">
    						<xsl:with-param name="fieldID">Form_TrackLicense_LockDate</xsl:with-param>
    						<xsl:with-param name="buttonID">calendarIconLockDate</xsl:with-param>
    					</xsl:call-template>
	                </xsl:if>
                </span>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="pennyRateField">
        <tr>
            <td class="leftCol">
                <label for="Form_TrackLicense_PennyRate">*Penny Rate (<xsl:value-of select="$licenseCurrency" />)</label>
            </td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/PennyRate</xsl:with-param>
                    <xsl:with-param name="displayName">Penny Rate</xsl:with-param>
                </xsl:call-template>
                <input type="text" class="rateField" name="Form_TrackLicense_PennyRate" id="Form_TrackLicense_PennyRate" value="{Form/TrackLicense/PennyRate}">
                    <xsl:if test="Form/TrackLicense/RateType != '3' or $lockedRecord = 1 or ($cmd != 'copy' and Form/TrackLicense/InUse = 1)">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>
                <xsl:call-template name="helpIcon">
                    <xsl:with-param name="tip">Share percentage is not included in penny rate mechanical license calculations.</xsl:with-param>
                </xsl:call-template>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="reserveField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_ReservePercentage">Reserve Percent:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/ReservePercentage</xsl:with-param>
                    <xsl:with-param name="displayName">Reserve Percentage</xsl:with-param>
                </xsl:call-template>
                <input type="text" class="percentField" name="Form_TrackLicense_ReservePercentage" id="Form_TrackLicense_ReservePercentage" value="{Form/TrackLicense/ReservePercentage}">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>%
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="liquidationScheduleFields">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_ReserveLiquidation">Liquidation Schedule:</label></td>
            <td class="liquidation">
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/ReserveLiquidationList</xsl:with-param>
                    <xsl:with-param name="displayName">Liquidation Schedule</xsl:with-param>
                </xsl:call-template>
                <xsl:call-template name="liquidationSchedule">
                    <xsl:with-param name="liquidationPrefix">Form_TrackLicense_ReserveLiquidationList_ReserveLiquidation_</xsl:with-param>
                    <xsl:with-param name="liquidationList" select="Form/TrackLicense/ReserveLiquidationList/ReserveLiquidation" />
                    <xsl:with-param name="liquidationID" select="Form/TrackLicense/TrackLicenseID" />
                    <xsl:with-param name="lockedRecord" select="$lockedRecord" />
                </xsl:call-template>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="digitalReservesField">
        <xsl:variable name="productTypeID" select="Form/TrackLicense/ProductTypeID" />
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_DigitalReservesEnabled">Digital Reserves:</label></td>
            <td class="containsCheckBox">
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/DigitalReservesEnabled</xsl:with-param>
                    <xsl:with-param name="displayName">Digital Reserve</xsl:with-param>
                </xsl:call-template>
                <input type="checkbox" class="checkbox" name="Trigger_Form_TrackLicense_DigitalReservesEnabled" id="Trigger_Form_TrackLicense_DigitalReservesEnabled" onClick="checkCheckBox(this,'Form_TrackLicense_DigitalReservesEnabled')">
                    <xsl:if test="Form/TrackLicense/DigitalReservesEnabled = 1">
                        <xsl:attribute name="checked">checked</xsl:attribute>
                    </xsl:if>
                    <xsl:if test="$openRuns = 1 or ($productTypeID != '' and $productTypeID != 3 and $productTypeID != 4 and $productTypeID != 254)">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>
                <input type="hidden" name="Form_TrackLicense_DigitalReservesEnabled" id="Form_TrackLicense_DigitalReservesEnabled" value="{Form/TrackLicense/DigitalReservesEnabled}" />
                <xsl:call-template name="helpIcon">
                    <xsl:with-param name="tip">Checking this box allows you to apply reserves to digital download sales.</xsl:with-param>
                </xsl:call-template>
            </td>
        </tr>
    </xsl:template>
    

    <xsl:template name="salesPercentField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_PercentageOfSales">*Percent of Sales:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/PercentageOfSales</xsl:with-param>
                    <xsl:with-param name="displayName">Percent of Sales</xsl:with-param>
                </xsl:call-template>
                <input type="text" class="percentField" name="Form_TrackLicense_PercentageOfSales" id="Form_TrackLicense_PercentageOfSales" value="{Form/TrackLicense/PercentageOfSales}">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>%
                <xsl:call-template name="helpIcon">
                    <xsl:with-param name="tip">Sets percentage of sales that will be paid on.</xsl:with-param>
                </xsl:call-template>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="packagingField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_PackagingDeduction">Packaging:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/PackagingDeduction</xsl:with-param>
                    <xsl:with-param name="displayName">Packaging Deduction</xsl:with-param>
                </xsl:call-template>
                <input type="text" class="percentField" name="Form_TrackLicense_PackagingDeduction" id="Form_TrackLicense_PackagingDeduction" value="{Form/TrackLicense/PackagingDeduction}">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>%
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="freeGoodsField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_FreeGoods">Free Goods:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/FreeGoods</xsl:with-param>
                    <xsl:with-param name="displayName">Free Goods</xsl:with-param>
                </xsl:call-template>
                <input type="text" class="percentField" name="Form_TrackLicense_FreeGoods" id="Form_TrackLicense_FreeGoods" value="{Form/TrackLicense/FreeGoods}">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>%
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="miscField">
        <tr>
            <td class="leftCol"><label for="Form_TrackLicense_MiscDeduction">Misc Deduction:</label></td>
            <td>
                <xsl:call-template name="inlineError">
                    <xsl:with-param name="path">Form/TrackLicense/MiscDeduction</xsl:with-param>
                    <xsl:with-param name="displayName">Misc Deduction</xsl:with-param>
                </xsl:call-template>
                <input type="text" class="percentField" name="Form_TrackLicense_MiscDeduction" id="Form_TrackLicense_MiscDeduction" value="{Form/TrackLicense/MiscDeduction}">
                    <xsl:if test="$lockedRecord = 1">
                        <xsl:attribute name="disabled">disabled</xsl:attribute>
                    </xsl:if>
                </input>%
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="commentsField">
        <tr class="labelTop">
            <td class="leftCol">Comments:</td>
            <td>
                <textarea rows="6" cols="40" name="Form_TrackLicense_Comments"><xsl:if test="$lockedRecord &gt; 0"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:value-of select="Form/TrackLicense/Comments" /></textarea>
            </td>
        </tr>
    </xsl:template>


    <xsl:template name="submitButton">
        <input name="Submit" type="submit" id="submitButton">
            <xsl:attribute name="value">
                <xsl:choose>
                    <xsl:when test="$cmd = 'copy'">Copy</xsl:when>
                    <xsl:when test="normalize-space(Params/TrackLicenseID)">Update</xsl:when>
                    <xsl:when test="not(normalize-space(Params/TrackLicenseID))">Create</xsl:when>
                </xsl:choose>
            </xsl:attribute>
            <xsl:if test="($licenseType = 'ccomp' and Form/TrackLicense/NoValidRegion) or $lockedRecord = 1">
    	        <xsl:attribute name="disabled">disabled</xsl:attribute>
            </xsl:if>
        </input>
    </xsl:template>


    <xsl:template name="cancelButton">
        <xsl:if test="normalize-space(Form/TrackLicense/TrackLicenseID) and $cmd != 'copy'">
            <input name="deleteButton" type="button" value="Delete">
                <xsl:attribute name="onClick">
                    <xsl:choose>
                        <xsl:when test="Form/TrackLicense/Type = 2">
                            confirmDeleteControlledComp(<xsl:value-of select="Form/TrackLicense/TrackLicenseID" />)
                        </xsl:when>
                        <xsl:when test="Form/TrackLicense/Type = 4">
                            confirmDeletePublicDomain(<xsl:value-of select="Form/TrackLicense/TrackLicenseID" />)
                        </xsl:when>
                        <xsl:otherwise>
                            confirmDeleteLicense(<xsl:value-of select="Form/TrackLicense/TrackLicenseID" />)
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:attribute>
                <xsl:if test="Form/TrackLicense/Status != 1 or Form/TrackLicense/InUse = 1 or $lockedRecord = 1">
                    <xsl:attribute name="disabled">disabled</xsl:attribute>
                </xsl:if>
            </input>
            <xsl:if test="Form/TrackLicense/Status != 1 or Form/TrackLicense/InUse = 1">
                <xsl:call-template name="helpIcon">
                    <xsl:with-param name="tip">This license cannot be deleted.</xsl:with-param>
                </xsl:call-template>
            </xsl:if>
        </xsl:if>
        <input type="button" value="Return to Album">
            <xsl:attribute name="onClick">
                <xsl:choose>
                    <xsl:when test="Params/_inline">hideInlinePop()</xsl:when>
                    <xsl:otherwise>location.href='catalog?AlbumID=<xsl:value-of select="Form/Track/AlbumID" /><xsl:value-of select="Track/AlbumID" />&amp;c=show&amp;tab=<xsl:value-of select="$licenseTab" />'</xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
        </input>
    </xsl:template>



    <xsl:template name="licenseCopyTracks">
        <fieldset>
            <legend>Tracks</legend>
            <p>Select the track(s) that should receive a copy of this license.</p>
            <hr />
            <table class="singleColumn">
                <tr>
                    <td class="leftCol labelTop"><label for="TrackID">Tracks:</label></td>
                    <td>
                        <xsl:call-template name="inlineError">
                            <xsl:with-param name="path">TrackID</xsl:with-param>
                            <xsl:with-param name="displayName">Track</xsl:with-param>
                        </xsl:call-template>
                        <select name="TrackID" id="TrackID" multiple="multiple">
                            <xsl:if test="$lockedRecord = 1">
                                <xsl:attribute name="disabled">disabled</xsl:attribute>
                            </xsl:if>
                            <xsl:for-each select="TrackList/Track">
                                <xsl:if test="TrackID != /Root/Form/TrackLicense/TrackID">
                                    <option value="{TrackID}">
                                        <xsl:variable name="trackID" select="TrackID" />
                                        <xsl:for-each select="/Root/Params/TrackID">
                                            <xsl:if test=". = $trackID">
                                                <xsl:attribute name="selected">selected</xsl:attribute>
                                            </xsl:if>
                                        </xsl:for-each>
                                    (<xsl:value-of select="TrackOrder" />) <xsl:value-of select="Title" />
                                    </option>
                                </xsl:if>
                            </xsl:for-each>
                        </select>
                    </td>
                </tr>
            </table>
        </fieldset>
    </xsl:template>


</xsl:stylesheet>
