If you really want help, you will reduce this to the relevant snippet of code where your problem is and then ask a clear coherent question and description of your problem. No one is going to go through this mess to try and figure out what it is that you want to do.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012