Added code to hanlde perl template toolkit tags [% %] in html and js

I have added js code to handle perl template toolkit tags http://template-toolkit.org/docs/manual/Syntax.html and using it for ~ 1 year, Its working fine. Please verify the code and tell me what I have to do further.