Javascript function to convert numbers to AP style. I think it works?