(function(d){d.fn.slides=function(a){return a=d.extend({},d.fn.slides.option,a),this.each(function(){function j(f,j,n){if(!o&&s){o=!0;a.animationStart(k+1);switch(f){case "next":l=k;e=k+1;e=g===e?0:e;q=h*2;f=-h*2;k=e;break;case "prev":l=k;e=k-1;e=e===-1?g-1:e;q=0;f=0;k=e;break;case "pagination":e=parseInt(n,10),l=d("."+a.paginationClass+" li."+a.currentClass+" a",c).attr("href").match("[^#/]+$"),e>l?(q=h*2,f=-h*2):(q=0,f=0),k=e}j==="fade"?a.crossfade?b.children(":eq("+e+")",c).css({zIndex:10}).fadeIn(a.fadeSpeed,
a.fadeEasing,function(){a.autoHeight?b.animate({height:b.children(":eq("+e+")",c).outerHeight()},a.autoHeightSpeed,function(){b.children(":eq("+l+")",c).css({display:"none",zIndex:0});b.children(":eq("+e+")",c).css({zIndex:0});a.animationComplete(e+1);o=!1}):(b.children(":eq("+l+")",c).css({display:"none",zIndex:0}),b.children(":eq("+e+")",c).css({zIndex:0}),a.animationComplete(e+1),o=!1)}):b.children(":eq("+l+")",c).fadeOut(a.fadeSpeed,a.fadeEasing,function(){a.autoHeight?b.animate({height:b.children(":eq("+
e+")",c).outerHeight()},a.autoHeightSpeed,function(){b.children(":eq("+e+")",c).fadeIn(a.fadeSpeed,a.fadeEasing)}):b.children(":eq("+e+")",c).fadeIn(a.fadeSpeed,a.fadeEasing,function(){d.browser.msie&&d(this).get(0).style.removeAttribute("filter")});a.animationComplete(e+1);o=!1}):(b.children(":eq("+e+")").css({left:q,display:"block"}),a.autoHeight?b.animate({left:f,height:b.children(":eq("+e+")").outerHeight()},a.slideSpeed,a.slideEasing,function(){b.css({left:-h});b.children(":eq("+e+")").css({left:h,
zIndex:5});b.children(":eq("+l+")").css({left:h,display:"none",zIndex:0});a.animationComplete(e+1);o=!1}):b.animate({left:f},a.slideSpeed,a.slideEasing,function(){b.css({left:-h});b.children(":eq("+e+")").css({left:h,zIndex:5});b.children(":eq("+l+")").css({left:h,display:"none",zIndex:0});a.animationComplete(e+1);o=!1}));a.pagination&&(d("."+a.paginationClass+" li."+a.currentClass,c).removeClass(a.currentClass),d("."+a.paginationClass+" li:eq("+e+")",c).addClass(a.currentClass))}}function m(){a.pause?
(clearTimeout(c.data("pause")),clearInterval(c.data("interval")),w=setTimeout(function(){clearTimeout(c.data("pause"));t=setInterval(function(){j("next",n)},a.play);c.data("interval",t)},a.pause),c.data("pause",w)):clearInterval(c.data("interval"))}d("."+a.container,d(this)).children().wrapAll('<div class="slides_control"/>');var c=d(this),b=d(".slides_control",c),g=b.children().size(),h=b.children().outerWidth(),u=b.children().outerHeight(),f=a.start-1,n=a.effect.indexOf(",")<0?a.effect:a.effect.replace(" ",
"").split(",")[0],x=a.effect.indexOf(",")<0?n:a.effect.replace(" ","").split(",")[1],e=0,l=0,r=0,k=0,s,o,p,q,v,w,t;if(g<2)return d("."+a.container,d(this)).fadeIn(a.fadeSpeed,a.fadeEasing,function(){s=!0;a.slidesLoaded()}),d("."+a.next+", ."+a.prev).fadeOut(0),!1;g<2||(f<0&&(f=0),f>g&&(f=g-1),a.start&&(k=f),a.randomize&&b.randomize(),d("."+a.container,c).css({overflow:"hidden",position:"relative"}),b.children().css({position:"absolute",top:0,left:b.children().outerWidth(),zIndex:0,display:"none"}),
b.css({position:"relative",width:h*3,height:u,left:-h}),d("."+a.container,c).css({display:"block"}),a.autoHeight&&(b.children().css({height:"auto"}),b.animate({height:b.children(":eq("+f+")").outerHeight()},a.autoHeightSpeed)),a.preload&&b.find("img:eq("+f+")").length?(d("."+a.container,c).css({background:"url("+a.preloadImage+") no-repeat 50% 50%"}),u=b.find("img:eq("+f+")").attr("src")+"?"+(new Date).getTime(),d("img",c).parent().attr("class")!="slides_control"?v=b.children(":eq(0)")[0].tagName.toLowerCase():
v=b.find("img:eq("+f+")"),b.find("img:eq("+f+")").attr("src",u).load(function(){b.find(v+":eq("+f+")").fadeIn(a.fadeSpeed,a.fadeEasing,function(){d(this).css({zIndex:5});d("."+a.container,c).css({background:""});s=!0;a.slidesLoaded()})})):b.children(":eq("+f+")").fadeIn(a.fadeSpeed,a.fadeEasing,function(){s=!0;a.slidesLoaded()}),a.bigTarget&&(b.children().css({cursor:"pointer"}),b.children().click(function(){return j("next",n),!1})),a.hoverPause&&a.play&&(b.bind("mouseover",function(){clearInterval(c.data("interval"))}),
b.bind("mouseleave",function(){m()})),a.generateNextPrev&&(d("."+a.container,c).after('<a href="#" class="'+a.prev+'">Prev</a>'),d("."+a.prev,c).after('<a href="#" class="'+a.next+'">Next</a>')),d("."+a.next,c).click(function(b){b.preventDefault();a.play&&m();j("next",n)}),d("."+a.prev,c).click(function(b){b.preventDefault();a.play&&m();j("prev",n)}),a.generatePagination?(a.prependPagination?c.prepend("<ul class="+a.paginationClass+"></ul>"):c.append("<ul class="+a.paginationClass+"></ul>"),b.children().each(function(){d("."+
a.paginationClass,c).append('<li><a href="#'+r+'">'+(r+1)+"</a></li>");r++})):d("."+a.paginationClass+" li a",c).each(function(){d(this).attr("href","#"+r);r++}),d("."+a.paginationClass+" li:eq("+f+")",c).addClass(a.currentClass),d("."+a.paginationClass+" li a",c).click(function(){return a.play&&m(),p=d(this).attr("href").match("[^#/]+$"),k!=p&&j("pagination",x,p),!1}),d("a.link",c).click(function(){return a.play&&m(),p=d(this).attr("href").match("[^#/]+$")-1,k!=p&&j("pagination",x,p),!1}),a.play&&
(t=setInterval(function(){j("next",n)},a.play),c.data("interval",t)))})};d.fn.slides.option={preload:!1,preloadImage:"/img/loading.gif",container:"slides_container",generateNextPrev:!1,next:"next",prev:"prev",pagination:!0,generatePagination:!0,prependPagination:!1,paginationClass:"pagination",currentClass:"current",fadeSpeed:350,fadeEasing:"",slideSpeed:350,slideEasing:"",start:1,effect:"slide",crossfade:!1,randomize:!1,play:0,pause:0,hoverPause:!1,autoHeight:!1,autoHeightSpeed:350,bigTarget:!1,
animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}};d.fn.randomize=function(a){function j(){return Math.round(Math.random())-0.5}return d(this).each(function(){var m=d(this),c=m.children(),b=c.length;if(b>1){c.hide();var g=[];for(i=0;i<b;i++)g[g.length]=i;g=g.sort(j);d.each(g,function(b,d){var f=c.eq(d),g=f.clone(!0);g.show().appendTo(m);a!==void 0&&a(f,g);f.remove()})}})}})(jQuery);

