You only need {literal} tags if you're using curly brackets { and } in your javascript code. From what I see, you don't use any of these, so I guess your code would play without any {literal} tags just as well. Even if you were to use a couple of curly brackets, you could use {ldelim} and {rdelim} in their place, if that would save you some tags (and gain readability)
(The above apply for smarty 2)