jQuery('html').addClass('js');

	function slideSwitch(slideTo) {
		var $active = $('#slideshow div.active');

		if ($active.length == 0) $active = $('#slideshow div:first');

		// use this to pull the divs in the order they appear in the markup
		var $next = $active.next('div').length ? $active.next() : $('#slideshow div:first');
		var $prev = $active.prev('div').length ? $active.prev() : $('#slideshow div:first');

		// uncomment below to pull the divs randomly
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );

		$active.addClass('last-active');

		if (slideTo != null) $next = $('#slideshow div').eq(slideTo*2+1);

		$next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('active last-active').css({opacity:0.0});
		});
	}

	jQuery(function($) {
	
		// $('slideshow img').css({opaciity:0.0});
		// $('slideshow img:first').css({opaciity:1.0});
	
		var playSlideshow = setInterval('slideSwitch()', 1500); // <- a variable instantiation?
		var $slideButtons = $('#slide-buttons a');
	
		$($slideButtons).each(function(i) {
			$(this).text(i+1);
		})
	
		$('#slide-buttons').show();
	
		$($slideButtons).click(function() {
			clearInterval(playSlideshow);
			slideSwitch($slideButtons.index(this));
			playSlideshow = setInterval('slideSwitch()', 1500); 
			$(this).addClass('selected');
			return false;
		})
	
		$('#slideshow').hover(function() {
			clearInterval(playSlideshow);	
		},
		function() {
			playSlideshow = setInterval('slideSwitch()', 1500);
		})
	});