My   
post  might be able to help you.  I was having the same problem with needing things to be global but the way to attach a dialog shown in the tutorial wasn't working.
I have a theory I'm going to try when I get home that might be a simpler approach but until then..