I have a user macro that uses a AUI-dialog2 that has a (usermacro) script embedded. It seems that the script is duplicated/run twice - first when the page is loaded and second time when the dialog is shown.