How can I define dialog once and use it in Add and Edit methods?

How can I define dialog once and use it in Add and Edit methods?

Hi everybody,


I have the following code in my Add button


  1.  $("#sform").dialog({
  2.         autoOpen: false,
  3.         show: "blind",
  4.         resizable: true,
  5.         width: 1200,
  6.         height: 750
  7.     });
  8.     $("#sform").dialog("open");

And I also have very similar (although not entirely working) code in the Edit button (the difference being that in Edit I try to Load different content into the form). For now my question is - how can I create a variable holding the definition of that dialog and how will I call open method using this variable? Thanks a lot in advance.