$.fn.SlideList = function(options){
	var t = this;
	t.currentId=0;
	t.slideNum=0;
	t.itemWidth=0;
	t.timer = null;
	var DEFAULTS = {
		slideItems:'.items',
		slideItem:'.item',
		showNum:5,
		prevButton:'.btn_left',
		nextButton:'.btn_right',
		//direction:'left_to_right',//top_to_bottom, right_to_left, bottom_to_top
		switchSpeed:3000,// 3 seconds
		moveSpeed:'slow'
	};	
	t.options = $.extend({}, DEFAULTS, options || {});
	t.slideNum = $(t).find(t.options.slideItem).length;	
	t.itemWidth = $(t).find(t.options.slideItem+":first").width();	
	
	t.show = function(i){
		$(t).find(t.options.slideItems).animate({left: '-'+(i*t.itemWidth)+'px'}, t.options.moveSpeed);		
		t.checkBtnStatus();
	};
		
	t.prev = function()
	{
		t.currentId--;
		if(t.currentId<0)
			t.currentId = t.slideNum;
		t.show(t.currentId);		
	};
	t.next = function()
	{
		t.currentId++;
		if(t.currentId+t.options.showNum>t.slideNum)
			t.currentId = 0;
		t.show(t.currentId);
	};	
	
	t.start = function()
	{
		t.timer = setInterval(function(){t.next()},t.options.switchSpeed);
	};		
	
	t.stop = function()
	{
		clearInterval(t.timer);
		t.timer = null;
	};	
	
	t.checkBtnStatus = function()
	{
		if(t.currentId == 0)
		{
			$(t).find(t.options.prevButton).removeClass('on');
			$(t).find(t.options.prevButton).unbind("click");
		}
		else
		{			
			$(t).find(t.options.prevButton).unbind("click");
			$(t).find(t.options.prevButton).addClass('on');
			$(t).find(t.options.prevButton).bind("click",function(){
				t.prev();
				if(t.timer)
					t.stop();
			});
		}
			
		if(t.currentId+t.options.showNum>=t.slideNum)
		{
			$(t).find(t.options.nextButton).removeClass('on');
			$(t).find(t.options.nextButton).unbind("click");
		}
		else
		{
			$(t).find(t.options.nextButton).unbind("click");
			$(t).find(t.options.nextButton).addClass('on');
			$(t).find(t.options.nextButton).bind("click",function(){
				t.next();
				if(t.timer)
					t.stop();
			});
		}	
	};
	
	t.init = function()
	{
		t.checkBtnStatus();
		t.start();
	};
	return this;
}
