/**
 * @author me
 */

$(document).ready(function () {

    // Konfiguration
    var scrolltime = 500;      // Scrollgeschwindigkeit in ms
    var timeToWait = 4000;      // Wartezeit bis wieder gescrollt wird in ms
    var autoscrolling = true;   // Automatisch scrollen (true) oder nicht (false)
    
    if (autoscrolling == true) {
        // automatisch scrollen
        $('#teaser').infiniteCarousel(scrolltime).mouseover(function(){
            // autoscroll abschalten wenn die Maus über den Navigationselementen steht
            autoscrolling = true;
        }).mouseout(function(){
            // autoscroll aktivieren wenn die Maus nicht über den navigationselementen steht
            autoscrolling = true;
        });
        
        // automatisch zur nächsten Seite scrollen
        setInterval(function(){
            if (autoscrolling) {
                $('#teaser').trigger('next');
            }
        }, timeToWait);
    }else {
        // manuell scrollen
        $('#teaser').infiniteCarousel(scrolltime);
    }

});

