Dialog windows open conditionally

All of these dialog things are migrated to their new home, in their own `dialogs.js` file.