Why did you decide to include JavaScript in HTML template? Wouldn't it be better to do like in other XModules, where front-end code is placed in separate JavaScript files?