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.
I cut and pasted your code into Notepad++ and tinkered with it a little. There is nothing wrong with your Javascript. I don't know what you are passing into it though.
A couple things came to mind.
First if you are passing a variable from an html input tag to Javascript, it is not going to come in as an integer. It will come in as a string and you have to use parseInt or parseFloat and convert it in order to do the numeric comparisons you are trying to do.
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.
Without seeing all the code (html, javascript and images), it's hard to recreate your problem. But, your javascript is syntactically correct.
Bookmarks