
//variabler der skal kunne konfigures i webparten

//var random = false;       // Hvis 'true' kommer billederne i en tilfældig rækkefølge
//var interval = 2000;      // Interval mellem billedskift i millisekunder
//var transition = 500;    // Overgangstid i millisekunder
//var id = "slideshow";     // id'en på den div der indeholder billederne
//$(function () {
//    setInterval("slideSwitch()", interval);
//});


function slideSwitch(random, transition, id) {

    var $active = $('#' + id + ' IMG.active');

    if ($active.length == 0) $active = $('#' + id + ' IMG:last');

    var $next = $active.next().length ? $active.next()
        : $('#' + id + ' IMG:first');

    if (random == true) {
        var $sibs = $active.siblings();
        var rndNum = Math.floor(Math.random() * $sibs.length);
        var $next = $($sibs[rndNum]);
    }

    $active.addClass('last-active');

    $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, transition, function () {
            $active.removeClass('active last-active');
        });
}



