JavaScript for Templates