JQuery.UI Dialog opening several times

JQuery.UI Dialog opening several times

I have seen this weird behaviour, I don't know if someone has
experimented the same problem
when I try
$.ajax({
type:"POST",
url:"AvanceFotoUpload.aspx",
data: urlParams,
success: function(htmlContent){
jQuery("div[id*='pnlFotos']").empty();
jQuery("div[id*='pnlFotos']").append(htmlContent);
jQuery("div[id*='pnlFotos']").dialog('open');
jQuery("div[id*='pnlImageRealSize']").dialog('destroy');
jQuery("div[id*='pnlImageRealSize']").dialog({bgiframe:
true,autoOpen:false,resizable: true,width:400,height:400,stack:true,
modal: true
});
}
});
jQuery("div[id*='pnlImageRealSize']").dialog('open');
it is opening several times
I don't know if the problem can be that I'm defining the dialog inside
the AJAX call and every time the user go to that part it defines the
dialog again.
I will appreciate your help
--