Why can I not define functions in jQuery's document.ready()?
<p>Functions come up as undefined if I place them in the document.ready() function:</p>

<pre><code>$(document).ready(function(){
  function foo()
  {
    alert('Bar');
  }
});

foo(); // Undefined
</code></pre>

<p>Why does this happen? I'm sure I'm just in need of some simple understanding :)</p>
