function Tab(container,tabEle,mainEle,options){
	this.container=$(container);
	this.handle=$(tabEle);
	this.panel=$(mainEle);
	this.count=this.handle.length;
	this.timer=null;
	this.eTime=null;
	
	this.options=$.extend({
		auto:false,
		delay:4,
		event:'mouseover',
		index:1,
		effect:null
		},options);
	this.init();
	}
Tab.prototype={
	init:function(){
		var that=this,
			op=this.options, auto=!!op.auto;
		this.handle.bind(op.event, this._trigger(this));
		this._show(op.index);
		if(auto){
			this._auto();
			this.container.hover(function(){that._stop();},function(){that._auto();});
			}
		},
	_trigger:function(o){
		return function(e){
			var index, op=o.options, handle=o.handle;
			if(op.index===(handle.index(this)+1)){
				return;
				}
			index=op.index=handle.index(this)+1;
			o._show(index,op.effect);
			};
		},
	_show:function(i,effect){
		this.handle.removeClass('active').eq(i-1).addClass('active');
		if(!this.panel.eq(i-1).is(":animated"))
		{
			
		if(effect==="fade")
		{this.panel.fadeOut().eq(i-1).fadeIn();}
		else
		{this.panel.hide().eq(i-1).show();}
		
		}
		
		
		},
	_auto:function(){
		var that=this,
			op=that.options;
		this.timer=setTimeout(function(){
			op.index = op.index< that.count? ++op.index: 1;
			that._show(op.index,op.effect);
			that._auto();
			},op.delay*1000);
		},
	_stop:function(){
		clearTimeout(this.timer);
		}
	};
