function slideShow(title,slide_cnt,interval,animation_speed) {
	
	var title = title;
	var slide_cnt = slide_cnt;
	var interval = interval;
	var animation_speed = animation_speed;
	var cur_slide = 1;
	var animation_active = 0;
	var set_interval;

	$(document).ready(function () {
		// Show initial slide
		slide_animation();

		// Display slide navigation
		$("div.slideshow_nav").css({"display":"block"});

		// Start slideshow
		set_interval = setInterval(slide_rotate,interval);

		// Button slide change
		$("span.show").click(function() {
				var slide_num = parseInt(this.className.substring(7));
				go_to_slide(slide_num);
		});

		// Keyboard arrow key slide change
		$(document).keydown(function(e) {
			var key = 0;
			if (e == null) {
				key = event.keyCode;
			} else { // mozilla
				key = e.which;
			}
		
			if(key == 37) {
				// go prev
				var prev_slide;
				
				if(cur_slide > 1) {
					prev_slide = cur_slide - 1;
				} else {
					prev_slide = slide_cnt;
				}
				// goog analytics
				pageTracker._trackEvent(title+' Slideshow', 'Go to Slide', 'Previous [s'+prev_slide+']');
				go_to_slide(prev_slide);
			} else if(key == 39) {
				// go next
				var next_slide;
				
				
				if(cur_slide < slide_cnt) {
					next_slide = cur_slide + 1;
				} else {
					next_slide = 1;
				}
				// goog analytics
				pageTracker._trackEvent(title+' Slideshow', 'Go to Slide', 'Next [s'+next_slide+']');
				go_to_slide(next_slide);
			}
		});

		// Pause animation on mouse hover, resume on hover out
		$("div.slide").hover(function() {
			clearInterval(set_interval);
		}, function() {
			reset_interval();
		});
	});

	// Show next slide / loop slides
	function slide_rotate() {
		if(animation_active == 0) {
			// Cause slides to loop
			if(cur_slide < slide_cnt) {
				cur_slide++;
			} else {
				cur_slide = 1;
			}
			
			slide_animation();
			reset_interval();
		}
	}

	// Go to specified slide
	function go_to_slide(n) {
		if(animation_active == 0) {
			if(cur_slide != n) {
				cur_slide = n;
				slide_animation();
				reset_interval();
			}
		}
	}

	// The slide animation
	function slide_animation() {
		// Hide all slides
		$("div.slide").hide();
		
		// Change all slides nav buttons to off
		$("span.show").css({"background":"transparent url('images/slideshow/marker.png') no-repeat 0px -21px"});
		// Change current slide nav button to on
		$("span.sb"+cur_slide).css({"background":"transparent url('images/slideshow/marker.png') no-repeat 0px 0px"});
		
		// Fade in current slide
		$("div.s"+cur_slide).fadeIn(animation_speed);
		
		// Animation is active
		animation_active = 1;
		
		// Deactivate after delay the animation speed (prevents breakout glitch
		setTimeout(deactivate,animation_speed);
	}

	function reset_interval() {
		clearInterval(set_interval);
		set_interval = setInterval(slide_rotate,interval);
	}

	function deactivate() {
		animation_active = 0;
	}
}
