Move external javascript include out of template file

Fixes broken expansion of panels