Just as an FYI for people who still have to support old platforms - if you run into some weird bugs in CS5.5 when using Math.min(), this could be why: for some reason Math.min() in CS5.5 only works with two parameters, not more. If you use more, the result appears to return the lowest of the last two values, completely ignoring the first!
Example:
var x = Math.min(6,3,7,5,4); $.writeln(x.toString());
will return 4! CS6 on the other hand will return 3, correctly.
So if you need to stay compatible to 5.5, make sure to use multiple two parameter Math.min() calls instead. (btw. it seems to work okay with Math.max()?)