UI dialog and .load loading a page in div

UI dialog and .load loading a page in div

Hello everybody I have a problem with my UI when I use my dialog dialog IU its function perfectly normally.
But when I want to open my dialog IU in the external USING. Malfunctioning load its
During his march 1 clicks
But if I click a 2nd time I'll open the dialog that I opened on 1 click and open  my new dialog.
So if I click a 3rd time I bah 3 window (dialog UI) that opens
Its as if my. I load creates a loop while I remove. Load all works perfectly.
Here is my code
 
var $dialog = $('<div></div>')
$dialog
.load('index/edit/id/'+$(el).attr('name'+"#content")
.dialog({

autoOpen: false,
height: 400,
width: 550,
modal: true,
buttons: {
'Create an account': function() {
if (bValid) {
$("form#form_edit").submit();
$(this).dialog('close');
}
},
Cancel: function() {
$dialog.dialog('close');
}
},
close: function() {
allFields.val('').removeClass('ui-state-error');
}
});

$("a#edit").click(function() {
$dialog.dialog('open');
});