Fix possible bug with the API (in some browsers event variable is global)
Encode water files path to avoid problem with character encoding (firefox)