moved scripts back to template.js for ie8,9 issues