maintain dialog center with dynamic content

maintain dialog center with dynamic content

I have a dialog with the following
  1. $("#statusbox").dialog({
            autoOpen
    : false,
            bgiframe
    : true,
            modal
    : true,
            width
    : 'auto',
            height
    :'auto',
            title
    :"Check Order Status",
            buttons
    : {
               
    Find: function() {
                    get_status
    ();
               
    },
               
    Close: function() {
                    $
    (this).dialog('close');
               
    }
           
    }
       
    });




and when the user hits the find button it runs ajax and returns orders to the dialog and it get dynamically re-sized but it only extends the box down. Is there way to make the box extend up and down so that the dialog remains centered ?

also if there was enough content then it could potentially go beyond the bounds of the page so I would think I could use a max height to prevent that but what do I do if they re-size the window ?

I tried adding maxHeight: 500, and that didn't stop it from extending off the bottom


thanks for help
Mike