Nice attempt. You only need to fix this part:
setglobalvar("N1", Anim2);
setglobalvar("N2", Anim3;
setglobalvar("N3", Anim4);
setglobalvar("N4", Anim);
These lines shift stored chosen animation from second variable to first, third to second and fourth to third. The latest...