var splashes= new Array(50)
for ( i = 1; i < 51; i++ ) {
	splashes[i] = 'photos/' + i + '.jpg'
}
var current_splash = 1;
var previous_splash = 1;

function initImage() {
	imageId = 'the_slide';
	image = document.getElementById(imageId);
	var new_image = new Image();
	new_image.src = splashes[current_splash];
	image.src = new_image.src;
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
	window.setTimeout("nextSlide()", 10000);
}

function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

function nextSlide() {
	current_image = document.getElementById('the_slide');
	past_image = document.getElementById('slide_holder');
	
	/* Update Images */
	previous_splash = current_splash;
	current_splash = (current_splash + 1) % splashes.length;
	
	/* Set Background Image */
	past_image.style.background = 'url(' + splashes[previous_splash] + ') 0% 0% no-repeat';
	
	/* Fade in new Image */
	setOpacity(current_image, 0);
	var new_image = new Image(); 
	new_image.src = splashes[current_splash];
	current_image.src = new_image.src;
	fadeIn('the_slide',0);
	
	window.setTimeout("nextSlide()", 10000);
}

//window.onload = function() {initImage()}
function reload_player(id,value) {
	if ( document.all ) {
		var html = '<div class="flash">'
		if ( value ) {
			html += '<br /><br />Please wait for flash to load...'
			html += '<object width="100%" height="100%" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">'
			html += '<param name="movie" value="'+value+'" />'
			if ( value.search(/viewer/i) >= 0 ) {
				html += '<param name="wmode" value="transparent" />'
			} else {
				html += '<param name="allowfullscreen" value="true" />'
			}
			html += '<br /><br /><a href="http://www.adobe.com/go/getflashplayer">Your browser was unable to load flash player. Please click here to download it.</a>'
			html += '</object>'
		}
		html += '</div>'
	} else {
		var html = '<object type="application/x-shockwave-flash" width="100%" height="100%" data="'+value+'">'
		if ( value.search(/viewer/i) >= 0 ) {
			html += '<param name="wmode" value="transparent" />'
		} else {
			html += '<param name="allowfullscreen" value="true" />'
		}
		html += '</object>'
	}
	document.getElementById(id).innerHTML = html
}
