final String markupId = dialog.getMarkupId();
// using the contributor and the onDomReady Wicket helper handles the rare case that
// the dialog is visible and the user refreshes the backing page (possible as dialog is not modal!)
// so in that special case, this javascript is called at page load
// but in the usual Ajax request case, this behaves just like AjaxRequestTarget.appendJavascript()
add(new HeaderContributor(new IHeaderContributor() {
public void renderHead(IHeaderResponse response) {
response.renderOnDomReadyJavascript("var " + markupId + " = new YAHOO.widget.ResizeDialog('" + markupId + "', "
+ " { constraintoviewport : true }); "
+ markupId + ".render(); " + markupId + ".show();");
}