moved javascript

Moved the javascript into its own file (long overdue for this).