I'm not sure, i dont use Smarty, but i think its not allowed to put "{" and "}" in a .tpl file with smarty. You need to save your javascript to a .js file and then load it in HTML with the Script tag like this:
PHP Code:
<script src="yourJsFile.js"></script>
✝ RiP ✝
Weiter geht's