$(document).ready(function() {
	
	//prepare all images to be wiped
	$("#rotatingImages img.text").css({ "clip" : "rect(0px, 0px, 200px, 0px)" });
	
	//start image rotation
	$('#rotatingImages').cycle({
		fx: 'fade',
		prev:   '#rotatingImagesPrevious' ,
		next:   '#rotatingImagesNext',
		after: onAfter
	});
	//event listener for 
	$("#rotatingImagesPause").click(function() {
		//pause / resume the slideshow
		$('#rotatingImages').cycle('toggle'); 
	});
});

function onAfter(curr, next, opts){
	
	var currentSlide = this;
	
	//set a timeout to undo the wipe
	setTimeout( function(){
			$(".text", currentSlide).animate({'clip':'rect(0px 0px 200px 0px)'}, 1000);
	}, 2000 );
	
	//wipe
	$(".text", this).animate({'clip':'rect(0px 800px 200px 0px)'}, 1000);
	
}// end function - onAfter

