It's not really good coding standards to put if statement all on one line. Your problem seems to be here. Use semicolons. Even though they are not required it can save you hours of frustration without sometimes.
Ah so you have. Trying to help. I don't see anything else. If you're still having issues tomorrow I'll copy a paste your code and try it out. That's part of I don't like if's on one line. They can be hard to read.
A couple things came to mind.
Secondly, if it were me, I would put some alerts in your functions. Make sure they are getting executed and make sure you are getting a value back that you are expecting.