Fix script loading before jQuery is loaded.

It seems that inline script blocks that have been deferred still execute
before the external dependencies that were deferred. By pushing this
back until the document load event is fired, jQuery is guaranteed to be
loaded.