First, thanks
joecamel and
revdiablo for your assistance.
I was mainly interested in finding an efficient algorithmic approach to the problem and the answers that both of you provided sufficed. I began coding and realized the problem was a bit more complicated than I originally expected. This is why the code I posted really didn't do anything. Hopefully I was finish tidying up the script over the weekend. I will keep you posted on my progress.
hok_si_la