how can i shorten the following ?

how can i shorten the following ?

how can i shorten the following

  1. $( "#dialog" ).dialog({ autoOpen: false });
  2. $( "#opener" ).click(function() {
  3.   $( "#dialog" ).dialog( "open" );
  4. });
  5. $( "#dialog" ).dialog( "option", "width", 500 );
  6. $( "#dialog" ).dialog( "option", "height", 400 );

  7. $( "#dialog2" ).dialog({ autoOpen: false });
  8. $( "#opener2" ).click(function() {
  9.   $( "#dialog2" ).dialog( "open" );
  10. });
  11. $( "#dialog2" ).dialog( "option", "width", 500 );
  12. $( "#dialog2" ).dialog( "option", "height", 400 );

  13. $( "#dialog3" ).dialog({ autoOpen: false });
  14. $( "#opener3" ).click(function() {
  15.   $( "#dialog3" ).dialog( "open" );
  16. });
  17. $( "#dialog3" ).dialog( "option", "width", 500 );
  18. $( "#dialog3" ).dialog( "option", "height", 400 );