Javascript that makes things metric or not metric