title: jQuery UI dialog z-index problems
body: <p>I am trying to get a dialog to appear over a dialog in jQuery. The problem that i'm having is when the top dialog is opened the z-indexes are wrong so the div with the class ui-widget-overlay appears behind the first dialog instead of behind the second dialog. </p>
  
  <p>Here is a breakdown of the z-indexes:</p>
  
  <p>I will refer to the first dialog opened as dialog#1 and the one opened on top of this as dialog#2 and the ui-widget-overlays as  ui-widget-overlay#1 and ui-widget-overlay#2 respectively. </p>
  
  <p>dialog#1 is opened and its z-index is set as 1 with ui-widget-overlay#1 z-index set as 0</p>
  
  <p>dialog#2 is opened and its z-index is set as 1 with ui-widget-overlay#2 z-index set as 0</p>
  
  <p>Then when i close dialog#2 and re open it, this time dialog#2 z-index is correctly set as 2 and ui-widget-overlay#2 is correctly set as 1</p>
  
  <p>Does anyone have any idea why this is happening, is there a jquery-ui setting I am missing to tell it to increment the z-indexes for subsequent dialogs? </p>
  
  <p><strong>Edit:</strong> 
  I also wanted to point out that i have set <code>stack:true</code> in the dialog options and it has made no difference. </p>