Sean Lange (12/9/2014)
Alan what you posted is almost exactly what I had envisioned. I refrained from posting simply because this seems so much like homework. Let's hope the OP reads this and understands what you did.
I was suspecting homework too ;-).
-- Itzik Ben-Gan 2001