[#1004] Move Javascript to the Bottom of the Body

* Move all Javascript includes to the bottom of the base.html and
  mobile/base.html templates.
* Move extra_js blocks below main blocks in the pages/form.html and
  pages/gallery.html templates.

closes #1004: JS should be at the bottom of body