The variables will always be set as this if (!$did(*) ) is just broken. You need to read up on dialogs and many many other things before you post more snippets as the ones you have posted are broken and all have needed updates from you within a couple hours. Also when people try to help or give advice you seem to ignore them and move on with your bad snippets.