move js to external file, add template tags