﻿/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch2() {
    var $active2 = $('#slideotzivy IMG.active');

    if ( $active2.length == 0 ) $active2 = $('#slideotzivy IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next2 =  $active2.next().length ? $active2.next()
        : $('#slideotzivy IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
       var $sibs2  = $active2.siblings();
       var rndNum2 = Math.floor(Math.random() * $sibs2.length );
       var $next2  = $( $sibs2[ rndNum2] );


    $active2.addClass('last-active');

    $next2.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 2000, function() {
            $active2.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch2()", 5000 );
});
