(function(d){var s=function(l,o){var f=d.extend({},d.fn.nivoSlider.defaults,o),g={currentSlide:0,currentImage:"",totalSlides:0,randAnim:"",running:!1,paused:!1,stop:!1},e=d(l);e.data("nivo:vars",g);e.css("position","relative");e.addClass("nivoSlider");var j=e.children();j.each(function(){var c=d(this),h="";c.is("img")||(c.is("a")&&(c.addClass("nivo-imageLink"),h=c),c=c.find("img:first"));var b=c.width();b==0&&(b=c.attr("width"));var k=c.height();k==0&&(k=c.attr("height"));b>e.width()&&e.width(b);
k>e.height()&&e.height(k);h!=""&&h.css("display","none");c.css("display","none");g.totalSlides++});if(f.startSlide>0){if(f.startSlide>=g.totalSlides)f.startSlide=g.totalSlides-1;g.currentSlide=f.startSlide}g.currentImage=d(j[g.currentSlide]).is("img")?d(j[g.currentSlide]):d(j[g.currentSlide]).find("img:first");d(j[g.currentSlide]).is("a")&&d(j[g.currentSlide]).css("display","block");e.css("background",'url("'+g.currentImage.attr("src")+'") no-repeat');e.append(d('<div class="nivo-caption"><p></p></div>').css({display:"none",
opacity:f.captionOpacity}));var t=function(c){var h=d(".nivo-caption",e);if(g.currentImage.attr("title")!=""&&g.currentImage.attr("title")!=void 0){var b=g.currentImage.attr("title");b.substr(0,1)=="#"&&(b=d(b).html());h.css("display")=="block"?h.find("p").fadeOut(c.animSpeed,function(){d(this).html(b);d(this).fadeIn(c.animSpeed)}):h.find("p").html(b);h.fadeIn(c.animSpeed)}else h.fadeOut(c.animSpeed)};t(f);var i=0;!f.manualAdvance&&j.length>1&&(i=setInterval(function(){m(e,j,f,!1)},f.pauseTime));
f.directionNav&&(e.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+f.prevText+'</a><a class="nivo-nextNav">'+f.nextText+"</a></div>"),f.directionNavHide&&(d(".nivo-directionNav",e).hide(),e.hover(function(){d(".nivo-directionNav",e).show()},function(){d(".nivo-directionNav",e).hide()})),d("a.nivo-prevNav",e).live("click",function(){if(g.running)return!1;clearInterval(i);i="";g.currentSlide-=2;m(e,j,f,"prev")}),d("a.nivo-nextNav",e).live("click",function(){if(g.running)return!1;clearInterval(i);
i="";m(e,j,f,"next")}));if(f.controlNav){var r=d('<div class="nivo-controlNav"></div>');e.append(r);for(var n=0;n<j.length;n++)if(f.controlNavThumbs){var p=j.eq(n);p.is("img")||(p=p.find("img:first"));f.controlNavThumbsFromRel?r.append('<a class="nivo-control" rel="'+n+'"><img src="'+p.attr("rel")+'" alt="" /></a>'):r.append('<a class="nivo-control" rel="'+n+'"><img src="'+p.attr("src").replace(f.controlNavThumbsSearch,f.controlNavThumbsReplace)+'" alt="" /></a>')}else r.append('<a class="nivo-control" rel="'+
n+'">'+(n+1)+"</a>");d(".nivo-controlNav a:eq("+g.currentSlide+")",e).addClass("active");d(".nivo-controlNav a",e).live("click",function(){if(g.running)return!1;if(d(this).hasClass("active"))return!1;clearInterval(i);i="";e.css("background",'url("'+g.currentImage.attr("src")+'") no-repeat');g.currentSlide=d(this).attr("rel")-1;m(e,j,f,"control")})}f.keyboardNav&&d(window).keypress(function(c){if(c.keyCode=="37"){if(g.running)return!1;clearInterval(i);i="";g.currentSlide-=2;m(e,j,f,"prev")}if(c.keyCode==
"39"){if(g.running)return!1;clearInterval(i);i="";m(e,j,f,"next")}});f.pauseOnHover&&e.hover(function(){g.paused=!0;clearInterval(i);i=""},function(){g.paused=!1;i==""&&!f.manualAdvance&&(i=setInterval(function(){m(e,j,f,!1)},f.pauseTime))});e.bind("nivo:animFinished",function(){g.running=!1;d(j).each(function(){d(this).is("a")&&d(this).css("display","none")});d(j[g.currentSlide]).is("a")&&d(j[g.currentSlide]).css("display","block");i==""&&!g.paused&&!f.manualAdvance&&(i=setInterval(function(){m(e,
j,f,!1)},f.pauseTime));f.afterChange.call(this)});var q=function(c,h,b){for(var k=0;k<h.slices;k++){var a=Math.round(c.width()/h.slices);k==h.slices-1?c.append(d('<div class="nivo-slice"></div>').css({left:a*k+"px",width:c.width()-a*k+"px",height:"0px",opacity:"0",background:'url("'+b.currentImage.attr("src")+'") no-repeat -'+(a+k*a-a)+"px 0%"})):c.append(d('<div class="nivo-slice"></div>').css({left:a*k+"px",width:a+"px",height:"0px",opacity:"0",background:'url("'+b.currentImage.attr("src")+'") no-repeat -'+
(a+k*a-a)+"px 0%"}))}},u=function(c,h,b){for(var k=Math.round(c.width()/h.boxCols),a=Math.round(c.height()/h.boxRows),f=0;f<h.boxRows;f++)for(var e=0;e<h.boxCols;e++)e==h.boxCols-1?c.append(d('<div class="nivo-box"></div>').css({opacity:0,left:k*e+"px",top:a*f+"px",width:c.width()-k*e+"px",height:a+"px",background:'url("'+b.currentImage.attr("src")+'") no-repeat -'+(k+e*k-k)+"px -"+(a+f*a-a)+"px"})):c.append(d('<div class="nivo-box"></div>').css({opacity:0,left:k*e+"px",top:a*f+"px",width:k+"px",
height:a+"px",background:'url("'+b.currentImage.attr("src")+'") no-repeat -'+(k+e*k-k)+"px -"+(a+f*a-a)+"px"}))},m=function(c,h,b,f){var a=c.data("nivo:vars");a&&a.currentSlide==a.totalSlides-1&&b.lastSlide.call(this);if((!a||a.stop)&&!f)return!1;b.beforeChange.call(this);f?(f=="prev"&&c.css("background",'url("'+a.currentImage.attr("src")+'") no-repeat'),f=="next"&&c.css("background",'url("'+a.currentImage.attr("src")+'") no-repeat')):c.css("background",'url("'+a.currentImage.attr("src")+'") no-repeat');
a.currentSlide++;if(a.currentSlide==a.totalSlides)a.currentSlide=0,b.slideshowEnd.call(this);if(a.currentSlide<0)a.currentSlide=a.totalSlides-1;a.currentImage=d(h[a.currentSlide]).is("img")?d(h[a.currentSlide]):d(h[a.currentSlide]).find("img:first");b.controlNav&&(d(".nivo-controlNav a",c).removeClass("active"),d(".nivo-controlNav a:eq("+a.currentSlide+")",c).addClass("active"));t(b);d(".nivo-slice",c).remove();d(".nivo-box",c).remove();if(b.effect=="random"&&(h=["sliceDownRight","sliceDownLeft",
"sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade","boxRandom","boxRain","boxRainReverse","boxRainGrow","boxRainGrowReverse"],a.randAnim=h[Math.floor(Math.random()*(h.length+1))],a.randAnim==void 0))a.randAnim="fade";if(b.effect.indexOf(",")!=-1&&(h=b.effect.split(","),a.randAnim=h[Math.floor(Math.random()*h.length)],a.randAnim==void 0))a.randAnim="fade";a.running=!0;if(b.effect=="sliceDown"||b.effect=="sliceDownRight"||a.randAnim=="sliceDownRight"||b.effect=="sliceDownLeft"||
a.randAnim=="sliceDownLeft"){q(c,b,a);var e=0,g=0,h=d(".nivo-slice",c);if(b.effect=="sliceDownLeft"||a.randAnim=="sliceDownLeft")h=d(".nivo-slice",c)._reverse();h.each(function(){var a=d(this);a.css({top:"0px"});g==b.slices-1?setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+e):setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.animSpeed)},100+e);e+=50;g++})}else if(b.effect=="sliceUp"||b.effect=="sliceUpRight"||
a.randAnim=="sliceUpRight"||b.effect=="sliceUpLeft"||a.randAnim=="sliceUpLeft"){q(c,b,a);g=e=0;h=d(".nivo-slice",c);if(b.effect=="sliceUpLeft"||a.randAnim=="sliceUpLeft")h=d(".nivo-slice",c)._reverse();h.each(function(){var a=d(this);a.css({bottom:"0px"});g==b.slices-1?setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+e):setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.animSpeed)},100+e);e+=50;g++})}else if(b.effect==
"sliceUpDown"||b.effect=="sliceUpDownRight"||a.randAnim=="sliceUpDown"||b.effect=="sliceUpDownLeft"||a.randAnim=="sliceUpDownLeft"){q(c,b,a);var j=g=e=0,h=d(".nivo-slice",c);if(b.effect=="sliceUpDownLeft"||a.randAnim=="sliceUpDownLeft")h=d(".nivo-slice",c)._reverse();h.each(function(){var a=d(this);g==0?(a.css("top","0px"),g++):(a.css("bottom","0px"),g=0);j==b.slices-1?setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+e):
setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.animSpeed)},100+e);e+=50;j++})}else if(b.effect=="fold"||a.randAnim=="fold")q(c,b,a),g=e=0,d(".nivo-slice",c).each(function(){var a=d(this),f=a.width();a.css({top:"0px",height:"100%",width:"0px"});g==b.slices-1?setTimeout(function(){a.animate({width:f,opacity:"1.0"},b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+e):setTimeout(function(){a.animate({width:f,opacity:"1.0"},b.animSpeed)},100+e);e+=50;g++});else if(b.effect==
"fade"||a.randAnim=="fade"){q(c,b,a);var i=d(".nivo-slice:first",c);i.css({height:"100%",width:c.width()+"px"});i.animate({opacity:"1.0"},b.animSpeed*2,"",function(){c.trigger("nivo:animFinished")})}else if(b.effect=="slideInRight"||a.randAnim=="slideInRight")q(c,b,a),i=d(".nivo-slice:first",c),i.css({height:"100%",width:"0px",opacity:"1"}),i.animate({width:c.width()+"px"},b.animSpeed*2,"",function(){c.trigger("nivo:animFinished")});else if(b.effect=="slideInLeft"||a.randAnim=="slideInLeft")q(c,b,
a),i=d(".nivo-slice:first",c),i.css({height:"100%",width:"0px",opacity:"1",left:"",right:"0px"}),i.animate({width:c.width()+"px"},b.animSpeed*2,"",function(){i.css({left:"0px",right:""});c.trigger("nivo:animFinished")});else if(b.effect=="boxRandom"||a.randAnim=="boxRandom"){u(c,b,a);var m=b.boxCols*b.boxRows,e=g=0,h=s(d(".nivo-box",c));h.each(function(){var a=d(this);g==m-1?setTimeout(function(){a.animate({opacity:"1"},b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+e):setTimeout(function(){a.animate({opacity:"1"},
b.animSpeed)},100+e);e+=20;g++})}else if(b.effect=="boxRain"||a.randAnim=="boxRain"||b.effect=="boxRainReverse"||a.randAnim=="boxRainReverse"||b.effect=="boxRainGrow"||a.randAnim=="boxRainGrow"||b.effect=="boxRainGrowReverse"||a.randAnim=="boxRainGrowReverse"){u(c,b,a);var m=b.boxCols*b.boxRows,l=e=g=0,n=0,o=[];o[l]=[];h=d(".nivo-box",c);if(b.effect=="boxRainReverse"||a.randAnim=="boxRainReverse"||b.effect=="boxRainGrowReverse"||a.randAnim=="boxRainGrowReverse")h=d(".nivo-box",c)._reverse();h.each(function(){o[l][n]=
d(this);n++;n==b.boxCols&&(l++,n=0,o[l]=[])});for(h=0;h<b.boxCols*2;h++){for(var f=h,p=0;p<b.boxRows;p++)f>=0&&f<b.boxCols&&(function(e,f,h,g,k){var i=d(o[e][f]),j=i.width(),l=i.height();(b.effect=="boxRainGrow"||a.randAnim=="boxRainGrow"||b.effect=="boxRainGrowReverse"||a.randAnim=="boxRainGrowReverse")&&i.width(0).height(0);g==k-1?setTimeout(function(){i.animate({opacity:"1",width:j,height:l},b.animSpeed/1.3,"",function(){c.trigger("nivo:animFinished")})},100+h):setTimeout(function(){i.animate({opacity:"1",
width:j,height:l},b.animSpeed/1.3)},100+h)}(p,f,e,g,m),g++),f--;e+=100}}},s=function(c){for(var d,b,e=c.length;e;d=parseInt(Math.random()*e),b=c[--e],c[e]=c[d],c[d]=b);return c},v=function(c){this.console&&typeof console.log!="undefined"&&console.log(c)};this.stop=function(){if(!d(l).data("nivo:vars").stop)d(l).data("nivo:vars").stop=!0,v("Stop Slider")};this.start=function(){if(d(l).data("nivo:vars").stop)d(l).data("nivo:vars").stop=!1,v("Start Slider")};f.afterLoad.call(this);return this};d.fn.nivoSlider=
function(l){return this.each(function(){var o=d(this);if(o.data("nivoslider"))return o.data("nivoslider");var f=new s(this,l);o.data("nivoslider",f)})};d.fn.nivoSlider.defaults={effect:"random",slices:15,boxCols:8,boxRows:4,animSpeed:500,pauseTime:3E3,startSlide:0,directionNav:!0,directionNavHide:!0,controlNav:!0,controlNavThumbs:!1,controlNavThumbsFromRel:!1,controlNavThumbsSearch:".jpg",controlNavThumbsReplace:"_thumb.jpg",keyboardNav:!0,pauseOnHover:!0,manualAdvance:!1,captionOpacity:0.8,prevText:"Prev",
nextText:"Next",beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};d.fn._reverse=[].reverse})(jQuery);
