var WraperSelectorCopy; (function(b){b.fn.tabSwitch=function(i,j,l){var a=b.extend({type:"slide",cols:2,toggle:"fade",ease:40,easeType:"linear",loopback:1,width:400,height:400,index:0,speed:500,interval:5E3,step:1,wrapperClass:"",viewportClass:""},j),d=this,m=d.eq(1),c=d.eq(1).get(0),h=b.isFunction(l)?function(){b.data(c,"index",a.index);l()}:function(){b.data(c,"index",a.index)};StoreToCache=function(){b.data(c,"type",a.type);b.data(c,"toggle",a.toggle);b.data(c,"cols",a.cols);b.data(c,"ease",a.ease);b.data(c,"easeType", a.easeType);b.data(c,"index",a.index);b.data(c,"loopback",a.loopback);m.attr("style")?b.data(c,"orgAttr",m.attr("style")):b.data(c,"orgAttr","")};backFromCache=function(){d.attr("style",b.data(c,"orgAttr"));b("#ViewPort"+b.data(c)).replaceWith(d);stopAuto();b.removeData(c)};j=function(){StoreToCache();a.width&&d.width(a.width);a.height&&d.height(a.height);var e="WideDiv"+b.data(c);WraperSelectorCopy=e;d.wrapAll("<div id='"+e+"'></div>");var f=b("#"+e);f.addClass(a.wraperClass);f.css({position:"relative"}); f.wrap("<div id='"+e.replace("WideDiv","ViewPort")+"'></div>");e=b("#"+e.replace("WideDiv","ViewPort"));e.width(a.width);e.height(a.height);e.css({display:"block",overflow:"hidden",position:"relative"});e.addClass(a.viewportClass);switch(a.type){case "slide":d.css({"float":"left"});f.width((a.width+2)*d.length);break;case "scroll":f.width(a.width);f.height((a.height+2)*d.length);break;case "toggle":f.width(a.width);f.height(a.height);d.css({position:"absolute",left:"-999px"});d.eq(a.index).css({left:"0px", top:"0px"});d.eq(a.index).css("opacity",1);break;case "table":f.width(a.width*a.cols);d.css("float","left")}k()};var k=function(){var e=0;if(!a.easeType)a.easeType=(c,"easeType");if(a.index>d.length-1)if(b.data(c,"loopback")!=0){a.index=0;e=-b.data(c,"ease")}else return;if(a.index<0)if(b.data(c,"loopback")!=0){a.index=d.length-1;e=b.data(c,"ease")}else return;var f="WideDiv"+b.data(c),g=b("#"+f);switch(b.data(c,"type")){case "slide":if(e!=0){e=parseInt(g.css("left").replace("px",""))+e;g.animate({left:e+ "px"},a.speed,function(){g.animate({left:-(d.outerWidth(true)*a.index)+"px"},a.speed,a.easeType,h())})}else g.animate({left:-(d.outerWidth(true)*a.index)+"px"},a.speed,a.easeType,h());break;case "scroll":if(e!=0){e=parseInt(g.css("top").replace("px",""))+e;g.animate({top:e+"px"},a.speed,function(){g.animate({top:-(d.outerHeight(true)*a.index)+"px"},a.speed,a.easeType,h())})}else g.animate({top:-(d.outerHeight(true)*a.index)+"px"},a.speed,a.easeType,h());break;case "toggle":d.eq(a.index).css({left:"0px", top:"0px"});switch(b.data(c,"toggle")){case "fade":d.eq(a.index).css({opacity:0});d.eq(a.index).animate({opacity:1},a.speed);b.data(c,"index")!=a.index&&d.eq(b.data(c,"index")).animate({opacity:0},a.speed,function(){b(this).css("left",-999);h()});break;case "toggle":if(b.data(c,"index")!=a.index){d.eq(a.index).css({display:"none"});d.eq(b.data(c,"index")).slideUp(a.speed,function(){d.eq(a.index).slideDown(a.speed,function(){h()});b(this).css("left",-999)})}break;case "show":if(b.data(c,"index")!= a.index){d.eq(a.index).css({display:"none"});d.eq(b.data(c,"index")).hide(a.speed,function(){d.eq(a.index).show(a.speed,function(){h()});b(this).css("left",-999)})}break;case "noeffect":if(b.data(c,"index")!=a.index){d.eq(b.data(c,"index")).css("left",-999);h()}break}break;case "table":e=b.data(c,"cols");f=-(a.index%e)*d.width();var n=-Math.floor(a.index/e)*d.height();g.animate({left:f},a.speed,a.easeType,function(){g.animate({top:n},a.speed,a.easeType,h())});break;default:b("html,body").animate({scrollTop:d.eq(a.index).offset().top}, a.speed);break}};moveStep=function(){var e=b.data(c,"index");a.index=parseInt(e)+parseInt(a.step);k()};startAuto=function(){b.data(c,"AutoSwitch",setInterval(moveStep,a.interval))};stopAuto=function(){clearInterval(b.data(c,"AutoSwitch"));b.removeData(c,"AutoSwitch")};toggleAuto=function(){isAuto()?stopAuto():startAuto()};isAuto=function(){return b.data(c,"AutoSwitch")?true:false};i||(i="");switch(i.toLowerCase()){case "index":return b.data(c,"index")?b.data(c,"index"):0;case "moveto":k();break;case "movestep":moveStep(); break;case "destroy":backFromCache();break;case "create":j();break;case "isauto":return isAuto();case "toggleauto":toggleAuto();break;case "startauto":startAuto();break;case "stopauto":stopAuto();break}}})(jQuery);