(function(d){d.fn.slides=function(a){a=d.extend({},d.fn.slides.option,a);return this.each(function(){function g(f,g,n){if(!o&&t){o=!0;a.animationStart(j+1);switch(f){case "next":l=j;e=j+1;e=k===e?0:e;q=h*2;f=-h*2;j=e;break;case "prev":l=j;e=j-1;e=e===-1?k-1:e;f=q=0;j=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):f=q=0,j=e}g==="fade"?a.crossfade?b.children(":not(code):eq("+e+")",c).css({zIndex:10}).fadeIn(a.fadeSpeed,
a.fadeEasing,function(){a.autoHeight?b.animate({height:b.children(":not(code):eq("+e+")",c).outerHeight()},a.autoHeightSpeed,function(){b.children(":not(code):eq("+l+")",c).css({display:"none",zIndex:0});b.children(":not(code):eq("+e+")",c).css({zIndex:0});a.animationComplete(e+1);o=!1}):(b.children(":not(code):eq("+l+")",c).css({display:"none",zIndex:0}),b.children(":not(code):eq("+e+")",c).css({zIndex:0}),a.animationComplete(e+1),o=!1)}):b.children(":not(code):eq("+l+")",c).fadeOut(a.fadeSpeed,
a.fadeEasing,function(){a.autoHeight?b.animate({height:b.children(":not(code):eq("+e+")",c).outerHeight()},a.autoHeightSpeed,function(){b.children(":not(code):eq("+e+")",c).fadeIn(a.fadeSpeed,a.fadeEasing)}):b.children(":not(code):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(":not(code):eq("+e+")").css({left:q,display:"block"}),a.autoHeight?b.animate({left:f,height:b.children(":not(code):eq("+
e+")").outerHeight()},a.slideSpeed,a.slideEasing,function(){b.css({left:-h});b.children(":not(code):eq("+e+")").css({left:h,zIndex:5});b.children(":not(code):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(":not(code):eq("+e+")").css({left:h,zIndex:5});b.children(":not(code):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")),v=setTimeout(function(){clearTimeout(c.data("pause"));s=setInterval(function(){g("next",n)},a.play);c.data("interval",s)},a.pause),c.data("pause",v)):clearInterval(c.data("interval"))}d("."+a.container,d(this)).children().wrapAll('<div class="slides_control"/>');var c=d(this),b=d(".slides_control",
c),k=b.children(":not(code)").size(),h=b.children(":not(code)").outerWidth(),u=b.children(":not(code)").outerHeight(),f=a.start-1,n=a.effect.indexOf(",")<0?a.effect:a.effect.replace(" ","").split(",")[0],w=a.effect.indexOf(",")<0?n:a.effect.replace(" ","").split(",")[1],e=0,l=0,r=0,j=0,t,o,p,q,x,v,s;k<2||(f<0&&(f=0),f>k&&(f=k-1),a.start&&(j=f),a.randomize&&b.randomize(),d("."+a.container,c).css({overflow:"hidden",position:"relative"}),b.children(":not(code)").css({position:"absolute",top:0,left:b.children(":not(code)").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(":not(code)").css({height:"auto"}),b.animate({height:b.children(":not(code):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(),x=d("img",c).parent().attr("class")!=
"slides_control"?b.children(":not(code):eq(0)")[0].tagName.toLowerCase():b.find("img:eq("+f+")"),b.find("img:eq("+f+")").attr("src",u).load(function(){b.find(x+":eq("+f+")").fadeIn(a.fadeSpeed,a.fadeEasing,function(){d(this).css({zIndex:5});d("."+a.container,c).css({background:""});t=!0;a.slidesLoaded()})})):b.children(":not(code):eq("+f+")").fadeIn(a.fadeSpeed,a.fadeEasing,function(){t=!0;a.slidesLoaded()}),a.bigTarget&&(b.children(":not(code)").css({cursor:"pointer"}),b.children(":not(code)").click(function(){g("next",
n);return!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();g("next",n)}),d("."+a.prev,c).click(function(b){b.preventDefault();a.play&&m();g("prev",n)}),a.generatePagination?(a.prependPagination?c.prepend("<ul class="+
a.paginationClass+"></ul>"):c.append("<ul class="+a.paginationClass+"></ul>"),b.children(":not(code)").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(){a.play&&m();p=d(this).attr("href").match("[^#/]+$");j!=p&&g("pagination",w,p);return!1}),d("a.link",
c).click(function(){a.play&&m();p=d(this).attr("href").match("[^#/]+$")-1;j!=p&&g("pagination",w,p);return!1}),a.play&&(s=setInterval(function(){g("next",n)},a.play),c.data("interval",s)))})};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 g(){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 k=[];for(i=0;i<b;i++)k[k.length]=i;k=k.sort(g);d.each(k,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);
