﻿/* scroller orizzontale */

var refScrollerTimer = null;

//CHIAMARE LA FUNZIONE DI INIT PER AVVIARE LO SCROLLER ORIZZONTALE
function initHorizontalScroller() {
    $(".highLightBox").mouseenter(function() { clearTimeout(refScrollerTimer); });
    $(".highLightBox").mouseleave(function() { startHorizontalScroller(); });

    startHorizontalScroller();
}

function startHorizontalScroller() {
    var hlTimeScroll = 800;
    var hlTimeWait = 4000;
    var hlScroller = function() {
        refScrollerTimer = setTimeout(function() {
            $('.highLightBox .hlPageWrapper .hlPage:first').animate(
                    { marginLeft: '-605px' },
                    hlTimeScroll,
                    'easeInOutQuad',
                    function() { $(this).detach().appendTo('.highLightBox .hlPageWrapper').removeAttr('style'); });
            hlScroller();
        }, hlTimeWait);
    };

    hlScroller();
}
