Maybe it should be closer to something like this:
myPage = myDoc.page.index(myDoc.selection);
Objects in CS5 have this great new scriptable property "parentPage", but with CS4 and earlier you are stuck to checking the type of the parent of your selection (which, in turn, may be just about anything -- a text frame, rectangle, group, table, and a lot of others). You can do this recursively, though; go up and up into the parent-chain until you find something of type "Document" (and your item was on the pasteboard), "Page", "Spread", or "Masterspread".
If you search this forum, you will find a number of approaches, notably one by Dave Saunders which I used for years, but there are other approaches possible as well.
Thank you, I did find it.