//MANUALLY ADDED
jQuery(function($){
	
	$('.ad_vert_left, .ad_vert_right').each(function(){
		var $div = $(this)
			, $nvio = $('<div/>');
		$div.addClass('ad_vert');
		$nvio.append($div.children().remove())
		$div.append($nvio);
		$nvio.nivoSlider({
			effect:'fade',
			animSpeed:500,
			pauseTime:6000,
			directionNav:false,
			controlNav:false,
			pauseOnHover:false
		});
	});
	
	$('#nivo-slider').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:500,
		pauseTime:4000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	
});


/*
 * jQuery Nivo Slider v2.1
 * 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
 * 
 * May 2010 - Pick random effect from specified set of effects by toronegro
 * May 2010 - controlNavThumbsFromRel option added by nerd-sh
 * May 2010 - Do not start nivoRun timer if there is only 1 slide by msielski
 * April 2010 - controlNavThumbs option added by Jamie Thompson (http://jamiethompson.co.uk)
 * March 2010 - manualAdvance option added by HelloPablo (http://hellopablo.co.uk)
 */

(function(a){a.fn.nivoSlider=function(o){function l(c,d,b,i){var e=c.data("nivo:vars");if((!e||e.stop)&&!i)return false;b.beforeChange.call(this);if(i){i=="prev"&&c.css("background","url("+e.currentImage.attr("src")+") no-repeat");i=="next"&&c.css("background","url("+e.currentImage.attr("src")+") no-repeat")}else c.css("background","url("+e.currentImage.attr("src")+") no-repeat");e.currentSlide++;if(e.currentSlide==e.totalSlides){e.currentSlide=0;b.slideshowEnd.call(this)}if(e.currentSlide<0)e.currentSlide=
e.totalSlides-1;e.currentImage=a(d[e.currentSlide]).is("img")?a(d[e.currentSlide]):a(d[e.currentSlide]).find("img:first");if(b.controlNav){a(".nivo-controlNav a",c).removeClass("active");a(".nivo-controlNav a:eq("+e.currentSlide+")",c).addClass("active")}if(e.currentImage.attr("title")!=""){var k=e.currentImage.attr("title");if(k.substr(0,1)=="#")k=a(k).html();a(".nivo-caption",c).css("display")=="block"?a(".nivo-caption p",c).fadeOut(b.animSpeed,function(){a(this).html(k);a(this).fadeIn(b.animSpeed)}):
a(".nivo-caption p",c).html(k);a(".nivo-caption",c).fadeIn(b.animSpeed)}else a(".nivo-caption",c).fadeOut(b.animSpeed);var j=0;a(".nivo-slice",c).each(function(){var h=Math.round(c.width()/b.slices);a(this).css({height:"0px",opacity:"0",background:"url("+e.currentImage.attr("src")+") no-repeat -"+(h+j*h-h)+"px 0%"});j++});if(b.effect=="random"){d=["sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade"];e.randAnim=d[Math.floor(Math.random()*(d.length+
1))];if(e.randAnim==undefined)e.randAnim="fade"}if(b.effect.indexOf(",")!=-1){d=b.effect.split(",");e.randAnim=a.trim(d[Math.floor(Math.random()*d.length)])}e.running=true;if(b.effect=="sliceDown"||b.effect=="sliceDownRight"||e.randAnim=="sliceDownRight"||b.effect=="sliceDownLeft"||e.randAnim=="sliceDownLeft"){var g=0;j=0;d=a(".nivo-slice",c);if(b.effect=="sliceDownLeft"||e.randAnim=="sliceDownLeft")d=a(".nivo-slice",c)._reverse();d.each(function(){var h=a(this);h.css("top","0px");j==b.slices-1?setTimeout(function(){h.animate({height:"100%",
opacity:"1.0"},b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+g):setTimeout(function(){h.animate({height:"100%",opacity:"1.0"},b.animSpeed)},100+g);g+=50;j++})}else if(b.effect=="sliceUp"||b.effect=="sliceUpRight"||e.randAnim=="sliceUpRight"||b.effect=="sliceUpLeft"||e.randAnim=="sliceUpLeft"){j=g=0;d=a(".nivo-slice",c);if(b.effect=="sliceUpLeft"||e.randAnim=="sliceUpLeft")d=a(".nivo-slice",c)._reverse();d.each(function(){var h=a(this);h.css("bottom","0px");j==b.slices-1?setTimeout(function(){h.animate({height:"100%",
opacity:"1.0"},b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+g):setTimeout(function(){h.animate({height:"100%",opacity:"1.0"},b.animSpeed)},100+g);g+=50;j++})}else if(b.effect=="sliceUpDown"||b.effect=="sliceUpDownRight"||e.randAnim=="sliceUpDown"||b.effect=="sliceUpDownLeft"||e.randAnim=="sliceUpDownLeft"){var n=j=g=0;d=a(".nivo-slice",c);if(b.effect=="sliceUpDownLeft"||e.randAnim=="sliceUpDownLeft")d=a(".nivo-slice",c)._reverse();d.each(function(){var h=a(this);if(j==0){h.css("top",
"0px");j++}else{h.css("bottom","0px");j=0}n==b.slices-1?setTimeout(function(){h.animate({height:"100%",opacity:"1.0"},b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+g):setTimeout(function(){h.animate({height:"100%",opacity:"1.0"},b.animSpeed)},100+g);g+=50;n++})}else if(b.effect=="fold"||e.randAnim=="fold"){j=g=0;a(".nivo-slice",c).each(function(){var h=a(this),m=h.width();h.css({top:"0px",height:"100%",width:"0px"});j==b.slices-1?setTimeout(function(){h.animate({width:m,opacity:"1.0"},
b.animSpeed,"",function(){c.trigger("nivo:animFinished")})},100+g):setTimeout(function(){h.animate({width:m,opacity:"1.0"},b.animSpeed)},100+g);g+=50;j++})}else if(b.effect=="fade"||e.randAnim=="fade"){j=0;a(".nivo-slice",c).each(function(){a(this).css("height","100%");j==b.slices-1?a(this).animate({opacity:"1.0"},b.animSpeed*2,"",function(){c.trigger("nivo:animFinished")}):a(this).animate({opacity:"1.0"},b.animSpeed*2);j++})}}var f=a.extend({},a.fn.nivoSlider.defaults,o);return this.each(function(){var c=
{currentSlide:0,currentImage:"",totalSlides:0,randAnim:"",running:false,paused:false,stop:false},d=a(this);d.data("nivo:vars",c);d.css("position","relative");d.addClass("nivoSlider");var b=d.children();b.each(function(){var g=a(this),n="";if(!g.is("img")){if(g.is("a")){g.addClass("nivo-imageLink");n=g}g=g.find("img:first")}var h=g.width();if(h==0)h=g.attr("width");var m=g.height();if(m==0)m=g.attr("height");h>d.width()&&d.width(h);m>d.height()&&d.height(m);n!=""&&n.css("display","none");g.css("display",
"none");c.totalSlides++});if(f.startSlide>0){if(f.startSlide>=c.totalSlides)f.startSlide=c.totalSlides-1;c.currentSlide=f.startSlide}c.currentImage=a(b[c.currentSlide]).is("img")?a(b[c.currentSlide]):a(b[c.currentSlide]).find("img:first");a(b[c.currentSlide]).is("a")&&a(b[c.currentSlide]).css("display","block");d.css("background","url("+c.currentImage.attr("src")+") no-repeat");for(var i=0;i<f.slices;i++){var e=Math.round(d.width()/f.slices);i==f.slices-1?d.append(a('<div class="nivo-slice"></div>').css({left:e*
i+"px",width:d.width()-e*i+"px"})):d.append(a('<div class="nivo-slice"></div>').css({left:e*i+"px",width:e+"px"}))}d.append(a('<div class="nivo-caption"><p></p></div>').css({display:"none",opacity:f.captionOpacity}));if(c.currentImage.attr("title")!=""){i=c.currentImage.attr("title");if(i.substr(0,1)=="#")i=a(i).html();a(".nivo-caption p",d).html(i);a(".nivo-caption",d).fadeIn(f.animSpeed)}var k=0;if(!f.manualAdvance&&b.length>1)k=setInterval(function(){l(d,b,f,false)},f.pauseTime);if(f.directionNav){d.append('<div class="nivo-directionNav"><a class="nivo-prevNav">Prev</a><a class="nivo-nextNav">Next</a></div>');
if(f.directionNavHide){a(".nivo-directionNav",d).hide();d.hover(function(){a(".nivo-directionNav",d).show()},function(){a(".nivo-directionNav",d).hide()})}a("a.nivo-prevNav",d).live("click",function(){if(c.running)return false;clearInterval(k);k="";c.currentSlide-=2;l(d,b,f,"prev")});a("a.nivo-nextNav",d).live("click",function(){if(c.running)return false;clearInterval(k);k="";l(d,b,f,"next")})}if(f.controlNav){e=a('<div class="nivo-controlNav"></div>');d.append(e);for(i=0;i<b.length;i++)if(f.controlNavThumbs){var j=
b.eq(i);j.is("img")||(j=j.find("img:first"));f.controlNavThumbsFromRel?e.append('<a class="nivo-control" rel="'+i+'"><img src="'+j.attr("rel")+'" alt="" /></a>'):e.append('<a class="nivo-control" rel="'+i+'"><img src="'+j.attr("src").replace(f.controlNavThumbsSearch,f.controlNavThumbsReplace)+'" alt="" /></a>')}else e.append('<a class="nivo-control" rel="'+i+'">'+(i+1)+"</a>");a(".nivo-controlNav a:eq("+c.currentSlide+")",d).addClass("active");a(".nivo-controlNav a",d).live("click",function(){if(c.running)return false;
if(a(this).hasClass("active"))return false;clearInterval(k);k="";d.css("background","url("+c.currentImage.attr("src")+") no-repeat");c.currentSlide=a(this).attr("rel")-1;l(d,b,f,"control")})}f.keyboardNav&&a(window).keypress(function(g){if(g.keyCode=="37"){if(c.running)return false;clearInterval(k);k="";c.currentSlide-=2;l(d,b,f,"prev")}if(g.keyCode=="39"){if(c.running)return false;clearInterval(k);k="";l(d,b,f,"next")}});f.pauseOnHover&&d.hover(function(){c.paused=true;clearInterval(k);k=""},function(){c.paused=
false;if(k==""&&!f.manualAdvance)k=setInterval(function(){l(d,b,f,false)},f.pauseTime)});d.bind("nivo:animFinished",function(){c.running=false;a(b).each(function(){a(this).is("a")&&a(this).css("display","none")});a(b[c.currentSlide]).is("a")&&a(b[c.currentSlide]).css("display","block");if(k==""&&!c.paused&&!f.manualAdvance)k=setInterval(function(){l(d,b,f,false)},f.pauseTime);f.afterChange.call(this)})})};a.fn.nivoSlider.defaults={effect:"random",slices:15,animSpeed:500,pauseTime:3E3,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(){}};a.fn._reverse=[].reverse})(jQuery);


