Stack jQuery Dialog

Stack jQuery Dialog

I'm building a website using jQuery Dialog. I'm using 4 dialogs on one page using a stack. Now i need to know which one of the dialogs is on top of the stack, because i need to change the color of the title to red instead of black. The titles need to be black when not active. So only the dialog on top of the stack needs to be red.

I have done a few hours of research already but i cant find the awnser. Hopefully anyone can help me.