Can you provide some of the code you've tried? (If it's very large, try carving it down to the salient functionality). The purpose of supplying this information is threefold -- first, it shows what you've tried or haven't tried; second, you may have a bug, or missed some subtle point which someone else can identify, and third, it gives those who might respond a starting point for thinking about a solution.