// Escrito por Renato Martins 06/10/2011 - www.motionweb.com.br

(function( $ ){

	
	$.fn.mwslideshow = function(tempo_transicao, intervalo) {

		var Obj = $(this);

		var imgw = Obj.width();
		var imgh = Obj.height();
		
		Obj.children('ul').css({'position':'relative', 'float':'none',  'margin': 0, 'padding': 0, 'top': 0, 'left': 0, 'list-style': 'none'});

		Obj.children('ul').children('li').css({'position':'absolute', 'width':imgw, 'height':imgh, 'top': 0, 'left':0, 'z-index':8 }).hide();
		Obj.children('ul').children('li.active').css({'z-index':10 }).show();
		
		setInterval(function() {

			var Lista = Obj.children('ul').children('li');
			var Ativo = Obj.children('ul').children('li.active');
			var Proximo = 0;
			
				
			if (Ativo.next().index() > 0) Proximo = Ativo.next();
			else Proximo = Lista.eq(0); 
			

			    if (Ativo.children('img').attr('src') != Proximo.children('img').attr('src')) { /*Modificacao soh para o Sustentabilidade*/
					
					Proximo.fadeIn(tempo_transicao);
					Ativo.fadeOut(tempo_transicao, function(){
						$(this).css({'z-index':8 });
						$(this).removeClass('active');
						Proximo.css({'z-index':10 });
						Proximo.addClass('active');
					});
				
			    }


		}, intervalo);

 
	};

})( jQuery );


