Moved all Javascipt functions for managing shared templates to scripts/shared.js.