/*
* vertical news ticker
* Tadas Juozapaitis ( kasp3rito [eta] gmail (dot) com )
* http://www.jugbit.com/jquery-vticker-vertical-news-ticker/
*/
(function(d){d.fn.vTicker=function(c){c=d.extend({handler:null,speed:700,pause:4E3,showItems:3,animation:"",mousePause:!0,isPaused:!1,direction:"up",height:0,currentIndex:0},c);moveUp=function(a,c,b){if(!b.isPaused){a=a.children("ul");var f=a.children("li:first").clone(!0);0<b.height&&(c=a.children("li:first").height());b.currentIndex=(b.currentIndex+1)%a.children("li").length;null!==b.handler&&b.handler.setCurrentIndex(b.currentIndex);a.animate({top:"-="+c+"px"},b.speed,function(){d(this).children("li:first").remove();
d(this).css("top","0px")});"fade"==b.animation&&(a.children("li:first").fadeOut(b.speed),0==b.height&&a.children("li:eq("+b.showItems+")").hide().fadeIn(b.speed).show());f.appendTo(a)}};moveDown=function(a,c,b){if(!b.isPaused){a=a.children("ul");var f=a.children("li:last").clone(!0);0<b.height&&(c=a.children("li:first").height());b.currentIndex=(b.currentIndex+1)%a.children("li").length;null!==b.handler&&b.handler.setCurrentIndex((a.children("li").length-b.currentIndex-1)%a.children("li").length);
a.css("top","-"+c+"px").prepend(f);a.animate({top:0},b.speed,function(){d(this).children("li:last").remove()});"fade"==b.animation&&(0==b.height&&a.children("li:eq("+b.showItems+")").fadeOut(b.speed),a.children("li:first").hide().fadeIn(b.speed).show())}};return this.each(function(){var a=d(this),e=0;a.css({overflow:"hidden",position:"relative"}).children("ul").css({position:"absolute",margin:0,padding:0}).children("li").css({margin:0,padding:0});0==c.height?(a.children("ul").children("li").each(function(){d(this).height()>
e&&(e=d(this).height())}),a.children("ul").children("li").each(function(){d(this).height(e)}),a.height(e*c.showItems)):a.height(c.height);c.handler.options.privateVariables.interval=setInterval(function(){"up"==c.direction?moveUp(a,e,c):moveDown(a,e,c)},c.pause);c.mousePause&&a.bind("mouseenter",function(){c.isPaused=!0}).bind("mouseleave",function(){c.isPaused=!1})})}})(jQuery);