(function($) {var $what = $('#what'),	timeToRotate = 7000,	timeToFade = 1000,	pause = false,	waitingToRotate = false,	intervalID;$what.hover(	function() { pause = true; },	function() {		pause = false;		if (waitingToRotate) {			showNext();			clearInterval(intervalID);			intervalID = setInterval(showNext, timeToRotate);		}	});$.fn.nextLoop = function(selector) {	var next = this.next(selector);		return (next.length == 0)		? this.parent().children(selector).first()		: next;}function showNext() {	if (!pause) {		$('.show', $what)			.fadeOut(timeToFade, function() { /* Do this AFTER the current element is faded out. */				$(this)					.removeClass('show') /* */					.nextLoop('figure')						.hide()						.addClass('show')						.fadeIn(timeToFade);				;			})		;		waitingToRotate = false;	} else {		waitingToRotate = true;	}}intervalID = setInterval(showNext, timeToRotate);})(jQuery);
