I know I can use the following to close the dialog box by clicking outside:
$('.ui-widget-overlay').click(function() { $("#dialog").dialog("close"); });
But how do I change this so it works for every dialog box, ie I want to say close any dialog box as we have multiple on a page and would be easier to have one line of code?