﻿var center = 2;
var max = 5;

$(document).ready(function() {

  $("#mover1").animate({ left: "-430px" }, { duration: 1 });
  $("#mover2").animate({ left: "0px" }, { duration: 1 });

  $(function() { 
    setInterval(function() {
      center++;

      if (center == max) { right = 1; left = max - 1; }
      else if (center > max) { left = max; center = 1; right = 2; }
      else { right = center + 1; left = center - 1; }

      $("#mover" + left).animate({ left: "-440px" }, { duration: 2000 });
      $("#mover" + center).animate({ left: "0px" }, { duration: 2000 });
      $("#mover" + right).animate({ left: "440px" }, { duration: 1 });
    }, 
    5000);
  });

});

