jQuery(document).ready(function() {
	jQuery('.slideshow').cycle({
		fx: 'scrollLeft', 
		timeoutFn: calculateTimeout, 
		delay:  -2000,
		pause:  1, 
		pager:  '#switcher-link', 
		pagerAnchorBuilder: function(idx, slide) { 
			// return selector string for existing anchor 
			return '#switcher-link li:eq(' + idx + ') a'; 
		}
	});
	jQuery('.gallery .gallery-holder:not(:first)').css('left','0px');
});

function calculateTimeout(currSlide, nextSlide, options, isForward) {
  var index = options.currSlide;
  if (index == 0) { 		//First slide
    return 40000;			//Time slide will show, in milliseconds
  }
  else if (index == 1){		//Second slide
	return 10000;
  }
  else if (index == 2) {	//Third slide
    return 10000;
  }
  else {					//Fourth or later slides
    return 10000;
  }
}

