function slideSwitch() {
	var id = (arguments[0]);
	var active = jQuery('#slideshow' + id + ' div.active');

	if ( active.size() === 0 ){
		active = jQuery('#slideshow' + id + ' div:last');
	}

	var next = getNextImage(active, random, id);

	active.addClass('last-active');
	next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 500, function() {
			active.removeClass('active last-active');
			active.css({opacity: 0.0});
	});
}


function getNextImage(){
	var id = (arguments[2]);
	var selector = '#slideshow' + id + ' div';
	var numberOfImages = jQuery(selector).size();
		if(arguments[1])
		{
			index = Math.floor(Math.random() * (numberOfImages-1) );
		}
		else
		{
			var index = jQuery(selector).index( arguments[0] );
			index = (index+1) % numberOfImages;
		}
		return jQuery(selector + ':eq(' + index + ')');
};
