Throws exception when Permissions table is empty.
Blank database now populated with Permissions and ListItemStatuses.
Tidied up Javascript.