Restructure client-side code

Consists of breaking what was previously a single file for all client-side
code into seperate files, partitioned by application page.