
var enlace_cont;
var enlace_intervalo;
var enlace_anterior = 0;
var enlace_actual = 0;

$(document).ready(function(){
  enlace_cont = $("div.enlacejack").size();
  $("div.enlacejack:eq("+enlace_actual+")").css('top','0px');
  
  enlace_intervalo = setInterval(enlace_rotate,5000); //time in milliseconds
  $('#rotativojack').hover(function() {
    clearInterval(enlace_intervalo);
  }, function() {
    enlace_intervalo = setInterval(enlace_rotate,5000); //time in milliseconds
    enlace_rotate();
  });
});

function enlace_rotate() {
  enlace_actual = (enlace_anterior + 1) % enlace_cont; 
  $("div.enlacejack:eq(" + enlace_anterior + ")").animate({top: -275},"slow", function() {
    $(this).css('top','275px');
    });
  $("div.enlacejack:eq(" + enlace_actual + ")").show().animate({top: 0},"slow");  
  enlace_anterior = enlace_actual;
}