That's not really how this works.

First off, that's way too much code for anybody to wade through. Boil your problem down to an SSCCE, and we'll go from there.
Secondly, you haven't even told us...