First, please use the code highlight tags (see the link in my signature entitled getting help). Second, that is way too much code for us to go through - I highly recommend creating an SSCCE that...