Moved Javascript to External File

Keeps code a little cleaner