Moved JavaScript initialization into a separate template

This change will allow style authors to mess with the 'headInclude' template without breaking things.