polyline encoding and decoding in javascript