moving js code out of html