Just a thought but Smarty requires javascript to be inside "literal" tags...
{literal}
Your javascript here.
{/literal}
Also, sometimes there are problems if there is more than one script on the page. One solution is to put the javascript in a language variable and call it that way.
This thread explains it pretty well...
forum.x-cart.com/showthread.php?t=52351
Pay attention to the end of page 1, beginning of page 2.
Good Luck!