$(document).ready(function(){$('#slideshow').slideShow();});$.fn.slideShow=function(options){var slideCount=$('#slideshow a').length;var currentSlide=1;var margLeft=0;var autoPlay=true;setTimeout(function(){jumpSlide();},3000);$('#next').click(function(){autoPlay=false;jumpSlide();return false;});$('#previous').click(function(){autoPlay=false;if(currentSlide>1){currentSlide--;gotoSlide(currentSlide);}else if(currentSlide==1){currentSlide=slideCount;gotoSlide(currentSlide);}else if(slideCount==currentSlide){currentSlide=1;gotoSlide(currentSlide);}
return false;});$('.goToSlide').click(function(){autoPlay=false;gotoSlide($(this).attr('rel'));return false;});function jumpSlide(){if(currentSlide<slideCount){currentSlide++;gotoSlide(currentSlide);}else if(slideCount==currentSlide){currentSlide=1;gotoSlide(currentSlide);}}
function gotoSlide(id){var margLeft="-"+((id-1)*570)+"px";$("#slideshow").animate({marginLeft:margLeft});$('#controls a').removeClass('active');$('#controls a').eq(id-1).addClass('active');if(autoPlay){setTimeout(function(){jumpSlide();},3000);}}};