Mac OS X Applications Windows Stack Order
Going by what I see on my Mac, and looking at your examples, it seems pretty certain that the order is alphabetical.  

I would expect that if there were a way to specify a different ordering, it would be under the Options submenu, but alas, there is nothing of the sort there.