Move inner javascript code to external file