/* * jquery nivo slider v2.3 * http://nivo.dev7studios.com * * copyright 2010, gilbert pellegrom * free to use and abuse under the mit license. * http://www.opensource.org/licenses/mit-license.php */ (function(b){var a=function(j,q){var g=b.extend({},b.fn.nivoslider.defaults,q);var m={currentslide:0,currentimage:"",totalslides:0,randanim:"",running:false,paused:false,stop:false};var d=b(j);d.data("nivo:vars",m);d.css("position","relative");d.addclass("nivoslider");var e=d.children();e.each(function(){var t=b(this);var s="";if(!t.is("img")){if(t.is("a")){t.addclass("nivo-imagelink");s=t}t=t.find("img:first")}var r=t.width();if(r==0){r=t.attr("width")}var i=t.height();if(i==0){i=t.attr("height")}if(r>d.width()){d.width(r)}if(i>d.height()){d.height(i)}if(s!=""){s.css("display","none")}t.css("display","none");m.totalslides++});if(g.startslide>0){if(g.startslide>=m.totalslides){g.startslide=m.totalslides-1}m.currentslide=g.startslide}if(b(e[m.currentslide]).is("img")){m.currentimage=b(e[m.currentslide])}else{m.currentimage=b(e[m.currentslide]).find("img:first")}if(b(e[m.currentslide]).is("a")){b(e[m.currentslide]).css("display","block")}d.css("background","url("+m.currentimage.attr("src")+") no-repeat");for(var k=0;k').css({left:(o*k)+"px",width:(d.width()-(o*k))+"px"}))}else{d.append(b('
').css({left:(o*k)+"px",width:o+"px"}))}}d.append(b('

').css({display:"none",opacity:g.captionopacity}));if(m.currentimage.attr("title")!=""){var n=m.currentimage.attr("title");if(n.substr(0,1)=="#"){n=b(n).html()}b(".nivo-caption p",d).html(n);b(".nivo-caption",d).fadein(g.animspeed)}var c=0;if(!g.manualadvance&&e.length>1){c=setinterval(function(){p(d,e,g,false)},g.pausetime)}if(g.directionnav){d.append('
prevnext
');if(g.directionnavhide){b(".nivo-directionnav",d).hide();d.hover(function(){b(".nivo-directionnav",d).show()},function(){b(".nivo-directionnav",d).hide()})}b("a.nivo-prevnav",d).live("click",function(){if(m.running){return false}clearinterval(c);c="";m.currentslide-=2;p(d,e,g,"prev")});b("a.nivo-nextnav",d).live("click",function(){if(m.running){return false}clearinterval(c);c="";p(d,e,g,"next")})}if(g.controlnav){var l=b('
');d.append(l);for(var k=0;k')}else{l.append('')}}else{l.append(''+(k+1)+"")}}b(".nivo-controlnav a:eq("+m.currentslide+")",d).addclass("active");b(".nivo-controlnav a",d).live("click",function(){if(m.running){return false}if(b(this).hasclass("active")){return false}clearinterval(c);c="";d.css("background","url("+m.currentimage.attr("src")+") no-repeat");m.currentslide=b(this).attr("rel")-1;p(d,e,g,"control")})}if(g.keyboardnav){b(window).keypress(function(i){if(i.keycode=="37"){if(m.running){return false}clearinterval(c);c="";m.currentslide-=2;p(d,e,g,"prev")}if(i.keycode=="39"){if(m.running){return false}clearinterval(c);c="";p(d,e,g,"next")}})}if(g.pauseonhover){d.hover(function(){m.paused=true;clearinterval(c);c=""},function(){m.paused=false;if(c==""&&!g.manualadvance){c=setinterval(function(){p(d,e,g,false)},g.pausetime)}})}d.bind("nivo:animfinished",function(){m.running=false;b(e).each(function(){if(b(this).is("a")){b(this).css("display","none")}});if(b(e[m.currentslide]).is("a")){b(e[m.currentslide]).css("display","block")}if(c==""&&!m.paused&&!g.manualadvance){c=setinterval(function(){p(d,e,g,false)},g.pausetime)}g.afterchange.call(this)});var p=function(r,s,u,x){var y=r.data("nivo:vars");if(y&&(y.currentslide==y.totalslides-1)){u.lastslide.call(this)}if((!y||y.stop)&&!x){return false}u.beforechange.call(this);if(!x){r.css("background","url("+y.currentimage.attr("src")+") no-repeat")}else{if(x=="prev"){r.css("background","url("+y.currentimage.attr("src")+") no-repeat")}if(x=="next"){r.css("background","url("+y.currentimage.attr("src")+") no-repeat")}}y.currentslide++;if(y.currentslide==y.totalslides){y.currentslide=0;u.slideshowend.call(this)}if(y.currentslide<0){y.currentslide=(y.totalslides-1)}if(b(s[y.currentslide]).is("img")){y.currentimage=b(s[y.currentslide])}else{y.currentimage=b(s[y.currentslide]).find("img:first")}if(u.controlnav){b(".nivo-controlnav a",r).removeclass("active");b(".nivo-controlnav a:eq("+y.currentslide+")",r).addclass("active")}if(y.currentimage.attr("title")!=""){var z=y.currentimage.attr("title");if(z.substr(0,1)=="#"){z=b(z).html()}if(b(".nivo-caption",r).css("display")=="block"){b(".nivo-caption p",r).fadeout(u.animspeed,function(){b(this).html(z);b(this).fadein(u.animspeed)})}else{b(".nivo-caption p",r).html(z)}b(".nivo-caption",r).fadein(u.animspeed)}else{b(".nivo-caption",r).fadeout(u.animspeed)}var w=0;b(".nivo-slice",r).each(function(){var i=math.round(r.width()/u.slices);b(this).css({height:"0px",opacity:"0",background:"url("+y.currentimage.attr("src")+") no-repeat -"+((i+(w*i))-i)+"px 0%"});w++});if(u.effect=="random"){var a=new array("slicedownright","slicedownleft","sliceupright","sliceupleft","sliceupdown","sliceupdownleft","fold","fade");y.randanim=a[math.floor(math.random()*(a.length+1))];if(y.randanim==undefined){y.randanim="fade"}}if(u.effect.indexof(",")!=-1){var a=u.effect.split(",");y.randanim=b.trim(a[math.floor(math.random()*a.length)])}y.running=true;if(u.effect=="slicedown"||u.effect=="slicedownright"||y.randanim=="slicedownright"||u.effect=="slicedownleft"||y.randanim=="slicedownleft"){var t=0;var w=0;var c=b(".nivo-slice",r);if(u.effect=="slicedownleft"||y.randanim=="slicedownleft"){c=b(".nivo-slice",r)._reverse()}c.each(function(){var i=b(this);i.css("top","0px");if(w==u.slices-1){settimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animspeed,"",function(){r.trigger("nivo:animfinished")})},(100+t))}else{settimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animspeed)},(100+t))}t+=50;w++})}else{if(u.effect=="sliceup"||u.effect=="sliceupright"||y.randanim=="sliceupright"||u.effect=="sliceupleft"||y.randanim=="sliceupleft"){var t=0;var w=0;var c=b(".nivo-slice",r);if(u.effect=="sliceupleft"||y.randanim=="sliceupleft"){c=b(".nivo-slice",r)._reverse()}c.each(function(){var i=b(this);i.css("bottom","0px");if(w==u.slices-1){settimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animspeed,"",function(){r.trigger("nivo:animfinished")})},(100+t))}else{settimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animspeed)},(100+t))}t+=50;w++})}else{if(u.effect=="sliceupdown"||u.effect=="sliceupdownright"||y.randanim=="sliceupdown"||u.effect=="sliceupdownleft"||y.randanim=="sliceupdownleft"){var t=0;var w=0;var b=0;var c=b(".nivo-slice",r);if(u.effect=="sliceupdownleft"||y.randanim=="sliceupdownleft"){c=b(".nivo-slice",r)._reverse()}c.each(function(){var i=b(this);if(w==0){i.css("top","0px");w++}else{i.css("bottom","0px");w=0}if(b==u.slices-1){settimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animspeed,"",function(){r.trigger("nivo:animfinished")})},(100+t))}else{settimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animspeed)},(100+t))}t+=50;b++})}else{if(u.effect=="fold"||y.randanim=="fold"){var t=0;var w=0;b(".nivo-slice",r).each(function(){var i=b(this);var v=i.width();i.css({top:"0px",height:"100%",width:"0px"});if(w==u.slices-1){settimeout(function(){i.animate({width:v,opacity:"1.0"},u.animspeed,"",function(){r.trigger("nivo:animfinished")})},(100+t))}else{settimeout(function(){i.animate({width:v,opacity:"1.0"},u.animspeed)},(100+t))}t+=50;w++})}else{if(u.effect=="fade"||y.randanim=="fade"){var w=0;b(".nivo-slice",r).each(function(){b(this).css("height","100%");if(w==u.slices-1){b(this).animate({opacity:"1.0"},(u.animspeed*2),"",function(){r.trigger("nivo:animfinished")})}else{b(this).animate({opacity:"1.0"},(u.animspeed*2))}w++})}}}}}};var h=function(i){if(this.console&&typeof console.log!="undefined"){console.log(i)}};this.stop=function(){if(!b(j).data("nivo:vars").stop){b(j).data("nivo:vars").stop=true;h("stop slider")}};this.start=function(){if(b(j).data("nivo:vars").stop){b(j).data("nivo:vars").stop=false;h("start slider")}};g.afterload.call(this)};b.fn.nivoslider=function(c){return this.each(function(){var d=b(this);if(d.data("nivoslider")){return}var e=new a(this,c);d.data("nivoslider",e)})};b.fn.nivoslider.defaults={effect:"random",slices:15,animspeed:500,pausetime:10000,startslide:0,directionnav:true,directionnavhide:true,controlnav:true,controlnavthumbs:false,controlnavthumbsfromrel:false,controlnavthumbssearch:".jpg",controlnavthumbsreplace:"_thumb.jpg",keyboardnav:true,pauseonhover:true,manualadvance:false,captionopacity:0.8,beforechange:function(){},afterchange:function(){},slideshowend:function(){},lastslide:function(){},afterload:function(){}};b.fn._reverse=[].reverse})(jquery);