<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">

    <xsl:variable name="artist"><xsl:value-of select="/Root/Params/artist" /></xsl:variable>

    <xsl:variable name="labelID">
        <xsl:choose>
            <xsl:when test="/Root/Report/Label/LabelID">
                <xsl:value-of select="/Root/Report/Label/LabelID" />
            </xsl:when> 
            <xsl:otherwise>
                <xsl:value-of select="/Root/Params/label" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>

    <xsl:variable name="labelName">
        <xsl:choose>
            <xsl:when test="$labelID != ''">
                <xsl:value-of select="/Root/Report/Label/LabelName" />
            </xsl:when>
            <xsl:otherwise>
                All Labels
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>


    <xsl:variable name="period"><xsl:value-of select="/Root/Report/Period/PeriodID" /></xsl:variable>
    <xsl:variable name="periodType"><xsl:value-of select="translate(/Root/Report/Period/PeriodType, 'YQM','yqm')" /></xsl:variable>

	
	<!-- this sets the page title, both in the title tag and in the title area of the webpage.           -->
	<!-- this has grown a little out of control, but it would be challenging to change it at this point. -->
	<!-- it still loads very quickly, so we'll just live with it for now.                                -->

    <xsl:variable name="pageName">
		<xsl:choose>
			<xsl:when test="Root/Messages/Message/Code = 'access_denied' or $accessDenied = 1">Access Denied</xsl:when>
			<xsl:when test="$area = 'dashboard'">Dashboard</xsl:when>
	        <xsl:when test="$area = 'changepw'">Change Password</xsl:when>
  	        <xsl:when test="$area = 'login'">Login</xsl:when>
            <xsl:when test="$cmd = 'logout'">Logged Out</xsl:when>
	        <xsl:when test="$area = 'tracker'">
	            <xsl:choose>
  	                <xsl:when test="$cmd = 'notes' and not(Root/Params/sub_cmd)">View/Edit Notes</xsl:when>
    	            <xsl:when test="$cmd = 'edit_period' and not(Root/Params/sub_cmd)">Edit Period Name</xsl:when>
      	            <xsl:when test="$cmd = 'revenue'">Input Revenue</xsl:when>
	                <xsl:when test="$cmd = 'currency'">Currency Conversion</xsl:when>
                    <xsl:when test="$cmd = 'distributionfee'">Distribution Fee Entry</xsl:when>
  	                <xsl:when test="$cmd = 'finish'">Finish Import</xsl:when>
  	                <xsl:when test="$cmd = 'license_income'">Edit License Income</xsl:when>
  	                <xsl:when test="$cmd = 'show_license_income'">View License Income</xsl:when>
    	            <xsl:otherwise>Royalty Status Tracker</xsl:otherwise>
	            </xsl:choose>
  	        </xsl:when>
	        <xsl:when test="$area = 'matcher'">Resolve Exceptions</xsl:when>
  	        <xsl:when test="$action = 'streamRevenue'">Stream Revenue</xsl:when>
	        <xsl:when test="$action = 'finishImport'">Finish Import</xsl:when>
	        <xsl:when test="$area = 'user'">
				<xsl:choose>
					<xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/AppUser/UserID)">Edit User</xsl:when>
					<xsl:when test="$cmd = 'edit'">Add User</xsl:when>
      	            <xsl:when test="$cmd = 'show'">View User</xsl:when>
        	        <xsl:when test="$cmd = 'profile'">Edit Profile</xsl:when>
                    <xsl:when test="$cmd = 'changepw'">Change Password</xsl:when>
                    <xsl:when test="$cmd = 'import'">Import User</xsl:when>
                    <xsl:when test="$cmd = 'terms'">Master Software &amp; Services Subscription Agreement </xsl:when>
                    <xsl:when test="$cmd = 'view_terms'">View Subscription Agreement</xsl:when>
					<xsl:when test="$cmd = 'contact'">Contact RoyaltyShare</xsl:when>
					<xsl:otherwise>User List</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
    	    <xsl:when test="$area = 'reports' or $app = 'reports'">
      	        <xsl:choose>
					<xsl:when test="$view = 'sf'"><xsl:value-of select="/Root/Report/ProductInfo/ServiceName" /> - <xsl:value-of select="/Root/Report/ProductInfo/FormatName" /> Revenue </xsl:when>
        	        <xsl:when test="$view = 'fs'">Revenue By Format </xsl:when>
      	            <xsl:when test="$view = 'ss'">Revenue By Service </xsl:when>
    	            <xsl:when test="$view = 'gs'">Revenue By Country </xsl:when>
  	                <xsl:when test="$view = 'as'">Top Albums </xsl:when>
	                <xsl:when test="$view = 'ks'">Top Tracks </xsl:when>
        	        <xsl:when test="$view = 'rs'">Top Artists </xsl:when>
      	            <xsl:when test="$view = 'ls'">Top Labels </xsl:when>
    	            <xsl:when test="$view = 'f'"><xsl:value-of select="/Root/Report/ProductInfo/FormatName" /> Revenue </xsl:when>
  	                <xsl:when test="$view = 's'"><xsl:value-of select="/Root/Report/ProductInfo/ServiceName" />  Revenue </xsl:when>
	                <xsl:when test="$view = 'a'"><xsl:value-of select="/Root/Report/ProductInfo/AlbumName" /><xsl:text> </xsl:text></xsl:when>
      	            <xsl:when test="$view = 'k'"><xsl:value-of select="/Root/Report/ProductInfo/TrackName" /><xsl:text> </xsl:text></xsl:when>
    	            <xsl:when test="$view = 'r'"><xsl:value-of select="/Root/Report/ArtistInfo/ArtistName" /><xsl:text> </xsl:text></xsl:when>
  	                <xsl:otherwise>Digital Sales Dashboard </xsl:otherwise>
	            </xsl:choose>
    	        <xsl:if test="$country_code != '' and $view != 'gs'">- <xsl:value-of select="$country" />&#160;</xsl:if>
  	            <xsl:if test="$labelName != '' and $view != 'ls'">- <xsl:value-of select="$labelName" /></xsl:if>
	        </xsl:when>
    	    <xsl:when test="$area = 'workbench'">Work Bench</xsl:when>
	        <xsl:when test="$area = 'reference' and $cmd = 'statrates'">Stat Rates</xsl:when>
  	        <xsl:when test="$area = 'catalog'">
	            <xsl:choose>
	      	        <xsl:when test="$cmd = 'error_report'">Album Errors</xsl:when>
          	        <xsl:when test="$cmd = 'search'">Catalog Search</xsl:when>
          	        <xsl:when test="$cmd = 'search_track'">Catalog Search</xsl:when>
          	        <xsl:when test="$cmd = 'search_product'">Catalog Search</xsl:when>
          	        <xsl:when test="$cmd = 'search_no_image'">Missing Album Art</xsl:when>
          	        <xsl:when test="$cmd = 'search_no_audio'">Missing Audio Files</xsl:when>
          	        <xsl:when test="$cmd = 'search_no_metadata'">Missing/Invalid Metadata</xsl:when>
          	        <xsl:when test="/Root/Params/c = 'search_delivered'">Recently Delivered</xsl:when>
          	        <xsl:when test="/Root/Params/c = 'search_in_queue'">In queue for delivery</xsl:when>
          	        <xsl:when test="/Root/Params/c = 'search_dr'">Ready but not approved for delivery</xsl:when>
          	        <xsl:when test="$cmd = 'search_no_dr'">Not Ready for Distribution</xsl:when>
          	        <xsl:when test="$cmd = 'search_import'">Recently Imported</xsl:when>
          	        <xsl:when test="$cmd = 'search_duplicate'">Catalog Duplicate Search</xsl:when>
              	    <xsl:when test="$cmd = 'advance'">Catalog Advance</xsl:when>
                    <xsl:when test="$cmd = 'expense'">Catalog Expenses</xsl:when>
                    <xsl:when test="$cmd = 'expense_edit'">
	                    <xsl:if test="/Root/Params/PreProcess = 1 or /Root/Form/Expense/PreProcess = 1">Net Revenue Deduction</xsl:if>
  	                    <xsl:if test="/Root/Params/PreProcess = 0 or /Root/Form/Expense/PreProcess = 0">Expense</xsl:if>
                    </xsl:when>
                    <xsl:when test="$cmd = 'show' or $cmd = 'da_show'">View Album</xsl:when>
                    <xsl:when test="$cmd = 'show_contracts'">View Album Contracts</xsl:when>
                    <xsl:when test="$cmd = 'show_licenses'">View Album Licenses</xsl:when>
                    <xsl:when test="$cmd = 'da_edit'">Edit Tracks</xsl:when>
	                <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/Album/AlbumID)">Edit Album</xsl:when>
				    <xsl:when test="$cmd = 'list'">Catalog List</xsl:when>
				    <xsl:when test="$cmd = 'main'">Catalog Home</xsl:when>
  	                <xsl:otherwise>Add Album</xsl:otherwise>
                </xsl:choose>
            </xsl:when>
	        <xsl:when test="$area = 'product'">
	    	    <xsl:choose>
	    		    <xsl:when test="$cmd = 'edit_digital'">Edit Distribution Settings</xsl:when>
	    		    <xsl:when test="$cmd = 'edit_service'">Edit Delivery Settings</xsl:when>
	    		    <xsl:otherwise>Product Entry</xsl:otherwise>
	    	    </xsl:choose>
	        </xsl:when>
	        <xsl:when test="$area = 'master'">
  	            <xsl:choose>
    	            <xsl:when test="$cmd= 'search' or $cmd = 'list'">Master Search</xsl:when>
      	            <xsl:otherwise>Master Entry</xsl:otherwise>
	            </xsl:choose>
	        </xsl:when>
  	        <xsl:when test="$area = 'song'">
	            <xsl:choose>
  	                <xsl:when test="$cmd= 'search' or $cmd = 'list'">Song Search</xsl:when>
    	            <xsl:otherwise>Song Entry</xsl:otherwise>
      	        </xsl:choose>
	        </xsl:when>
	        <xsl:when test="$area = 'track'">
	            <xsl:choose>
	      	        <xsl:when test="$cmd = 'show'">View Track</xsl:when>
  	                <xsl:when test="$cmd = 'presubmit'">Duplicate Check</xsl:when>
    	            <xsl:when test="$cmd = 'expense'">Track Expenses</xsl:when>
      	            <xsl:when test="$cmd = 'expense_edit'">
        	            <xsl:if test="/Root/Params/PreProcess = 1 or /Root/Form/Expense/PreProcess = 1">Net Revenue Deduction</xsl:if>
          	            <xsl:if test="/Root/Params/PreProcess = 0 or /Root/Form/Expense/PreProcess = 0">Expense</xsl:if>
	                </xsl:when>
  	                <xsl:otherwise>Track Entry</xsl:otherwise>
    	        </xsl:choose>
	        </xsl:when>
	        <xsl:when test="$area = 'license' or $area = 'ca_license'">
	            <xsl:choose>
  	                <xsl:when test="$cmd= 'search' or $cmd = 'list'">License Search</xsl:when>
    	            <xsl:when test="$cmd = 'copy'">License Copy</xsl:when>
					<xsl:when test="$cmd = 'account'">License Transactions</xsl:when>
					<xsl:when test="$cmd = 'crossed_account'">Crossed License Transactions</xsl:when>
      	            <xsl:otherwise>License Entry</xsl:otherwise>
	            </xsl:choose>
  	        </xsl:when>
	        <xsl:when test="$area = 'mechanical'">
	            <xsl:choose>
          	    	<xsl:when test="$cmd = 'create'">Create New Royalty Run</xsl:when>
          	        <xsl:when test="$cmd = 'show'">United States Mechanical Royalty Statements - <xsl:value-of select="/Root/Payor/Name" /> - <xsl:value-of select="/Root/MechanicalRun/Label" /></xsl:when>
          	        <xsl:when test="$cmd = 'editpay'">Edit Payments - <xsl:value-of select="/Root/Form/Payor/Name" /> - <xsl:value-of select="/Root/Form/MechanicalRun/Label" /></xsl:when>
                    <xsl:when test="$cmd = 'payors'">Payor List</xsl:when>
            	    <xsl:otherwise>United States Mechanical Royalty Runs</xsl:otherwise>
      	        </xsl:choose> 
	        </xsl:when>
	        <xsl:when test="$area = 'ca_mechanical'">
	            <xsl:choose>
          	    	<xsl:when test="$cmd = 'create'">Create New Royalty Run</xsl:when>
          	        <xsl:when test="$cmd = 'show'">Canadian Mechanical Royalty Statements - <xsl:value-of select="/Root/Payor/Name" /> - (<xsl:value-of select="/Root/MechanicalRun/StartDate" /> - <xsl:value-of select="/Root/MechanicalRun/EndDate" />)</xsl:when>
          	        <xsl:when test="$cmd = 'editpay'">Edit Payments - <xsl:value-of select="/Root/Form/Payor/Name" /> - (<xsl:value-of select="/Root/Form/MechanicalRun/StartDate" /> - <xsl:value-of select="/Root/Form/MechanicalRun/EndDate" />)</xsl:when>
                    <xsl:when test="$cmd = 'payors'">Payor List</xsl:when>
            	    <xsl:otherwise>Canadian Mechanical Royalty Runs</xsl:otherwise>
      	        </xsl:choose> 
	        </xsl:when>	        
	        <xsl:when test="$area = 'artist_royalty'">
  	            <xsl:choose>
      	    	    <xsl:when test="$cmd = 'create'">Create New Royalty Run</xsl:when>
        	        <xsl:when test="$cmd = 'show'">Artist Royalty Statements - <xsl:value-of select="/Root/Payor/Name" /> - <xsl:value-of select="/Root/ArtistRoyaltyRun/Label" /></xsl:when>
    			    <xsl:when test="$cmd = 'editpay'">Edit Payments - <xsl:value-of select="/Root/Form/Payor/Name" /> - <xsl:value-of select="/Root/Form/ArtistRoyaltyRun/Label" /></xsl:when>
                    <xsl:when test="$cmd = 'payors'">Payor List</xsl:when>
          	        <xsl:otherwise>Artist Royalty Runs</xsl:otherwise>
	            </xsl:choose>
  	        </xsl:when>
	        <xsl:when test="$area = 'label_royalty'">
      	        <xsl:choose>
      	    	    <xsl:when test="$cmd = 'create'">Create New Royalty Run</xsl:when>
        	        <xsl:when test="$cmd = 'show'">Label Royalty Statements - <xsl:value-of select="/Root/Payor/Name" /> - <xsl:value-of select="/Root/LabelRoyaltyRun/Label" /></xsl:when>
    				<xsl:when test="$cmd = 'editpay'">Edit Payments - <xsl:value-of select="/Root/Form/Payor/Name" /> - <xsl:value-of select="/Root/Form/LabelRoyaltyRun/Label" /></xsl:when>
                    <xsl:when test="$cmd = 'payors'">Payor List</xsl:when>
          	        <xsl:otherwise>Label Royalty Runs</xsl:otherwise>
    	        </xsl:choose>
  	        </xsl:when>
	        <xsl:when test="$area = 'ccomp'">Controlled Composition Clause</xsl:when>
	        <xsl:when test="$area = 'artist_contract'">
	            <xsl:choose>
  	                <xsl:when test="$cmd = 'search'">Artist/Producer Contract Search</xsl:when>
      	            <xsl:when test="$cmd = 'region'">Artist/Producer Contract Regions</xsl:when>
        	        <xsl:when test="$cmd = 'deduction'">Artist/Producer Contract Deductions</xsl:when>
	                <xsl:when test="$cmd = 'term'">Artist/Producer Contract Terms</xsl:when>
  	                <xsl:when test="$cmd = 'unit_escalation'">Artist/Producer Contract Escalations</xsl:when>
    	            <xsl:when test="$cmd = 'expense'">Recoupable Expenses</xsl:when>
    	            <xsl:when test="$cmd = 'license_income'">License Income Sources</xsl:when>
      	            <xsl:when test="$cmd = 'show'">View Artist/Producer Contract</xsl:when>
      	            <xsl:when test="$cmd = 'edit' and /Root/Params/copy">Copy Artist/Producer Contract</xsl:when>
	                <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/ArtistContract/ArtistContractID)">Edit Artist/Producer Contract</xsl:when>
                    <xsl:when test="$cmd = 'main'">Artist/Producer Contract Home</xsl:when>
                    <xsl:when test="$cmd = 'list'">Artist/Producer Contract List</xsl:when>
  	                <xsl:otherwise>Add Artist/Producer Contract</xsl:otherwise>
    	        </xsl:choose>
	        </xsl:when>
	        <xsl:when test="$area = 'contract'">
	            <xsl:choose>
  	                <xsl:when test="$cmd = 'search'">Contract Search</xsl:when>
                    <xsl:when test="$cmd = 'main'">Contract Home</xsl:when>
    	        </xsl:choose>
	        </xsl:when>
	        <xsl:when test="$area = 'label_contract'">
	            <xsl:choose>
  	                <xsl:when test="$cmd = 'search'">Label Contract Search</xsl:when>
      	            <xsl:when test="$cmd = 'show'">View Label Contract</xsl:when>
      	            <xsl:when test="$cmd = 'edit' and /Root/Params/copy">Copy Label Contract</xsl:when>
	                <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/LabelContract/LabelContractID)">View Label Contract</xsl:when>
                    <xsl:when test="$cmd = 'main'">Label Contract Home</xsl:when>
                    <xsl:when test="$cmd = 'list'">Label Contract List</xsl:when>
  	                <xsl:otherwise>Add Label Contract</xsl:otherwise>
    	        </xsl:choose>
	        </xsl:when>
	        <xsl:when test="$area = 'artist_payee'">
	            <xsl:choose>
	      	        <xsl:when test="/Root/Params/_inline">Artist/Producer Payee Lookup</xsl:when>
  	                <xsl:when test="/Root/Params/Query">Artist/Producer Payee Search</xsl:when>
    	            <xsl:when test="$cmd = 'show'">View Artist/Producer Payee</xsl:when>
					<xsl:when test="$cmd = 'main'">Payee Home</xsl:when>
					<xsl:when test="$cmd = 'list'">Artist/Producer Payee List</xsl:when>
					<xsl:when test="$cmd = 'account'">Payor Transactions</xsl:when>
      	            <xsl:when test="$cmd= 'search' or $cmd = 'list'">Artist/Producer Payee List</xsl:when>
        	        <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/ArtistPayee/ArtistPayeeID)">Edit Artist/Producer Payee</xsl:when>
	                <xsl:otherwise>Add Artist/Producer Payee</xsl:otherwise>
  	            </xsl:choose>
	        </xsl:when>
	        <xsl:when test="$area = 'label_payee'">
	            <xsl:choose>
	      	        <xsl:when test="/Root/Params/_inline">Label Payee Lookup</xsl:when>
  	                <xsl:when test="/Root/Params/Query">Label Payee Search</xsl:when>
    	            <xsl:when test="$cmd = 'show'">View Label Payee</xsl:when>
					<xsl:when test="$cmd = 'main'">Label Payee Home</xsl:when>
					<xsl:when test="$cmd = 'list'">Label Payee List</xsl:when>
					<xsl:when test="$cmd = 'account'">Payor Transactions</xsl:when>
      	            <xsl:when test="$cmd= 'search' or $cmd = 'list'">Label Payee List</xsl:when>
        	        <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/LabelPayee/LabelPayeeID)">Edit Label Payee</xsl:when>
	                <xsl:otherwise>Add Label Payee</xsl:otherwise>
  	            </xsl:choose>
	        </xsl:when>
	        <xsl:when test="$area = 'payee'">Payee Home</xsl:when>
            <xsl:when test="$area = 'publisher'">
                <xsl:choose>
        	        <xsl:when test="/Root/Params/_inline">United States Publisher Lookup</xsl:when>
                    <xsl:when test="/Root/Params/Query">United States Publisher Search</xsl:when>
                    <xsl:when test="$cmd = 'show'">View United States Publisher</xsl:when>
                    <xsl:when test="$cmd = 'list_licenses' or $cmd = 'list_direct_licenses' or $cmd = 'list_indirect_licenses'">United States Publisher Licenses</xsl:when>
					<xsl:when test="$cmd = 'list' or $cmd= 'search'">United States Publisher List</xsl:when>
					<xsl:when test="$cmd = 'edit_direct'">Direct Payor Transactions</xsl:when>
					<xsl:when test="$cmd = 'edit_indirect'"><xsl:value-of select="$indirectPublisherType" /> Payor Transactions</xsl:when>
                    <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/Publisher/PublisherID)">Edit United States Publisher</xsl:when>
                    <xsl:otherwise>Add United States Publisher</xsl:otherwise>
                </xsl:choose>
            </xsl:when>
            <xsl:when test="$area = 'ca_publisher'">
                <xsl:choose>
        	        <xsl:when test="/Root/Params/_inline">Canadian Publisher Lookup</xsl:when>
                    <xsl:when test="/Root/Params/Query">Canadian Publisher Search</xsl:when>
                    <xsl:when test="$cmd = 'show'">View Canadian Publisher</xsl:when>
                    <xsl:when test="$cmd = 'list_licenses' or $cmd = 'list_direct_licenses' or $cmd = 'list_indirect_licenses'">Canadian Publisher Licenses</xsl:when>
					<xsl:when test="$cmd = 'list' or $cmd= 'search'">Canadian Publisher List</xsl:when>
					<xsl:when test="$cmd = 'edit_direct'">Direct Payor Transactions</xsl:when>
					<xsl:when test="$cmd = 'edit_indirect'"><xsl:value-of select="$indirectPublisherType" /> Payor Transactions</xsl:when>
                    <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/Publisher/PublisherID)">Edit Canadian Publisher</xsl:when>
                    <xsl:otherwise>Add Canadian Publisher</xsl:otherwise>
                </xsl:choose>
            </xsl:when>            
            <xsl:when test="$area = 'payor'">
                <xsl:choose>
                    <xsl:when test="/Root/Params/Query">Payor Search</xsl:when>
                    <xsl:when test="$cmd = 'show'">View Payor</xsl:when>
                    <xsl:when test="$cmd= 'search' or $cmd = 'list'">Payor List</xsl:when>
                    <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/Payor/PayorID)">Edit Payor</xsl:when>
                    <xsl:otherwise>Add Payor</xsl:otherwise>
                </xsl:choose>
            </xsl:when>
            <xsl:when test="$area = 'label'">
                <xsl:choose>
                    <xsl:when test="$cmd = 'show'">View Label</xsl:when>
                    <xsl:when test="$cmd= 'search' or $cmd = 'list'">Label List</xsl:when>
                    <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/Label/LabelID)">Edit Label</xsl:when>
                    <xsl:otherwise>Add Label</xsl:otherwise>
                </xsl:choose>
            </xsl:when>
			<xsl:when test="$area = 'statement'">
			    <xsl:choose>
			        <xsl:when test="$cmd = 'main'">Statement Home</xsl:when>
	                <xsl:when test="$cmd = 'show_mechanical' or $cmd = 'show_mechanical_pdf'">United States Mechanical Royalty Statement</xsl:when>
	                <xsl:when test="$cmd = 'show_ca_mechanical' or $cmd = 'show_ca_mechanical_pdf'">Canadian Mechanical Royalty Statement</xsl:when>
	                <xsl:when test="$cmd = 'show_uk_mechanical'">United Kingdom Mechanical Royalty Statement</xsl:when>
	                <xsl:when test="$cmd = 'show_artist'">Artist Royalty Statement</xsl:when>
	                <xsl:when test="$cmd = 'show_label'">Label Royalty Statement</xsl:when>
	            </xsl:choose>
	        </xsl:when>
  	        <xsl:when test="$area = 'region'">
	            <xsl:choose>
  	                <xsl:when test="$cmd = 'list'">Region List</xsl:when>
    	            <xsl:when test="$cmd = 'show'">View Region</xsl:when>
    	            <xsl:when test="$cmd = 'search' or $cmd = 'search_all'">Region Lookup</xsl:when>
      	            <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/Region/RegionID)">Edit Region</xsl:when>
	                <xsl:otherwise>Add Region</xsl:otherwise>
  	            </xsl:choose>
	        </xsl:when>
			<xsl:when test="$area = 'price'">
				<xsl:choose>
					<xsl:when test="$cmd = 'list'">Price List</xsl:when>
    	            <xsl:when test="$cmd = 'show'">View Price</xsl:when>
		  	        <xsl:when test="$cmd = 'edit' and normalize-space(/Root/Form/Price/PriceID)">Edit Price</xsl:when>
					<xsl:otherwise>Add Price</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
	        <xsl:when test="$area = 'service'">Manage Services</xsl:when>
      	    <xsl:when test="$area = 'permission'">
    		    <xsl:choose>
      	    	    <xsl:when test="$cmd = 'show'">Permissions Admin</xsl:when>
      		        <xsl:otherwise>Add Permission</xsl:otherwise>
    		    </xsl:choose>
      	    </xsl:when>
	        <xsl:when test="$area = 'display'">
        		<xsl:choose>
          	    	<xsl:when test="Root/Params/d = 'config'">Administrative Options</xsl:when>
            	  	<xsl:when test="Root/Params/d = 'add_contract'">Adding a New Contract</xsl:when>
              		<xsl:when test="Root/Params/d = 'statements'">Statements</xsl:when>
        		</xsl:choose>
    	    </xsl:when>
            <xsl:when test="$area = 'artist_statement_settings'">
                <xsl:choose>
                    <xsl:when test="$cmd = 'Edit'">Edit Statement Options</xsl:when>
                    <xsl:otherwise>Manage Statement Options</xsl:otherwise>
                </xsl:choose>
            </xsl:when>
    	    <xsl:when test="$area = 'jobqueue'">Job Queue</xsl:when>
    	    <xsl:when test="$area = 'joblog'">Job Log</xsl:when>
    	    <xsl:when test="$area = 'report'">
              <xsl:choose>
                  <xsl:when test="$cmd = 'list'">Reports</xsl:when>
                  <xsl:when test="$cmd = 'show'">
                    <xsl:choose>
                      <xsl:when test="/Root/Params/ReportID">
                        <xsl:text>View Report - </xsl:text>
                        <xsl:value-of select="/Root/Form/Report/Group" />: <xsl:value-of select="/Root/Form/Report/Type" />
                      </xsl:when>
                      <xsl:otherwise>
                        <xsl:text>Configure Report - </xsl:text>
                        <xsl:value-of select="/Root/Params/Group" />: <xsl:value-of select="/Root/Params/Type" />
                      </xsl:otherwise>
                    </xsl:choose>
                  </xsl:when>
                  <xsl:otherwise>Audit Report</xsl:otherwise>
              </xsl:choose>
          </xsl:when>
    	    <xsl:when test="$area = 'locale'">Locale Settings</xsl:when>
    	    <xsl:when test="$area = 'mcps'">MCPS Rates &amp; Settings</xsl:when>
            <xsl:when test="$area = 'distribution'">Import New Albums</xsl:when>
            <xsl:when test="$area = 'uk_mech'">
                <xsl:choose>
                    <xsl:when test="$cmd = 'edit_mcps_license'">Edit MCPS Product</xsl:when>
                    <xsl:when test="$cmd = 'show_mcps_license'">View MCPS Product</xsl:when>
                    <xsl:when test="$cmd = 'create'">Create New Royalty Run</xsl:when>
                    <xsl:when test="$cmd = 'list'">United Kingdom Mechanical Royalty Runs</xsl:when>
                    <xsl:when test="$cmd = 'show'">United Kingdom Mechanical Royalty Statements - <xsl:value-of select="/Root/Payor/Name" /> - Q<xsl:value-of select="/Root/UKMechanicalRun/Quarter" />&#160;<xsl:value-of select="/Root/UKMechanicalRun/Year" /></xsl:when>
                </xsl:choose>
            </xsl:when>   
            <xsl:when test="$area = 'mapface'">
                <xsl:choose>
                    <xsl:when test="$cmd = 'map'">Resolve Mapping Exceptions</xsl:when>
                    <xsl:otherwise>Importer Exception Mapping</xsl:otherwise>
                </xsl:choose>            
            </xsl:when>  
        </xsl:choose>
    </xsl:variable>

</xsl:stylesheet>

