/*(function() {
	$.fn.slideshow = function(settings) {
		settings = $.extend({
			width: 	263,
			height: 263,
			animation: 1000,
			timeForOne: 5000,
			imagesContainer: $('body')
		}, settings);
		var imgs = settings.imagesContainer.find('img');
		return this.each(function() {
			var d1 = $(this).html('<div class="slideshow-wrap1"><div class="slideshow-wrap2"></div></div>')
			.find('div')
			.css({
				width: settings.width,
				height: settings.height
			}), d2 = d1.eq(1), d1 = d1.eq(0);
			var n = 0, m = 1;
			function next() {
				n++; m++;
				if (n > imgs.length - 1) n = 0;
				if (m > imgs.length - 1) m = 0;
				d1.css('background', 'url(' + imgs.eq(m).attr('src') + ') center center no-repeat');
				d2.css('background', 'url(' + imgs.eq(n).attr('src') + ') center center no-repeat').fadeOut(settings.animation, function() {
					d2.css('background', 'url(' +  imgs.eq(m).attr('src') + ') center center no-repeat').show();
				});
			}
			next();
			window.setInterval(next, settings.timeForOne);		
		});
	}
})(jQuery);

$(function() {
	$('#container').slideshow({
		imagesContainer: $('#data')
	});	
});*/





/*** 
    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 slideSwitch() {
    var $active = $('.slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('.slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('.slideshow IMG: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() {
	$('.slideshow img').css({"opacity":0});
	$('.slideshow img.active').css({"opacity":1});
    setInterval( "slideSwitch()", 5000 );
});
