use layout.tmpl with JS