(function($){$.fn.anythingSliderFx=function(effects,options){var wrap=$(this).closest('.anythingSlider'),sliderWidth=wrap.width(),sliderHeight=wrap.height(),getBaseFx=function(s){var size=s,size2;if(s&&typeof s==='string'&&s.indexOf(',')>0){s=s.split(',');size=$.trim(s[0]);size2=$.trim(s[1])}return{'top':[{inFx:{top:0},outFx:{top:'-'+(size||sliderHeight)}}],'bottom':[{inFx:{top:0},outFx:{top:(size||sliderHeight)}}],'left':[{inFx:{left:0},outFx:{left:'-'+(size||sliderWidth)}}],'right':[{inFx:{left:0},outFx:{left:(size||sliderWidth)}}],'fade':[{inFx:{opacity:size||1},outFx:{opacity:0}}],'expand':[{inFx:{width:size2||'100%',height:size2||'100%',top:'0%',left:'0%'},outFx:{width:(size||'10%'),height:(size||'10%'),top:'50%',left:'50%'}}],'grow':[{inFx:{top:0,fontSize:size||'16px',opacity:1},outFx:{top:'-200px',fontSize:size2||'80px',opacity:0}}],'listLR':[{inFx:{left:0,opacity:1},outFx:[{left:(size||sliderWidth),opacity:0},{left:'-'+(size||sliderWidth),opacity:0}],selector:[':odd',':even']}],'listRL':[{inFx:{left:0,opacity:1},outFx:[{left:(size||sliderWidth),opacity:0},{left:'-'+(size||sliderWidth),opacity:0}],selector:[':even',':odd']}],'caption-Top':[{inFx:{top:0,opacity:0.8},outFx:{top:('-'+size||-50),opacity:0}}],'caption-Right':[{inFx:{right:0,opacity:0.8},outFx:{right:('-'+size||-150),opacity:0}}],'caption-Bottom':[{inFx:{bottom:0,opacity:0.8},outFx:{bottom:('-'+size||-50),opacity:0}}],'caption-Left':[{inFx:{left:0,opacity:0.8},outFx:{left:('-'+size||-150),opacity:0}}]}};return this.each(function(){$(this).data('AnythingSlider').fx=effects;var defaults=$.extend({easing:'swing',timeIn:400,timeOut:350,stopRepeat:false,outFxBind:'slide_init',inFxBind:'slide_complete'},options),baseFx=getBaseFx(),animateFx=function(el,opt,isOut,time){if(el.length===0||typeof opt==='undefined'){return}var o=opt[0]||opt,s=o[1]||'',t=time||parseInt(((s==='')?o.duration:o[0].duration),10);if(isOut){if(el.css('position')!=='absolute'){el.css({position:'relative'})}el.stop();if(s!==''){el.filter(opt[1][0]).animate(o[0],{queue:false,duration:t,easing:o[0].easing});el.filter(opt[1][1]).animate(s,{queue:true,duration:t,easing:o[0].easing});return}}el.animate(o,{queue:true,duration:t,easing:o.easing})},getFx=function(opts,isOut){var tmp,bfx2,ex=(isOut)?'outFx':'inFx',bfx={},time=(isOut)?defaults.timeOut:defaults.timeIn,fx=$.trim(opts[0].replace(/\s+/g,' ')).split(' ');if(isOut&&fx.length===1&&baseFx.hasOwnProperty(fx)&&typeof(baseFx[fx][0].selector)!=='undefined'){bfx2=baseFx[fx][0].outFx;bfx2[0].duration=opts[2]||defaults.timeOut;bfx2[0].easing=opts[3]||defaults.easing;return[bfx2,baseFx[fx][0].selector||[]]}$.each(fx,function(i,f){if(baseFx.hasOwnProperty(f)){var t=typeof opts[1]==='undefined'||opts[1]==='',tmp=(t)?baseFx:getBaseFx(opts[1]);$.extend(true,bfx,tmp[f][0][ex]);t=opts[2]||bfx.duration||time;bfx.duration=(isOut)?t/2:t;bfx.easing=isNaN(opts[3])?opts[3]||defaults.easing:opts[4]||defaults.easing}});return[bfx]},base=$(this).bind(defaults.outFxBind,function(e,slider){if(defaults.stopRepeat&&slider.$lastPage[0]===slider.$targetPage[0]){return}var el,elOut,time,page=slider.$lastPage.add(slider.$items.eq(slider.exactPage)).add(slider.$targetPage),FX=slider.fx;if(slider.exactPage===0){page=page.add(slider.$items.eq(slider.pages))}if(slider.options.animationTime<defaults.timeOut){time=slider.options.animationTime||defaults.timeOut}page=page.find('*').andSelf();for(el in FX){if(el==='outFx'){for(elOut in FX.outFx){if(page.filter(elOut).length){animateFx(page.filter(elOut),FX.outFx[elOut],true)}}}else if(el!=='inFx'){if($.isArray(FX[el])&&page.filter(el).length){animateFx(page.filter(el),getFx(FX[el],true),true,time)}}}}).bind(defaults.inFxBind,function(e,slider){if(defaults.stopRepeat&&slider.$lastPage[0]===slider.$targetPage[0]){return}var el,elIn,page=slider.$currentPage.add(slider.$items.eq(slider.exactPage)),FX=slider.fx;page=page.find('*').andSelf();for(el in FX){if(el==='inFx'){for(elIn in FX.inFx){if(page.filter(elIn).length){animateFx(page.filter(elIn),FX.inFx[elIn],false)}}}else if(el!=='outFx'&&$.isArray(FX[el])&&page.filter(el).length){animateFx(page.filter(el),getFx(FX[el],false),false)}}}).data('AnythingSlider');$(window).load(function(){base.gotoPage(base.currentPage,base.playing)})})}})(jQuery);
