title: How to add JS to Drupal 7
body: <p>I want to add the <a href="https://github.com/Forrst/sap" rel="noreferrer">Forrst Sap</a> feature to a Drupal 7 website.</p>
  
  <p>Firstly, this involves adding the jquery.sap.js script to the site which I can do via my themes .info file. I understand I must replace that jQuery is now namespaced to avoid conflicts with other Javascript libraries such as Prototype. All your code that expects to use jQuery as $ should be wrapped in an outer context like so.</p>
  
  <pre><code>(function ($) {
    // All your code here
  }(jQuery));
  </code></pre>
  
  <p>But I'm unsure as to how to specify the Drupal behaviours for this code?</p>
  
  <p>Secondly, I must add the inline code:</p>
  
  <pre><code>$('#item').sap({
      distanceFromTheTop: 0
  });
  </code></pre>
  
  <p>I believe I can do this with drupal_add_js but again I'm not sure how to go about this through the template.php file?</p>
  
  <p>Thanks for your help!</p>