Category sort javascript