﻿// AJAX functionality for jQuery-Cycle
(function ($) {
    $(document).ready(function () {
        // Activate and configure jquery Cycle (scroll direction, timeslots, stop on mouse over
        $(".cycle-container").cycle({
            fx: "scrollLeft",
            timeout: 16000,
            cleartypeNoBg: true,
            pager: ".paging-container",
            pagerAnchorBuilder: function (idx, slide) {
                return '<a href="#"></a>';
            },
            before: UpdatePagerText,
            pause: true,
            pauseOnPagerHover: false
        });
    })
})(jQuery);

// Updating functionality for cycle-pager
function UpdatePagerText(currSlideElement, nextSlideElement, options, forwardFlag) {
    if (jQuery(nextSlideElement).next().length > 0) {
        jQuery(".feature-label").html("<strong>Weiter:</strong> " + jQuery(nextSlideElement).next().find("h1").html());
    }
    else {
        var itm = jQuery(".cycle-container").children().get(0);
        jQuery(".feature-label").html("<strong>Weiter:</strong> " + jQuery(itm).find("h1").html());
    }
}

(function ($) {
    $(document).ready(function () {
        // Switch images from div-slideshow list
        $('.slideshow').cycle({
            fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        });
    })
})(jQuery);
