function fallbackSlideshow(jsonURL, slideContainer, slideImageContainer, slideTexts, slideText1, slideText2, defaultColor, fadeTime, noFlash, showThumbs, pauseOnHover, slidesAsBackgroundimages, displayMode) {
	// Only show fallback Slideshow if Flash Plugin is not installe
	// OR if noFlash is set
	// 	swfobject.getFlashPlayerVersion().major returns the installed Flash Plugin version. 0 if not installed / deactivated
	if(noFlash == 1 || displayMode == 1 || 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 = 0;
				window.leica_container = slideContainer;
				window.leica_image_container = slideImageContainer;
				window.leica_image_container2 = slideImageContainer + '_back';
				window.leica_texts = slideTexts;
				window.leica_text1 = slideText1;
				window.leica_text2 = slideText2;
				window.leica_color = defaultColor;
				window.fade_time = fadeTime;
				window.pause_on_hover = pauseOnHover;
				window.slides_bg = slidesAsBackgroundimages;
				window.startTime = false;
				window.timeLeft = false;
											
				// slideshow is currently not paused
				window.leica_paused = false;
				
				// Polaroids
				if(displayMode == 1) {
					
					// Make containers for all images
					jQuery.each(json, function(i, item) {
						jQuery('#' + window.leica_image_container).clone().appendTo('#' + window.leica_container).attr({id: window.leica_image_container + i});
						updateContent('#' + window.leica_image_container + i, item, true);
					});
					
					// Start Tinyfade
					js_slideshow=new TINY.fader.fade('js_slideshow',{
						id:'slide_container',
						auto:3,
						resume:true,
						//navid:'pagination',
						activeclass:'current',
						visible:true,
						position:0
					});
					
				// Standard
				} else {
				
					// set new Timer if not paused
					setTimer(window.leica_json[0].duration * 1000);
				
					// set pause_on_hover event
					if(window.pause_on_hover == true) {
						jQuery('#' + window.leica_container).mouseenter(function() { pauseTimer(); });
						jQuery('#' + window.leica_container).mouseleave(function() { unpauseTimer(); });
					}
				
					// 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;
				
					// Optionally Show Thumbnails					
					if(showThumbs == 1) {
						jQuery.each(window.leica_json, function(i, item) {
							jQuery('#slide_thumbs_container').append('<div class="slide_thumb" id="st' + i + '"><a href="#" onclick="gotoSlide(' + i + ');return false;"><img src="' + item.thumb + '" /></a></div>');
						});
						// Set "active" class on Thumbnail corresponding to first image
						jQuery('#st' + window.leica_counter).addClass('active');
					}
				}
			}
		});
	}
}

function setTimer(millisec) {
	
	// leave no Timeout uncleared
	clearTimeout(window.currentTimeout);
	
	// Set new Timer with duration of current element.
	window.currentTimeout = window.setTimeout("nextSlide()", millisec);
	window.startTime = new Date().valueOf();
	window.timeLeft = millisec;

	if(window.leica_paused == true) {
		pauseTimer();
	}
}

function pauseTimer() {
	clearTimeout(window.currentTimeout);
	window.leica_paused = true;
	var timeRan = new Date().valueOf() - window.startTime;
	window.timeLeft -= timeRan;
	
	jQuery('#' + window.leica_container).addClass('paused');
}
function unpauseTimer() {
	// round up to at least 1 second till fade
	if(window.timeLeft < 1000) {
		window.timeLeft = 1000;
	}
	window.leica_paused = false;
	setTimer(window.timeLeft);
	
	jQuery('#' + window.leica_container).removeClass('paused');
}

function gotoSlide(i) {
	if(window.leica_counter != i) {
		window.leica_counter = i - 1;
		if(window.leica_counter < 0) {
			window.leica_counter = window.leica_json.length - 1;
		}
		nextSlide();
	}
}

// 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 * 1000);
}

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 * 1000);
}

function stopAndStartSlides(me, icon_start, icon_stop) {
	
	if(window.leica_paused == true) {
		// unpause
		unpauseTimer();
		me.src = icon_stop;
	} else {
		// pause
		pauseTimer();
		me.src = icon_start;
	}
}

function crossFadeContent(j) {
	
	// define currently shown and currently hidden container			
	if(window.container_toggle == true) {
		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, noActivation) {
	if(window.slides_bg == true) {
		// we are using background images as slides
		jQuery(container).css('background-image', 'url(' + content.image + ')');
	} else {
		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 );

	// optionally set offset x and y
	jQuery(container + ' .' + window.leica_texts).removeAttr("style");
	if(content.textoffsetx != '' && content.textoffsetx > 0) {
		jQuery(container + ' .' + window.leica_texts).css('left', content.textoffsetx + "px");
	}
	if(content.textoffsety != '' && content.textoffsety > 0) {
		jQuery(container + ' .' + window.leica_texts).css('top', content.textoffsety + "px");
	}
	
	// Update linktarget URL
	jQuery(container + ' a').attr({ href: content.linkto });
	
	// Add "active" class
	if(!noActivation) {
		jQuery('#slide_thumbs_container .active').removeClass('active');
		jQuery('#st' + j.index).addClass('active');
	}
}
