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