dialog close problem

dialog close problem

hi all,

I have an HTML page with a clickable object that performs an AJAX call. This call returns an XML object, in which one tag contains a string of JS commands, executed in turn by a setTimeout call with 100msec of delay.

The JS functions are, obviously, highly dependant on which file gets called by AJAX (it's not the same file everytime)

Now to the problem at hand:
The clickable object call opens a dialog, populated from the AJAX call, in which other clickable objects are present, which in turn set a value in the main form, perform an AJAX call, and then close the dialog.
The AJAX call gets executed every time, the value in the main form gets set every time, the dialog gets closed ONLY THE FIRST TIME. Every time the dialog gets populated from the second time on, while the contents is exactly the same, the clickable objects fail to close the dialog.

No errors are generated, only a series of warnings, primarily about CSS properties.
The dialog's "Cancel" button and its upper right "close" button, work as intended every time, but they seem "laggy" from the second time on. (p.s. the close button is the default one, and the cancel button do nothing else than running $(this).dialog('close'); )

thank you in advance for the help :)