waterbucket in javascript