Functions come up as undefined if I place them in the document.ready() function:
foo(); // Undefined
Not sure why defining the function with in the scope of
ready() is important to you, but you can make it work by declaring
foo up front:
Obviously you can't call
foo() from the inline script immediately after
ready() because the
ready() code hasn't yet run, but you can call the function later on.
Just make sure that nothing can try to call
foo() before the
ready() code has run (or make the initial declaration of
foo() a harmless function).