Updated html template to include init code as a script file, so can be included in javascript loading in templates.