Smarty Templates and javascript

At my work – we have a classifieds systems which leverages smarty templates.  From what I have seen – smarty templates are not too bad, but I ran into some trouble with them when I needed to add some javascript.  Here is a link to the code I used to …