(function(b){b.fn.adSlider=function(e){var j={hover:!0,autoplay:!0,direction:"right",subBox:!1,nav:!1},e=b.extend(j,e),g,f;switch(e.direction){case "left":g={left:0};f={left:1100};break;case "right":g={right:0};f={right:1100};break;case "top":g={top:0};f={top:1100};break;case "bottom":g={bottom:0},f={bottom:1100}}return this.each(function(){function k(a){c.dom.box.is(":animated")||m(function(){d=a;n(a);o(a);h=!0;l()})}function l(){e.autoplay&&h&&(i=setInterval(function(){h&&(d++,d>c.n.boxs-1&&(d=
0),o(d),n(d))},1E4))}function m(a){h=!1;clearInterval(i);i=0;console.log("stop() : ",i);a()}function o(a){c.dom.sShowItem.removeClass("sShowCurrent");b(".sShowItem:eq("+a+")").addClass("sShowCurrent")}function p(a){e.subBox&&(c.dom.sItemPerson.fadeOut(400),b(".sItemPerson:eq("+a+")").fadeIn(600))}function n(a,d){var e=b(".sBox:eq("+a+")");c.dom.box.not(".sBox:eq("+a+")").removeClass("adCurrent");e.addClass("adCurrent").show().stop(!0,!0).animate(g,1200,"easeInOutExpo",function(){b(this).css({zIndex:0});
c.dom.box.not(".sBox:eq("+a+")").css(b.extend({zIndex:2},f)).removeClass("adCurrent");d&&d()});p(a)}b(this);j.direction=j.direction;var c={dom:{box:b(".sBox"),first:b(".sBox:first"),sShowItem:b(".sShowItem"),sItemPerson:b(".sItemPerson"),btR:b("#btRight"),btL:b("#btLeft")},n:{boxs:b(".sBox").length}},d=0,i,h=!0;if(!(0>=c.dom.sShowItem.length))c.init=function(){c.dom.box.not(".adCurrent").css(f);b(".sShowItem:first").addClass("sShowCurrent");l()},e.nav&&(c.dom.btL.bind("click",function(a){a.preventDefault();
index=d+1<c.n.boxs?d+1:0;k(index)}),c.dom.btR.bind("click",function(a){a.preventDefault();index=0<d?d-1:c.n.boxs-1;k(index)})),c.dom.sShowItem.bind("click",function(a){a.preventDefault();a=b(this).index();k(a)}),e.hover&&c.dom.box.hover(function(){m(function(){})},function(){h=!0;l()}),c.init()})}})(jQuery);
