Moved the js to head from footer to fix deps in gallery page.