﻿
	function ScrollAction(listObj, listElem, speed, isSeries) {
		var pos, top, aniTop, height;
		var id = '';

		pos = listObj.position();
		top = pos.top;
		aniTop = top;
		height = listObj.height();

		var scrollUp = function () {
			aniTop--;
			if (!isSeries) {
				if (aniTop == -height) {
					listObj.css({ 'top': top });
					aniTop = top;
				};
			} else {
				if (aniTop == -listObj.children().eq(0).height()) {
					var firstItem = '<' + listElem + '>' + listObj.children().eq(0).html() + '</' + listElem + '>';
					listObj.children().eq(0).remove();
					listObj.append(firstItem);
					aniTop = 4;
				};
			};
			listObj.css({ 'top': aniTop + 'px' });
		};

		var hover = function (id) {
			listObj.hover(function () {
				clearInterval(id);
			}, function () {
				id = setInterval(scrollUp, speed);
			});
		};

		this.start = function () {
			id = setInterval(scrollUp, speed);
			hover(id);
		};

	}

