/* * slides, a slideshow plugin for jquery * intructions: http://slidesjs.com * by: nathan searles, http://nathansearles.com * version: 1.1.8 * updated: june 1st, 2011 * * licensed under the apache license, version 2.0 (the "license"); * you may not use this file except in compliance with the license. * you may obtain a copy of the license at * * http://www.apache.org/licenses/license-2.0 * * unless required by applicable law or agreed to in writing, software * distributed under the license is distributed on an "as is" basis, * without warranties or conditions of any kind, either express or implied. * see the license for the specific language governing permissions and * limitations under the license. */ (function(a){a.fn.slides=function(b){b=a.extend({},a.fn.slides.option,b);return this.each(function(){a("."+b.container,a(this)).children().wrapall('
');var v=a(this),j=a(".slides_control",v),z=j.children().size(),q=j.children().outerwidth(),m=j.children().outerheight(),d=b.start-1,l=b.effect.indexof(",")<0?b.effect:b.effect.replace(" ","").split(",")[0],s=b.effect.indexof(",")<0?l:b.effect.replace(" ","").split(",")[1],o=0,n=0,c=0,p=0,u,h,i,x,w,t,k,f;function e(c,b,a){if(!h&&u){h=true;b.animationstart(p+1);switch(c){case"next":n=p;o=p+1;o=z===o?0:o;x=q*2;c=-q*2;p=o;break;case"prev":n=p;o=p-1;o=o===-1?z-1:o;x=0;c=0;p=o;break;case"pagination":o=parseint(a,10);n=a("."+b.paginationclass+" li."+b.currentclass+" a",v).attr("href").match("[^#/]+$");if(o>n){x=q*2;c=-q*2;}else{x=0;c=0;}p=o;break;}if(b==="fade"){if(b.crossfade){j.children(":eq("+o+")",v).css({zindex:10}).fadein(b.fadespeed,b.fadeeasing,function(){if(b.autoheight){j.animate({height:j.children(":eq("+o+")",v).outerheight()},b.autoheightspeed,function(){j.children(":eq("+n+")",v).css({display:"none",zindex:0});j.children(":eq("+o+")",v).css({zindex:0});b.animationcomplete(o+1);h=false;});}else{j.children(":eq("+n+")",v).css({display:"none",zindex:0});j.children(":eq("+o+")",v).css({zindex:0});b.animationcomplete(o+1);h=false;}});}else{j.children(":eq("+n+")",v).fadeout(b.fadespeed,b.fadeeasing,function(){if(b.autoheight){j.animate({height:j.children(":eq("+o+")",v).outerheight()},b.autoheightspeed,function(){j.children(":eq("+o+")",v).fadein(b.fadespeed,b.fadeeasing);});}else{j.children(":eq("+o+")",v).fadein(b.fadespeed,b.fadeeasing,function(){if(a.browser.msie){a(this).get(0).style.removeattribute("filter");}});}b.animationcomplete(o+1);h=false;});}}else{j.children(":eq("+o+")").css({left:x,display:"block"});if(b.autoheight){j.animate({left:c,height:j.children(":eq("+o+")").outerheight()},b.slidespeed,b.slideeasing,function(){j.css({left:-q});j.children(":eq("+o+")").css({left:q,zindex:5});j.children(":eq("+n+")").css({left:q,display:"none",zindex:0});b.animationcomplete(o+1);h=false;});}else{j.animate({left:c},b.slidespeed,b.slideeasing,function(){j.css({left:-q});j.children(":eq("+o+")").css({left:q,zindex:5});j.children(":eq("+n+")").css({left:q,display:"none",zindex:0});b.animationcomplete(o+1);h=false;});}}if(b.pagination){a("."+b.paginationclass+" li."+b.currentclass,v).removeclass(b.currentclass);a("."+b.paginationclass+" li:eq("+o+")",v).addclass(b.currentclass);}}}function r(){clearinterval(v.data("interval"));}function g(){if(b.pause){cleartimeout(v.data("pause"));clearinterval(v.data("interval"));k=settimeout(function(){cleartimeout(v.data("pause"));f=setinterval(function(){e("next",l);},b.play);v.data("interval",f);},b.pause);v.data("pause",k);}else{r();}}if(z<2){return ;}if(d<0){d=0;}if(d>z){d=z-1;}if(b.start){p=d;}if(b.randomize){j.randomize();}a("."+b.container,v).css({overflow:"hidden",position:"relative"});j.children().css({position:"absolute",top:0,left:j.children().outerwidth(),zindex:0,display:"none"});j.css({position:"relative",width:(q*3),height:m,left:-q});a("."+b.container,v).css({display:"block"});if(b.autoheight){j.children().css({height:"auto"});j.animate({height:j.children(":eq("+d+")").outerheight()},b.autoheightspeed);}if(b.preload&&j.find("img:eq("+d+")").length){a("."+b.container,v).css({background:"url("+b.preloadimage+") no-repeat 50% 50%"});var y=j.find("img:eq("+d+")").attr("src")+"?"+(new date()).gettime();if(a("img",v).parent().attr("class")!="slides_control"){t=j.children(":eq(0)")[0].tagname.tolowercase();}else{t=j.find("img:eq("+d+")");}j.find("img:eq("+d+")").attr("src",y).load(function(){j.find(t+":eq("+d+")").fadein(b.fadespeed,b.fadeeasing,function(){a(this).css({zindex:5});a("."+b.container,v).css({background:""});u=true;b.slidesloaded();});});}else{j.children(":eq("+d+")").fadein(b.fadespeed,b.fadeeasing,function(){u=true;b.slidesloaded();});}if(b.bigtarget){j.children().css({cursor:"pointer"});j.children().click(function(){e("next",l);return false;});}if(b.hoverpause&&b.play){j.bind("mouseover",function(){r();});j.bind("mouseleave",function(){g();});}if(b.generatenextprev){a("."+b.container,v).after('prev');a("."+b.prev,v).after('next');}a("."+b.next,v).click(function(a){a.preventdefault();if(b.play){g();}e("next",l);});a("."+b.prev,v).click(function(a){a.preventdefault();if(b.play){g();}e("prev",l);});if(b.generatepagination){if(b.prependpagination){v.prepend("");}else{v.append("");}j.children().each(function(){a("."+b.paginationclass,v).append('
  • '+(c+1)+"
  • ");c++;});}else{a("."+b.paginationclass+" li a",v).each(function(){a(this).attr("href","#"+c);c++;});}a("."+b.paginationclass+" li:eq("+d+")",v).addclass(b.currentclass);a("."+b.paginationclass+" li a",v).click(function(){if(b.play){g();}i=a(this).attr("href").match("[^#/]+$");if(p!=i){e("pagination",s,i);}return false;});a("a.link",v).click(function(){if(b.play){g();}i=a(this).attr("href").match("[^#/]+$")-1;if(p!=i){e("pagination",s,i);}return false;});if(b.play){f=setinterval(function(){e("next",l);},b.play);v.data("interval",f);}});};a.fn.slides.option={preload:false,preloadimage:"/img/loading.gif",container:"slides_container",generatenextprev:false,next:"next",prev:"prev",pagination:true,generatepagination:true,prependpagination:false,paginationclass:"pagination",currentclass:"current",fadespeed:350,fadeeasing:"",slidespeed:350,slideeasing:"",start:1,effect:"slide",crossfade:false,randomize:false,play:0,pause:0,hoverpause:false,autoheight:false,autoheightspeed:350,bigtarget:false,animationstart:function(){},animationcomplete:function(){},slidesloaded:function(){}};a.fn.randomize=function(c){function b(){return(math.round(math.random())-0.5);}return(a(this).each(function(){var f=a(this);var e=f.children();var d=e.length;if(d>1){e.hide();var g=[];for(i=0;i