Next
var min = 0, max = 3;
var current = min;
var isAsc = true;
function Next(){
if(isAsc){
if(current >= max){
current = max - 1;
isAsc = false;
}
else{
current ++;
}
}
else{
if(current <= min){
current = min + 1;
isAsc = true;
}
else{
current --;
}
}
}