As Dave said, give all the dialogs and openers common class names. You should initialise the dialog plugin, not change its options as the first call. If you keep the existing naming convention then you can calculate the ID of the dialog from the opener:
- $('.dialogClassName').dialog({autoOpen: false, width: 500, height: 400});
- $('.openerClassName').click(function() {
- $('#dialog' + this.id.replace('opener', '')).dialog('open');
- });