jQuery.fn.setSlideshow = function($transition, $pause){
	var element = this[0] ;
	$(element).slideshow($transition);
    setInterval( function(){$(element).slideshow($transition)}, $pause );
}

jQuery.fn.slideshow = function($transition){
	var element = this[0] ;

    $active = $('img.active', element);
    if ( $active.length == 0 ) $active = $('img:last', element);

    $next =  ( $active.next().length ) ? $active.next() : $('img:first', element);

    $next.css({'opacity':1, 'z-index':9});
    $active.css({'z-index':10}).animate({opacity: 0},$transition);

    $active.removeClass('active');
    $next.addClass('active');
}
