var slideshowSpeed=5000;$(document).ready(function(){$("#image-caption").css({"display":"block"});$("#image-nav").css({"display":"block"});var interval;$("#back").click(function(){try{woopraTracker.pushEvent({name:'Slideshow',event:'previous'});}catch(err){};stopAnimation();navigate("back");});$("#next").click(function(){try{woopraTracker.pushEvent({name:'Slideshow',event:'next'});}catch(err){};stopAnimation();navigate("next");});$("#control").toggle(function(){try{woopraTracker.pushEvent({name:'Slideshow',event:'pause'});}catch(err){};stopAnimation();},function(){$(this).css({"background-image":"url(/_assets/btn_pause.png)"});navigate("next");interval=setInterval(function(){navigate("next");},slideshowSpeed);});var activeContainer=1;var currentImg=0;var animating=false;var playedOnce=false;var navigate=function(direction){if(animating){return;}
if(direction=="next"){currentImg++;if(currentImg==backgroundImage.length+1){currentImg=1;playedOnce=true;}}else{currentImg--;if(currentImg==0){currentImg=backgroundImage.length;}}
var currentContainer=activeContainer;if(activeContainer==1){activeContainer=2;}else{activeContainer=1;}
showImage(backgroundImage[currentImg-1],currentContainer,activeContainer);if(playedOnce==false){try{var image1=$('<img />').attr('src','/_images/'+backgroundImage[currentImg].image);}catch(err){}};};var currentZindex=-1;var showImage=function(photoObject,currentContainer,activeContainer){animating=true;currentZindex--;$("#content-img"+activeContainer).css({"background-image":"url(/_images/"+photoObject.image+")","display":"block","z-index":currentZindex});if(photoObject.url===""){$("#picturedurl").click(function(event){event.preventDefault();});$("#picturedurl")
.css('cursor','default')
.css('text-decoration','none');};$("#picturedurl")
.attr("href",photoObject.url)
.html(photoObject.title);$("#content-img"+currentContainer).fadeOut(function(){setTimeout(function(){if(playedOnce==false){try{woopraTracker.pushEvent({name:'New Image',image:photoObject.image});}catch(err){};};animating=false;},500);});};var stopAnimation=function(){$("#control").css({"background-image":"url(/_assets/btn_play.png)"});clearInterval(interval);};navigate("next");interval=setInterval(function(){navigate("next");},slideshowSpeed);});
