$.fn.scrollBox = function(data) {
	var $this = this,autoMove,autoShow,showObj;
	if ( this.find("li").length > data.liCount ) {
		var step = this.find("li").outerWidth(true);
		this.css("overflow","hidden").find("ul:first").css("width",( this.find("li").length * step ) + "px");
		function moveLeft() {
			showObj = $this.find("li:first").next();
			showOne(showObj);
			$this.find("li:first").animate( { "marginLeft" : -step + "px" } , { queue: false, duration: data.one, complete: function() {
				$(this).insertAfter($this.find("li:last")).css("marginLeft",0);
			} } );
		}
		function moveRight() {
			showObj = $this.find("li:last");
			showOne(showObj);
			$this.find("li:last").css("marginLeft",-step + "px").insertBefore($this.find("li:first")).animate( { "marginLeft" : 0 } , { queue: false, duration: data.one } );
		}
		function restartMove() {
			autoMove = setInterval( function() {
				if ( data.forward == "left" ) {
					moveLeft();
				}
				else if ( data.forward == "right" ) {
					moveRight();
				}
			} , data.speed );
		}
		if ( data.auto ) {
			restartMove();
			if ( data.stop ) {
				this.hover( function() {
					clearInterval(autoMove);
				}, function() {
					restartMove();
				} );				
			}
		}
		if ( data.control ) {
			$("." + data.ctrlClass).eq(0).click( function() {
				clearInterval(autoMove);
				data.forward = "left";
				moveLeft();
				restartMove();
			} ).end().eq(1).click( function() {
				clearInterval(autoMove);
				data.forward = "right";
				moveRight();
				restartMove();
			} )
		}
		showObj = $this.find("li:first");
		$("#" + data.bigger).attr("src",showObj.find("a").addClass("current").end().attr("banner")).attr("link",showObj.find("a").attr("href"));
	}
	else if ( this.find("li").length == 0 ) {
		this.html(data.noRecord);
	}
	else {
		showObj = $this.find("li:first");
		$("#" + data.bigger).attr("src",showObj.find("a").addClass("current").end().attr("banner")).attr("link",showObj.find("a").attr("href"));
		autoShow = setInterval( function() {
			showObj = showObj.next();
			if ( showObj.length == 0 ) {
				showObj = $this.find("li:first");
			}
			showOne(showObj);
		} , data.speed );
	}
	this.find("a").click( function() {
		showOne($(this).parent("li"));
		return false;
	} );
	function showOne(Obj) {
		var bigger = $("#" + data.bigger);
		var img = new Image();
		img.src = Obj.attr("banner");
		bigger.fadeOut("fast",function() {
			$this.find("li a.current").removeClass("current");
			Obj.find("a").addClass("current");
			if ( img.complete ) {
				bigger.attr("src",img.src).attr("link",Obj.find("a").attr("href")).fadeIn("fast");
			}
			img.onload = function() {
				bigger.attr("src",this.src).attr("link",Obj.find("a").attr("href")).fadeIn("fast");
			};
		});
	}
	$("#" + data.bigger).css("cursor","pointer").click( function() {
		var link = $(this).attr("link");
		if ( link != "" && link != null ) {
			window.location.href = link;
		}
	} );
	return this;
};
