title: Load custom JS file dependent on backend module settings
body: <p>I want to add a custom JS file to my module only if an attribute ("yes/no") in the module backend settings is set to "yes".</p>
  
  <p>So far I have referenced my layout.xml file in the module config.xml like this:</p>
  
  <pre><code>&lt;frontend&gt;
      &lt;layout&gt;
          &lt;updates&gt;
              &lt;modulename&gt;
                  &lt;file&gt;modulename.xml&lt;/file&gt;
              &lt;/modulename&gt;
          &lt;/updates&gt;
      &lt;/layout&gt;
  &lt;/frontend&gt;
  </code></pre>
  
  <p>The layout.xml loads the .js file as expected. Though I would like to add a dependency similar to the ones in the system.xml file if that is possible:</p>
  
  <pre><code>&lt;sortby translate="label"&gt;
      &lt;label&gt;Sort by:&lt;/label&gt;
      &lt;frontend_type&gt;select&lt;/frontend_type&gt;
      &lt;sort_order&gt;40&lt;/sort_order&gt;
      &lt;show_in_default&gt;1&lt;/show_in_default&gt;
      &lt;show_in_website&gt;1&lt;/show_in_website&gt;
      &lt;show_in_store&gt;1&lt;/show_in_store&gt;
      &lt;source_model&gt;path/to_settings&lt;/source_model&gt;
      &lt;depends&gt;&lt;sortby&gt;1&lt;/sortby&gt;&lt;/depends&gt;
  &lt;/sortby&gt;
  </code></pre>
  
  <p>Anyway, how can I load a custom JS file dependent on the value of a backend settings field?</p>