I have the following test ASPX page:
try chaning $(function() { to $(document).ready(function() {
also check where it fails with some sort of javascript debugger opera got builtin and FireFox got FireBug..
I think that this is caused because you are calling:
dlg.parent().appendTo(jQuery('form:first'));
at the close callback. This will move the dialog. Why don't you call this immediately after creating the dialog?