Sort zones in javascript