Replaced inline JavaScript in wrapper

See #3838

Not sure if media/mod_wrapper is a good location for shared scripts. Alternative?
Please use the API to load scripts so they can potentially be overridden by templates.
Michael did an excellent blog post once on how to use the API. See http://www.babdev.com/blog/139-use-the-media-folder-allow-overridable-media