var timerId;var controller={isPaused:false,backwards:true,speed:2000,toggleMode:function(){if(this.isPaused){$('.slideshow-controls').find('.mode img').attr('src','/js/jquery/plugins/slideshow/images/pause.jpg');this.isPaused=false;this.play()}else{$('.slideshow-controls').find('.mode img').attr('src','/js/jquery/plugins/slideshow/images/play.jpg');this.isPaused=true;this.pause()}},play:function(){clearInterval(timerId);timerId=setInterval('loop()',this.speed)},pause:function(){clearInterval(timerId)},next:function(){loop();this.resume()},previous:function(){loop(this.backwards);this.resume()},resume:function(){if(!controller.isPaused)controller.play()}};$(document).ready(function(){slideShow(6000)});function slideShow(speed){$('ul.slideshow').append('<li id="slideshow-caption" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p></div></li>');$('ul.slideshow li.slide').css({opacity:0.0});$('ul.slideshow li.slide:first').css({opacity:1.0});$('#slideshow-caption h3').html($('ul.slideshow a:first').find('img').attr('title'));$('#slideshow-caption p').html($('ul.slideshow a:first').find('img').attr('alt'));$('#slideshow-caption').css({opacity:0.7,bottom:0});$('ul.slideshow').append('<li class="slideshow-controls"><span class="previous"><img src="/js/jquery/plugins/slideshow/images/left_arrow.jpg" height="20" width="25" alt="previous" /></span><span class="mode"><img src="/js/jquery/plugins/slideshow/images/pause.jpg" height="20" width="25" alt="pause/play" /></span><span class="next"><img src="/js/jquery/plugins/slideshow/images/right_arrow.jpg" height="20" width="25" alt="next" /></span></li>');controller.speed=speed;controller.play();$('ul.slideshow').hover(controller.pause,controller.resume);$('.slideshow-controls .previous').click(function(){controller.previous()});$('.slideshow-controls .mode').click(function(){controller.toggleMode()});$('.slideshow-controls .next').click(function(){controller.next()});$('.slideshow-controls span').css('cursor','pointer')}function loop(backwards){var current=($('ul.slideshow li.show')?$('ul.slideshow li.show'):$('#ul.slideshow li.slide:first'));if(backwards){var next=((current.prev().length)?current.prev():$('ul.slideshow li.slide:last'))}else{var next=((current.next().length)?((current.next().attr('id')=='slideshow-caption')?$('ul.slideshow li.slide:first'):current.next()):$('ul.slideshow li.slide:first'))}var title=next.find('img').attr('title');var desc=next.find('img').attr('alt');next.css({opacity:0.0}).addClass('show').animate({opacity:1.0},1000);$('#slideshow-caption').fadeOut(300,function(){$('#slideshow-caption h3').html(title);$('#slideshow-caption p').html(desc);$('#slideshow-caption').fadeIn(500)});current.animate({opacity:0.0},1000).removeClass('show')}

