OK... what exactly are you having trouble with? Do you have the code, and it's not working, or is something confusing? In order for us to help, we need the code. If you are looking for just the answer, then that is another Can Of Worms to NOT get into.
Don't know if this will be helpful since this conversation ended a while ago, but here ya go anyway