placed javascript code into the template