<!--                                                                  -->
<!--  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:template name="songEditLayout">
      
    <form name="songEdit" id="songEdit" method="post">
      <xsl:choose>
        <xsl:when test="Params/_inline">
          <xsl:attribute name="action">#</xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="action">song</xsl:attribute>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:call-template name="songEdit" />
      <xsl:call-template name="buttons" />
      <xsl:call-template name="songEditHidden" />
    </form>

    <script type="text/javascript">
      validationSet = {
        'Form_Song_Title': {
        'regexp': /^.*$/,
        'errorBlank': 'Title cannot be blank.<br /> '
        }
      };
      window.validationSet = validationSet;
      fV.init();
      popValidation = 1;
      window.popValidation = popValidation;
      interceptSubmit = "collectFields('songEdit','song');";
      window.interceptSubmit = interceptSubmit;     
    </script>
    
  </xsl:template>

  <xsl:template name="songEditHidden">
    <xsl:if test="Params/_inline">
      <script type="text/javascript">
        fieldFocus("Form_Song_Title");
      </script>
      <input type="hidden" name="_inline" value="1" />
    </xsl:if>
    <input type="hidden" name="formSubmit" value="1" />
    <input type="hidden" name="c" value="edit" />
    <xsl:if test="normalize-space(Form/Song/SongID)">
      <input type="hidden" name="SongID" value="{Form/Song/SongID}" />
    </xsl:if>
    <xsl:if test="Form/SongID = ''">
      <input type="hidden" name="new" value="1" />
    </xsl:if>
  </xsl:template>

  <xsl:template name="songEdit">
    <div class="section">
      <fieldset>
				<legend>Song</legend>
	      <table>
	        <tr>
	          <td colspan="2">
	            Enter Song information here.<br />Master recordings linked to this song are listed below.
	            <hr />
	          </td>
	        </tr>
	        <tr>
	          <td colspan="2">
	            <xsl:call-template name="errorMessageGeneral" />
	          </td>
	        </tr>
	        <tr>
	          <td class="leftCol"><label for="Form_Song_Title">*Title:</label></td>
	          <td>
	            <xsl:call-template name="inlineError">
	              <xsl:with-param name="path">Form/Song/Title</xsl:with-param>
	              <xsl:with-param name="displayName">Title</xsl:with-param>
	            </xsl:call-template>
	            <input type="text" class="titleField" name="Form_Song_Title" id="Form_Song_Title" value="{Form/Song/Title}" />
	          </td>
	        </tr>
	        <tr>
	          <td class="leftCol"><label for="Form_Song_ComposerName">Composer:</label></td>
	          <td>
	            <xsl:call-template name="inlineError">
	              <xsl:with-param name="path">Form/Song/ComposerName</xsl:with-param>
	              <xsl:with-param name="displayName">Composer</xsl:with-param>
	            </xsl:call-template>
	           	<div> 
								<input id="Form_Song_ComposerName" name="Form_Song_ComposerName" type="text" class="artistNameField" value="{Form/Song/ComposerName}" /><xsl:text> </xsl:text><span id="noMatchComposerPop" class="yui-ac-warning"></span>
								<input type="hidden" name="Form_Song_ComposerID" id="Form_Song_ComposerID" value="{Form/Song/ComposerID}" />
								<div id="composerContainerPop"></div> 
			          <script type="text/javascript">
			              var composerCompPop = new YAHOO.widget.RSComposerAutoComplete("composerContainerPop","Form_Song_ComposerName", "Form_Song_ComposerID",
			               {
			                  "noMatchWarningID": "noMatchComposerPop"
			               }
			              );
			          </script> 
							</div>   	            
	          </td>
	        </tr>
	        <tr>
	          <td class="leftCol"><label for="Form_Song_ISWC">ISWC:</label></td>
	          <td>
	            <xsl:call-template name="inlineError">
	              <xsl:with-param name="path">Form/Song/ISWC</xsl:with-param>
	              <xsl:with-param name="displayName">ISWC</xsl:with-param>
	            </xsl:call-template>
	            <input type="text" class="iswcField" name="Form_Song_ISWC" id="Form_Song_ISWC" value="{Form/Song/ISWC}" />
	          </td>
	        </tr>
	        <tr>
	          <td colspan="2">
	            <br />*Required field
	          </td>
	        </tr>
	      </table>
      </fieldset>
      <br />
      <xsl:call-template name="mastersView" />
      <br /><br />
    </div>
  </xsl:template>

</xsl:stylesheet>

