////// the start of the show
var start = setTimeout("reappearo()",1000);

///// show time in seconds
var minshowtime = 6;
var variance = 4;

//// variables for keeping track of pictures
var _pcount = 0;
var num =0;
// disappearo "magic" values-
//  in line "Effect.Fade(...)" duration: 2 means 2 seconds to disappear
//  setTimeout 2500 - means 2.5 seconds. if you cut it too close to the 2
//           second Fade deadline, the effects sometimes mess up. 

// reappearo "magic" values -
// in the same "Effect.Appear(..)" format, duration: 1 (1 second)
// var time = a random number between 1 and 7 seconds, + minshowtime, for
//           how long the picture will stay the same
function disappearo ( _pcountcheck ) {
	if (_pcountcheck != _pcount){
		alert(_pcount+" =/= "+_pcountcheck);
		return;
	}
	elem = document.getElementById('pool');
	if (_pcount == 0){return;}
	else if (_pcount == 1){
		new Effect.Fade(elem.getElementsByTagName("img")[0], {duration: 1.008});
	}
	else if (_pcount == 2){
		var t_app = (Math.floor(Math.random() * 1500));
		new Effect.Fade(elem.getElementsByTagName("img")[0], {duration: 1.008});
		new Effect.Fade(elem.getElementsByTagName("img")[1], {duration: 1});
	}
	setTimeout("reappearo()",1300);
}

function reappearo () {
	var oldnum = num;
		num += 1;
	num = num % backgs.length;

	var elem = document.getElementById('pool');	
	var pict = elem.getElementsByTagName("img")[0];
	/// make sure its invisible for the swap
	pict.style.filter="alpha(opacity=0);";
	pict.style.opacity="0";
	pict.src = backgs[num].src;
	
	_pcount = 1;
	new Effect.Appear(elem.getElementsByTagName("img")[0], {duration: .5});
	var time = (Math.floor(Math.random() * variance))*1000 + minshowtime*1000;
	setTimeout("disappearo("+_pcount+")",time);
}
