making the dialog more dynamic

making the dialog more dynamic


Hi everyone,
I'm trying to make a dialog function that is dynamic, and it sort of
works, but there's a couple of problems. Here's the function:
function ShowAlert(DialogTitle, message, w, h){
    if(arguments.length <= 2){
        w = 300;
    }
    if(arguments.length <= 3){
        h = 100;
    }
    $("#genericDialog").text(message).dialog({
        modal: false,
        width:w,
        height:h,
        title:DialogTitle
    }).dialog("open");
    return;
}
... I then have a div in my body like so:
<div id="genericDialog" class="flora"></div>
What works about this function is that the text of the dialog *is*
changing dynamically. However, after I set the width and height and
the dialog title once, it seems that I can never change it!
For instance if I call the above function like this:
ShowAlert('MyTitle', 'The text of the alert', 500,500);
I get a nice 500x500 dialog box with "MyTitle" in the title bar and
"The text of the alert" in the content area.
If I subsequently, call that same function like this:
ShowAlert('A Different Title Than Before', 'Some other text',
300,100);
I get the same 500x500 dialog box with "MyTitle" in the title bar.
However, I do get "Some other text" in the content area of the dialog.
Am I missing something here? Why can't I tell my dialog each time what
I want the title to be, and what I want the width and height to be,
etc.?
Thanks,
Chris