;(function($){
	$.fn.extend({
		"jTab":function(o){
			o = $.extend({
				menutag:	"",
				boxtag:		"",	
				cur:		0,
				act:		"click",
				fade:		0,
				auto:		false,
				autotime:	2000
			},o);
			$(o.menutag).eq(o.cur).addClass("current");
			$(o.boxtag).eq(o.cur).siblings().hide();
		
			var index = o.cur;
			var $this = this;
			$(o.menutag).bind(o.act,function(){
				$(this).addClass("current").siblings().removeClass("current");
				index = $(o.menutag).index(this);
				$(o.boxtag).eq(index).fadeIn(o.fade).siblings().hide();
			}).hover(function(){
				$(this).addClass("hover");
			},function(){
				$(this).removeClass("hover");
			})
			if(o.auto){
				var len = $(o.menutag).length;
				var drive = function(){
					$(o.menutag).eq(index).addClass("current").siblings().removeClass("current");
					$(o.boxtag).eq(index).fadeIn(o.fade).siblings().hide();
					index++;
					if(index==len) index = 0;
				}
				$this[0].t = null;
				$this.hover(function(){
					clearInterval($this[0].t);
				},function(){
					$this[0].t = setInterval(drive,o.autotime);
				}).trigger("mouseleave");
			}
		}
	});
})(jQuery);
//=======================================
$(function(){
	$(".tab").jTab({
        menutag: ".tab li",
        boxtag: ".tab .contenter>div ",
        cur: 0
		});
});
