function fallbackSlideshow(jsonURL, slideContainer, slideImageContainer, slideText1, slideText2, defaultColor, fadeTime) {
	// Only show fallback Slideshow if Flash Plugin is not installed
	// swfobject.getFlashPlayerVersion().major returns the installed Flash Plugin version. 0 if not installed / deactivated
	if(swfobject.getFlashPlayerVersion().major < 1) {

		// fetch and parse json data
		jQuery.getJSON(jsonURL, function(json) {
			if(json.length > 0) {
				
				// make json data and other variables accessible to nextSlide function
				window.leica_json = json;
				window.leica_counter = 1;
				window.leica_container = slideContainer;
				window.leica_image_container = slideImageContainer;
				window.leica_image_container2 = slideImageContainer + '_back';
				window.leica_text1 = slideText1;
				window.leica_text2 = slideText2;
				window.leica_color = defaultColor;
				window.fade_time = fadeTime;
												
				// slideshow is currently not paused
				window.leica_paused = false;
				
				// set new Timer if not paused
				setTimer(window.leica_json[0].duration);
				
				// Make a second container for preloading and crossfading of images
				jQuery('#' + window.leica_image_container).clone().prependTo('#' + window.leica_container).attr({id: window.leica_image_container2}).hide();
				// alternate between both container divs (the original and the one just created)
				window.container_toggle = true;
			}
		});
	}
}

function setTimer(duration) {
	
	// leave no Timeout uncleared
	clearTimeout(window.currentTimeout);
	
	if(!window.leica_paused) {
		// Set new Timer with duration of current element.
		window.currentTimeout = window.setTimeout("nextSlide(false)", duration * 1000);
	}
}

// Reads next element data (cycling back to the first element if needed)
function nextSlide() {
	
	// Increment counter and loop to beginning if end of json elements is reached
	window.leica_counter++;
	if(window.leica_counter >= window.leica_json.length) {
		window.leica_counter = 0;
	}
	// shortcut to current json element
	j = leica_json[window.leica_counter];
	
	// update and crossfade content
	crossFadeContent(j);
	
	// set new Timer
	setTimer(j.duration);
}

function prevSlide() {
	
	// Decrement counter and loop to end if end of json elements is reached
	window.leica_counter--;
	if(window.leica_counter < 0) {
		window.leica_counter = window.leica_json.length -1;
	}

	// shortcut to current json element
	j = leica_json[window.leica_counter];
	
	// update and crossfade content
	crossFadeContent(j);
	
	// set new Timer
	setTimer(j.duration);
}

function stopAndStartSlides(me, icon_start, icon_stop) {
	
	if(window.leica_paused) {
		// unpause
		window.leica_paused = false;
		me.src = icon_stop;
	} else {
		// pause
		window.leica_paused = true;
		me.src = icon_start;
	}
	
	// Call setTimer.
	// It clears the current Timeout and decides whether to set a timer or not (depending on leica_paused)
	setTimer(leica_json[window.leica_counter].duration);
}

function crossFadeContent(j) {
	
	// define currently shown and currently hidden container			
	if(window.container_toggle) {
		window.container_toggle = false;
		container_current = '#' + window.leica_image_container;
		container_next = '#' + window.leica_image_container2;
	} else {
		window.container_toggle = true;
		container_current = '#' + window.leica_image_container2;
		container_next = '#' + window.leica_image_container;
	}
	
	// Update content of currently hidden container
	updateContent(container_next, j);
	
	textcolor = j.textcolor ? j.textcolor : window.leica_color;
	
	// Simultaneously fade-in new image and fade-out current image
	
	jQuery(container_next).fadeIn(Number(window.fade_time));
	jQuery(container_current).fadeOut(Number(window.fade_time));
}

function updateContent(container, content) {
	jQuery(container + ' img').attr({
							src: content.image,
							title: content.text1,
							alt: content.text1 });
	jQuery(container + ' .' + window.leica_text1).html( content.text1 );
	jQuery(container + ' .' + window.leica_text1).css( 'color', content.textcolor );
	jQuery(container + ' .' + window.leica_text2).html( content.text2 );
	jQuery(container + ' .' + window.leica_text2).css( 'color', content.textcolor );
	// Update linktarget URL
	jQuery(container + ' a').attr({ href: content.linkto });
}