Implemented JS functions for URL encoding and decoding