In the template I import jquery, jqueryUI and java script code that creates a dialog.
The dialog shows up, and debug toolbar is visible but when I click on 'close' button of the dialog debug toolbar dissapears as well. Also when I click any panel nothing happens.
Thanks for the bug report. The situation you're reporting it quite complicated and would take a lot of effort to reproduce.
Could you either nail down the issue and provide a more concise description, or upload a test project somewhere to allow us to reproduce the problem ?