let's move all this javascript to an external file, as well as any other js in this file can be move out