How close did you get?
I suggest the best way to get assistance on somethng like this from the
volunteers on this list is to show us the best thing you managed to come up
with on your own, and tell us which part of the requirements you weren't able
to fulfil.
Someone here may then be able to help you with the specific part you had
trouble with.
Asking for someone to come up with an entire solution to what is a pretty
complex question is just not appropriate for this type of support list (in my
opinion).
Antony.