$(document).ready(function() {
  var change_buttons_on_submit = function() {};

  $("#password_change_button").click(function() { 
    $("#password_change_dialog").load( $(this).attr('rel'), 
      function() { // load remote content from its 'rel' attribute into hidden div
          $(this)
            .dialog({ // and recreate it with following options
                          title: "Change Password",
                          modal: true,
                          height: 500,  
                          width: 700,
                          bgiframe: true,
                          buttons: {
                              'Close': function() {
                              $(this).dialog('close'); }
                          },
                          close: function() { },
                          open: function() { $(this).hijack(change_buttons_on_submit)} /// This is where hijack() magic happens.
                  });
      });
  });
});