JS code cleanup (more OOP goodness, hehe)

utils.try_int() handler to avoid undefined int errors on server