/*Event.observe(window, 'load', function(){
	var slideShowElement = $('slideshowimages');
	var images = $$('div#slideshowimages img');
	var current = 1;

	new PeriodicalExecuter(function(pe){		
		new Effect.Fade('slideshowimages', {
			duration: 1,			
			afterFinish: function(){				
				slideShowElement.innerHTML = "";
				slideShowElement.appendChild(images[current]);
				new Effect.Appear('slideshowimages', {
							duration: 1							
				});
				current = current+1;
				if(current>=images.length){
					current=0;
				}			
			}
		});
			
	}, 5);
});
*/

$j(document).ready(function() {
	var slideShowElement = $j('#slideshowimages');
	var images = $j('div#slideshowimages img');
	var current = 0;
	
	//images.hide();
	
	setInterval(function() {
		var $active = $j('#slideshowimages img.active');
	
	    if ( $active.length == 0 ) $active = $j('#slideshowimages img:last');
	
	    var $next =  $active.next().length ? $active.next() : $j('#slideshowimages img:first');
	
	    $active.addClass('last-active');
	
	    $next.css({opacity: 0.0})
	        .addClass('active')
	        .animate({opacity: 1.0}, 1000, function() {
	            $active.removeClass('active last-active');
	        });	
	}, 4000);
});

