Cleanup

Take javascript script away from footer into its own file and tidy up
the code layout.