extending/subclassing ui widgets

extending/subclassing ui widgets

I suspect that I just don't "get" the jquery way yet. What I'd like to accomplish is to create a subclass of Dialog, but override some of the behavior. Specifically, I want it to not change the position on the page, and I want to change the close button to a pop-out button. I would also like to be able to pop it back in.

I have searched for the right way to subclass in jquery and just cannot find it, but I find plenty of stuff that says jquery makes extending easy. So... how?

I was thinking that something like
(function($){
  $.widget('ui.panel', $.extend({}, $.ui.dialog.prototype, {
     _init:function(){
       //what to call here to call dialog's constructor?
     },

     newmethod1:...

  }));
})(jQuery);


and I got that to at least do something(I had managed to call dialog's init, but I think it was the wrong way), but that something broke Dialog and did NOT provide any error messages.