Sorry, but nobody is going to want to read through that much unformatted code. I suggest you break your problem down into an SSCCE that shows the bare minimum. And don't forget the code tags.