Welcome to the Ranch! When posting code, please UseCodeTags (<- click that link). It will make it a lot easier to read. I also removed the duplicate post.
I tried looking at your code and it is just not readable in the state it is in now, and the question isn't very clear either. Could you re-post the code you are having trouble with (just the parts with the issue - and don't forget to UseCodeTags ;) )? Then restate the problem a different way?