Dialog windows open conditionally

And using it.