$(document).ready(function() {
	$(function() {
	var index = 0, hash = window.location.hash;
	if (hash) {
		index = /\d+/.exec(hash)[0];
		index = (parseInt(index) || 1) - 1;
		}
		$('#slideshow').cycle({
			fx: 'fade',
			speed: 'medium',
			timeout: 0,
			next: '.next_btn', 
			prev: '.prev_btn',
			startingSlide: index,
			after: onAfter
		});
	});
	function onAfter(curr,next,opts) {
		window.location.hash = opts.currSlide + 1;
		var caption = (opts.currSlide + 1) + ' of ' + opts.slideCount;
	$('#caption').html(caption);
	$('#count').html(this.alt);
	}
});
