// Simple jQuery Slideshow Script, Released by Jon Raasch (jonraasch.com), FreeBSD license.
function slideSwitch() {
    var $active = $('#slideshow div.active');
    if ($active.length == 0) $active = $('#slideshow div:last');
    // use this to pull the images in the order they appear in the markup
    var $next = $active.next().length ? $active.next()
        : $('#slideshow div:first');
    // uncomment the 3 lines below to pull the images in random order
    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 }, 1000, function() {
            $active.removeClass('active last-active');
        });
}
$(function () { setInterval("slideSwitch()", 4000); });

$(document).ready(function () {
    $("a[rel=nasca], a[rel=peru], a[rel=indien], a[rel=visuella], a[rel=taiwan]").fancybox({ 'padding': 0, 'titlePosition': 'over', 'overlayColor': '#000', 'overlayOpacity': 0.9, 'titleFormat': function (title, currentArray, currentIndex, currentOpts) { return '<span id="fancybox-title-over">' + (title.length ? ' &nbsp; ' + title : '') + ' [bild:' + (currentIndex + 1) + ' av ' + currentArray.length + ']</span>'; } });
    $("a[rel=bok_sociala], a[rel=bok_vagledning], a[rel=bok_vemarjag], a[rel=bok_nycklar]").fancybox({ 'padding': 0, 'titlePosition': 'outside', 'overlayColor': '#000', 'overlayOpacity': 0.9 });
});
