
(function($){$.fn.simpleSpy=function(options){return this.each(function(){var settings={'limit':4,'interval':4000,'height':50};if(options){$.extend(settings,options);}
var running=true;var $list=$(this);var items=[];var currentItem=settings.limit;var total=0;var height=settings.height;$list.find('> li').each(function(){items.push('<li>'+$(this).html()+'</li>');});total=items.length;if(currentItem>=total){currentItem=total-1;$list.wrap('<div class="spyWrapper" />').parent().css({height:height*total});}else{$list.find('> li').filter(':gt('+(settings.limit-1)+')').remove();$list.wrap('<div class="spyWrapper" />').parent().css({height:height*settings.limit});}
$list.hover(function(){running=false;},function(){running=true;});function spy(){if(running){var $insert=$(items[currentItem]).css({height:0,opacity:0,display:'none'}).prependTo($list);$list.find('> li:last').animate({opacity:0},1000,function(){$insert.animate({height:height},1000).animate({opacity:1},1000).show();$(this).remove();});currentItem--;if(currentItem==-1){currentItem=total-1;}}
setTimeout(spy,settings.interval);}
spy();});};})(jQuery);
