function slideSwitch() {
	
	var active = $('.mainpage_animation_images .active');
	if ( active.length == 0 ) active = $('.mainpage_animation_images IMG:last');
	
	var url = active.attr("data-link");
	
	// use this to pull the images in the order they appear in the markup
	var next =  active.next().length ? active.next() : $('.mainpage_animation_images IMG:first');

	active.addClass('last-active');
	
	next.css({opacity: 0.0})
		.addClass('active')
		.click(function() {
				//alert('Handler for .click(' +url+ ') called.');
				document.location = url;
			})
		.delay(slideDelay+200)
		.animate({opacity: 1.0}, animTime,
		function() {
			slideDelay = 3000;
			active.removeClass('active last-active');
			$(".mainpage_animation_images").append(active);
			slideSwitch();
		}
	);
	
	
}

var slideDelay = 1500;
var animTime = 2000;
