(function($,w){function switchable(container,o){if(arguments.length!==0){o=o||{};this.id=container;this.navcls=o.navcls||"js_switch_nav";this.contcls=o.contentcls||"js_switch_ct";this.triggercls=o.triggercls||"js_switch_trigger";this.prevcls=o.prevcls||"js_switch_prev";this.nextcls=o.nextcls||"js_switch_next";this.panelcls=o.panelcls||"js_switch_panel";this.prevcls=o.prevcls||"js_switch_prev";this.activeyriggercls=o.activetriggercls||"js_active";this.disablebtncls=o.disablebtncls||"js_switch_off";this.triggertype=o.triggertype||"click";this.effect=o.effect||"normal";this.hastriggers=(o.hastriggers!==undefined)?o.hastriggers:true;this.autoplay=(o.autoplay!==undefined)?o.autoplay:false;this.circular=(o.circular!==undefined)?o.circular:true;this.delay=o.delay||200;this.steps=o.steps||1;this.viewsize=o.viewsize||1;this.interval=o.interval||5000;this.duration=o.duration||500;this.easing=o.easing||"swing";this._activeindex=o.activeindex||0;this.callfun=o.func||null;this._autoplaytimer;this._eventtimer;}} switchable.prototype={_struct:function(){var $cont=$("#"+this.id),$panel=$cont.find("."+this.panelcls),$content=$cont.find("."+this.contcls);switch(this.effect){case"scrollx":var contwidth=$panel.outerwidth(true)*$panel.length+"px";$content.css({"position":"absolute","width":contwidth});$panel.css({"float":"left"});break;case"scrolly":$content.css({"position":"absolute"});break;case"fade":$panel.css({"position":"absolute","left":"0","top":"0","z-index":"0","opacity":"0"});break;} (this.autoplay===true)&&this._auto();},_switch:function(index){switch(this.effect){case"scrollx":this._switchscrollx(index);break;case"scrolly":this._switchscrolly(index);break;case"fade":this._switchfade(index);break;default:this._switchnormal(index);}},_switchnormal:function(index){var $cont=$("#"+this.id),$panel=$cont.find("."+this.panelcls);this._setactivetriggercls(index);$panel.hide();$panel.eq(index).show();this._activeindex=index;(this.callfun!==null)&&this.callfun.call(this,index);},_switchscrolly:function(index){var $cont=$("#"+this.id),$panel=$cont.find("."+this.panelcls),$content=$cont.find("."+this.contcls),panelwidth=$panel.outerheight(true),movewidth=-index*this.steps*panelwidth;this._setactivetriggercls(index);$content.stop().animate({"top":movewidth},this.duration,this.easing);this._activeindex=index;(this.circular===false)&&this._setdisablebtncls(index);(this.callfun!==null)&&this.callfun.call(this,index);},_switchscrollx:function(index){var $cont=$("#"+this.id),$panel=$cont.find("."+this.panelcls),$content=$cont.find("."+this.contcls),panelwidth=$panel.outerwidth(true),movewidth=-index*this.steps*panelwidth;this._setactivetriggercls(index);$content.stop().animate({"left":movewidth},this.duration,this.easing);this._activeindex=index;(this.circular===false)&&this._setdisablebtncls(index);(this.callfun!==null)&&this.callfun.call(this,index);},_switchfade:function(index){var $cont=$("#"+this.id),$panel=$cont.find("."+this.panelcls);this._setactivetriggercls(index);$panel.eq(this._activeindex).stop().animate({opacity:0},this.duration,this.easing).css("z-index",0);$panel.eq(index).stop().animate({opacity:1},this.duration,this.easing).css("z-index",1);this._activeindex=index;(this.callfun!==null)&&this.callfun.call(this,index);},_setactivetriggercls:function(index){var $cont=$("#"+this.id),$trigger=$cont.find("."+this.triggercls),index=index||0;$trigger.removeclass(this.activeyriggercls);$trigger.eq(index).addclass(this.activeyriggercls);},_setdisablebtncls:function(index){var $cont=$("#"+this.id),$panel=$cont.find("."+this.panelcls),$prev=$cont.find("."+this.prevcls),$next=$cont.find("."+this.nextcls),maxindex=math.ceil(($panel.length-this.viewsize)/this.steps);if(index==0){$prev.addclass(this.disablebtncls);if($panel.length<=this.viewsize){$next.addclass(this.disablebtncls);}else{$next.removeclass(this.disablebtncls);}}else if(index==maxindex){$next.addclass(this.disablebtncls);$prev.removeclass(this.disablebtncls);}else{$prev.removeclass(this.disablebtncls);$next.removeclass(this.disablebtncls);}},_auto:function(){var self=this,$cont=$("#"+this.id);clearinterval(this._autoplaytimer);self._autoplaytimer=setinterval(function(){self._doplay();},self.interval);$cont.unbind("mouseenter");$cont.unbind("mouseleave");$cont.mouseenter(function(){clearinterval(self._autoplaytimer);});$cont.mouseleave(function(){self._autoplaytimer=setinterval(function(){self._doplay();},self.interval);});},_doplay:function(){this._switch(this._checkactiveindex(this._activeindex+1));},_checkactiveindex:function(index){var $cont=$("#"+this.id),$panel=$cont.find("."+this.panelcls),maxindex=math.ceil(($panel.length-this.viewsize)/this.steps);if(index<0){return maxindex;}else if(index>maxindex){return 0} return index;},stop:function(){var $cont=$("#"+this.id);$cont.unbind("mouseenter");$cont.unbind("mouseleave");clearinterval(this._autoplaytimer);},start:function(){this._auto();},switchto:function(index){this._switch(index);},prev:function(){this._switch(this._checkactiveindex(this._activeindex-1));},next:function(){this._switch(this._checkactiveindex(this._activeindex+1));},_bindevent:function(){var self=this,$cont=$("#"+this.id),$trigger=$cont.find("."+this.triggercls),$prev=$cont.find("."+this.prevcls),$next=$cont.find("."+this.nextcls);$trigger.each(function(index,elem){$(elem)[self.triggertype](function(){if(self.triggertype==="click"){self._switch(index);}else{self._eventtimer=settimeout(function(){self._switch(index);},self.delay);}});});if(self.triggertype==="mouseenter"){$trigger.bind("mouseleave",function(){cleartimeout(self._eventtimer);});} $next[self.triggertype](function(){if($(this).hasclass(self.disablebtncls))return;self.next();});$prev[self.triggertype](function(){if($(this).hasclass(self.disablebtncls))return;self.prev();});},_init:function(cont,config){this._struct();this._bindevent();this._switch(this._activeindex);}};var switch=w.switch={};switch.tabs=function(container,config){switchable.call(this,container,config);this._init(container,config);} switch.tabs.prototype=new switchable();switch.tabs.prototype.constructor=switch.tabs;switch.slide=function(container,config){switchable.call(this,container,config);this._init(container,config)} switch.slide.prototype=new switchable();switch.slide.prototype.constructor=switch.slide;switch.carousel=function(container,config){switchable.call(this,container,config);this._init(container,config)};switch.carousel.prototype=new switchable();switch.carousel.prototype.constructor=switch.carousel;switch.carousel.prototype._init=function(cont,config){this._struct();(this.circular===false)&&this._setdisablebtncls(this._activeindex);this._settrigger(config);this._bindevent();this._switch(this._activeindex);};switch.carousel.prototype._settrigger=function(o){var trigger="",$cont=$("#"+this.id),$trigger=$cont.find("."+this.triggercls),$panel=$cont.find("."+this.panelcls),$nav=$cont.find("."+this.navcls),maxindex=math.ceil(($panel.length-this.viewsize)/this.steps);for(var i=1;i<=maxindex+1;i++){trigger=trigger+'
  • '+i+'
  • ';} $nav.html(trigger);$trigger=$cont.find("."+(o.triggercls||"js_switch_trigger"));};})(jquery,window);jquery.easing['jswing']=jquery.easing['swing'];jquery.extend(jquery.easing,{def:'easeoutquad',swing:function(x,t,b,c,d){return jquery.easing[jquery.easing.def](x,t,b,c,d);},easeoutquad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeoutexpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-math.pow(2,-10*t/d)+1)+b;},easeinoutexpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*math.pow(2,10*(t-1))+b;return c/2*(-math.pow(2,-10*--t)+2)+b;},easeoutcirc:function(x,t,b,c,d){return c*math.sqrt(1-(t=t/d-1)*t)+b;},easeinoutcirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(math.sqrt(1-t*t)-1)+b;return c/2*(math.sqrt(1-(t-=2)*t)+1)+b;},easeoutelastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a