(maint) Refactor all javascript according to best practices

Prior to this commit, all project javascript code was
interspersed through page templates. Badness.

This commit moves all example javascript code out of layout
templates and into the resources/ ... /js subdirectory in
accordance with w3 and puppet javascript best practices.