jQuery.fn.extend({
Scroll:function(opt,action){
	if(!opt) var opt = {};
	var timeOut = 0;
	var _btnUp = jQuery("#"+ opt.up);//Shawphy:向上按钮 
	var _btnDown = jQuery("#"+ opt.down);//Shawphy:向下按钮
	var _btnUp = jQuery("#"+ opt.up);//Shawphy:向上按钮 
	var _btnDown = jQuery("#"+ opt.down);//Shawphy:向下按钮 
	if(!opt.item){
		alert('error, line.');
		return false;
	}
	opt.offset = opt.offset || 0;
	var _this = this;
	var _item = this.find(opt.item+":first");
	var height = _item.height() + opt.offset;//获取行高
	var width = _item.width() + opt.offset;//获取行高
	var line = opt.line ? parseInt(opt.line,10) : parseInt(this.height() / height,10); //每次滚动的行数，默认为一屏，即父容器高度
	var speed = opt.speed ? parseInt(opt.speed,10) : 600; //卷动速度，数值越大，速度越慢（毫秒） 
	var timer = opt.timer ?parseInt(opt.timer,10):1200; //滚动的时间间隔（毫秒）
	if(line <= 0){
		line = 1;
	}
	var upHeight = 0 - line * height;
	var leftWidth = 0 - line * width;
	var Left = function(){
		_item.animate({marginLeft:leftWidth},speed,function(){
			for(var i = 1; i <= line; i++) {
				_item = _this.find(opt.item+":first").appendTo(_this).css({marginLeft:0});
			}
			_item = _this.find(opt.item+":first");
		//	leftWidth = (0 - (line * (_item.width() + opt.offset)));
		});
	}
	var Right = function(){
		for(i = 1;i <= line; i++){ 
			_this.find(opt.item+":first").prependTo(_this);
		} 
		_item.css({marginLeft:leftWidth}); 
		_item.animate({ marginLeft:0 },speed); 
	}
	//滚动函数
	var Up = function() {
		_item.animate({marginTop:upHeight},speed,function(){
			for(var i = 1; i <= line; i++) {
				_item = _this.find(opt.item+":first").appendTo(_this).css({marginTop:0});
			}
			_item = _this.find(opt.item+":first");
			//upHeight = (0 - (line * (_item.height() + opt.offset)));
		});
	}
	//Shawphy:向下翻页函数 
	var Down = function() { 
		for(i = 1;i <= line; i++){ 
			_this.find(opt.item+":first").prependTo(_this);
		} 
		_item.css({marginTop:upHeight}); 
		_item.animate({ marginTop:0 },speed); 
	}
   //Shawphy:自动播放 
	var autoPlay = function(){ 
		if(timer){
			timeOut = window.setInterval(orientation,timer); 
		}
	}; 
	var autoStop = function(){ 
		if(timer){
			window.clearInterval(timeOut);
		}
	}; 
	var orientation = Up;
	if(action == 'left'){
		orientation = Left;
	}else if(action == 'up'){
		orientation = Up;	
	}
	 //鼠标事件绑定 
	_this.hover(autoStop,autoPlay).mouseout();
}});