I just wrote an answer but seems like i'm not that smart and that I
wrote it as response to author directly...
so here's only a quick solution (I hate writing same things 2
times).
The issue happens because of buggy parseInt().
Use: parseInt(someVar, 10), instead of just parseInt(someVar). That
way you specify the base for transformation to number and javascript
won't confuse the values like '08' or '09' for (non existing) octal 8
and octal 9.
Bye.