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