(function ($) {
	var itemCount = 0, newid, options, scrollInterval;
	var vscrollid = 0; $.fn.vScroll = function (_options) {
		options=_options;
		return this.each(function () {
			vscrollid++; obj = $(this); newid = vscrollid; obj.css("overflow",
			"hidden"); obj.css("position",
			"relative"); obj.css("height",
			options.height + "px"); obj.children().each(function (intIndex) {
				$(this).addClass("vscroll-" + vscrollid + "-" + intIndex)
			}); $(options.downID).click(function () {
				clearInterval(scrollInterval);
				scrollInterval = setInterval(naechsterEintrag, 5000);
				var nextCount = itemCount + 1; if ($('.vscroll-' + newid + '-' + nextCount).length) {
					var divH = $('.vscroll-' + newid + '-' + itemCount).outerHeight(); itemCount++; $("#vscroller-" + newid).animate({
						top: "-=" + divH + "px"
					},
					options.speed)
				}else {
					if (options.cycle) {
						itemCount = 0; $("#vscroller-" + newid).animate({
							top: "0" + "px"
						},
						options.speed)
					}
				}
			}); $(options.upID).click(function () {
				clearInterval(scrollInterval);
				scrollInterval = setInterval(naechsterEintrag, 5000);

				var prevCount = itemCount - 1; if ($('.vscroll-' + newid + '-' + prevCount).length) {
					itemCount--; var divH = $('.vscroll-' + newid + '-' + itemCount).outerHeight(); $("#vscroller-" + newid).animate({
						top: "+=" + divH + "px"
					},
					options.speed)
				}
			}); obj.children().wrapAll("<div style='position: relative; top: 0' id='vscroller-" + vscrollid + "'></div>")
		})
	}
	
	naechsterEintrag = function () {
		var nextCount = itemCount + 1; if ($('.vscroll-' + newid + '-' + nextCount).length) {
			var divH = $('.vscroll-' + newid + '-' + itemCount).outerHeight(); itemCount++; $("#vscroller-" + newid).animate({
				top: "-=" + divH + "px"
			},
			options.speed)
		}else {
			if (options.cycle) {
				itemCount = 0; $("#vscroller-" + newid).animate({
					top: "0" + "px"
				},
				options.speed)
			}
		}
	}
	
	scrollInterval = setInterval(naechsterEintrag, 5000);
})(jQuery);
