You should be able to include the JS in the template, since it doesn't need to go in the head (actually having it towards the end of the page can help with loading times, since javascript is loaded synchronously and blocks parsing/rendering of the html)