var right=document.getElementsByClassName("right"),si=right.length,z=1;function turnRight(){if(si>=1)si--;else{function t(t){setTimeout((function(){right[t].style.zIndex="auto"}),300)}si=right.length-1;for(var i=0;i<right.length;i++)right[i].className="right",t(i),z=1}right[si].classList.add("flip"),z++,right[si].style.zIndex=z}function turnLeft(){if(si<right.length)si++;else{si=1;for(var t=right.length-1;t>0;t--)right[t].classList.add("flip"),right[t].style.zIndex=right.length+1-t}right[si-1].className="right",setTimeout((function(){right[si-1].style.zIndex="auto"}),350)}turnRight();