slideShow = null;
$(function () {
	slideShow = (function () {
		var slides = $('div.testimonial div.slide').not('.coachSlide');
		var index = 0;
		var count = 0;
		var speed = 700;
		var interval = 10000;
		var paused = false;
		var startFast = true;
		var next = function () {
			if (!paused) {
				if (startFast && count == 0) {
					window.clearInterval(cycle);
					slideShow.cycle = window.setInterval('slideShow.next();', interval);
				}
				$(slides[index]).fadeOut(speed, function () {
					if (index == slides.length - 1) {
						$(slides[0]).fadeIn(speed);
						index = 0;
					} else {
						$(slides[index + 1]).fadeIn(speed);
						index += 1;
					}
				});
				count++;
			}
		};
		var stop = function () {
			paused = true;
		};
		var start = function () {
			paused = false;
		};
		if (startFast) {
			var cycle = window.setInterval('slideShow.next();', interval/2);
		} else {
			var cycle = window.setInterval('slideShow.next();', interval);
		}
		return {
			cycle: cycle,
			slides: slides,
			index: index,
			interval: interval,
			speed: speed,
			next: next,
			stop: stop,
			start: start,
			paused: paused,
			startFast: startFast
		}
	})();
});

