(function($) {
	$.fn.simpleSpy = function (limit, interval) {
		limit = limit || 4;
		interval = interval || 4000;

		return this.each(function() {
			// 1. setup
			// capture a cache of all the list items
			// chomp the list down to limit li elements
			var $list = $(this),
				items = [], // uninitialised
				currentItem = limit,
				total = 0, // initialise later on
				height = 20;

			// capture the cache
			$list.find('> li').each(function() {
				items.push('<li>' + $(this).html() + '</li>');
			});
			total = items.length;
			$list.wrap('<div class="spyWrapper"></div>').parent().css({ height : height * limit + 'em' });
			$list.find('> li').filter(':gt(' + (limit - 1) + ')').remove();

			// 2. effect
			function spy() {
				// insert a new item with opacity and height of zero
				var $insert = $(items[currentItem]).css({
					height : 0,
					opacity : 0,
					display : 'none'
				}).prependTo($list);

				// show a new item
				$insert.css({display : 'block'}).animate({ height : $(this).height(), opacity : 1 }, 1000,
					// fade the LAST item out
					function() {
						$list.find('> li:last').remove();
					}
				);

				currentItem++;
				if (currentItem >= total) {
					currentItem = 0;
				}
			}

			setInterval(spy, interval);
		});
	};
})(jQuery);

