Added option to wait for load to JSONloader

Wrapped the JSONLoader function in a anonymous function to avoid scope leak and also added the option *wait* to make the loader wait until window.load (useful for templates defined in the footer, e.g. twig.js)