/* slide插件 By Jony 
 * effect: fade / scrollX / scrollY / marquee
 */
;(function($){$.fn.slide=function(options){var a=$(this),o=$.extend({},{effect:"fade",easing:"swing",speed:800,auto:4000,step:1,visible:1,isNav:!0,claNav:"slide-nav",claCon:"slide-content"},options),play,index=1,show=function(){$.fn.slide.effect[o.effect](o,index);index++;if(index*o.step>=o.l)index=0},stop=function(){if(play)clearInterval(play)},newPlay=function(){play=setInterval(show,o.auto)};o.c=$("."+o.claCon,a);o.cL=o.c.children();o.l=o.cL.size();o.w=o.cL.eq(0).outerWidth(!0);o.h=o.cL.eq(0).outerHeight(!0);if(o.step>o.visible)o.step=o.visible;if(o.effect=="marquee"||o.step>1||o.visible>1)o.isNav=!1;else{if(o.isNav){if($("ul."+o.claNav,a).length==0&&o.l>=2){var _t='<ul class="'+o.claNav+'"><li class="on">1</li>';for(var j=2;j<=o.l;j++)_t+='<li>'+j+'</li>';_t+='</ul>';a.append(_t);}o.nL=$("ul."+o.claNav+" li",a)}}switch(o.effect){case"fade":o.cL.css({position:"absolute",left:0,top:0}).eq(0).css({zIndex:1}).siblings().css({opacity:0});break;case"scrollX":o.c.css({width:o.l*o.w});o.cL.css({float:'left'});a.css({width:o.w*o.visible});break;default:a.css({height:o.h*o.visible});}return this.each(function(){o.c.hover(function(){stop();},function(){newPlay()});if(o.isNav){o.nL.hover(function(){stop();index=o.nL.index(this);setTimeout(show,100)},function(){newPlay()});}newPlay();});};$.fn.slide.nav=function(o,i){if(o.isNav)o.nL.eq(i).addClass("on").siblings().removeClass("on");};$.fn.slide.effect={fade:function(o,i){o.cL.eq(i).stop().animate({opacity:1},o.speed,o.easing).css({zIndex:1}).siblings(":visible").animate({opacity:0},o.speed).css({zIndex:0});$.fn.slide.nav(o,i);},scrollX:function(o,i){o.c.stop().animate({left:-i*o.step*o.w},o.speed,o.easing);$.fn.slide.nav(o,i);},scrollY:function(o,i){o.c.stop().animate({top:-i*o.step*o.h},o.speed,o.easing);$.fn.slide.nav(o,i);},marquee:function(o,i){o.c.animate({marginTop:-o.step*o.h},o.speed,o.easing,function(){for(var j=0;j<o.step;j++){o.c.find("li:first").appendTo(o.c);}o.c.css({marginTop:0});});}};})(jQuery);