Yeah, sorry :/ it turns out it's not a simple as I was expecting. I will take a look at it, but I'm quite busy at the moment so it might be a little while.
In the meantime, in case you've made any forays into PHP already, I'll post you what I have for is_child() -- a function I wrote which checks whether one page is the child of another, specified page. It won't work on categories, but it might give you a few ideas:
http://pastebin.be/949/
Put the ID of the parent page to test in the first argument. You can also optionally supply the child's ID if you want to force it to check a specific ID:
is_child(645) -- is this a child of 645?
or
is_child(101, 167) -- is 167 a child of 101?
I'll take a look at it again over the next few days and see what I can come up with. Sounds like a useful plugin too, so watch this space :)