Added a dialog.ready method to add a handler after DOM has been updated