(function($){$.fn.vscroll=function(options){varopts=$.extend({},$.fn.vscroll.defaults,options);returnthis.each(function(){var$scroll_item=$(this).find(opts.vscroll_toscroll);var$scroll_up=$(this).find(opts.vscroll_up);var$scroll_down=$(this).find(opts.vscroll_down);varvscroll_pos=0;//hide DOWN if the element if we don't need it if($scroll_item.height()<=$scroll_item.parent().height()){$scroll_down.css("visibility","hidden");}$scroll_up.click(function(event){if(vscroll_pos>=0){$scroll_up.css("visibility","hidden");}else{vscroll_pos+=opts.vscroll_size;}$scroll_item.animate({top:vscroll_pos},"normal")if($scroll_down.css("visibility")=="hidden"){$scroll_down.css("visibility","visible");}//if hidden show DOWN elementif(vscroll_pos>=0){$scroll_up.css("visibility","hidden");}// if visible hide UP elementevent.preventDefault();});$scroll_down.click(function(event){vscroll_pos-=opts.vscroll_size;$scroll_item.animate({top:vscroll_pos},"normal")if($scroll_up.css("visibility")=="hidden"){$scroll_up.css("visibility","visible");}//if hidden show UP elementif($scroll_item.height()<=(Math.abs(vscroll_pos)+$scroll_item.parent().height())){$scroll_down.css("visibility","hidden");}//hide DOWN - make sure don't scroll to far also checking containers heightevent.preventDefault();});});};$.fn.vscroll.defaults={vscroll_toscroll:".vscroll_toscroll",vscroll_up:".vscroll_up",vscroll_down:".vscroll_down",vscroll_size:84};})(jQuery);