var imagenum = 1;		// first image (actual image in fact)
var imagemax = 18;		// last image
var imagepos = 0;		// in opacity %
var imagestep = 0.024;		// in opacity %
var imagespeed = 50;	// in msec
var imagesleep = 3500;	// in msec

var firstimage = 0;
var nextimage = 0;
var jumpto = 0; // Set it to something else than 0 to jump to a precise image
var randomimg = 1; // If set to 1, the images will be randomized.

function stepforwardopc() {
	imagepos += imagestep;
	if (imagepos > 1) imagepos = 1;
	if (firstimage == 0) firstimage = document.getElementById("photo"+imagenum);
	if (nextimage == 0) {
		if (jumpto == 0) i = imagenum+1; else i = jumpto;
		if (i > imagemax) i = 1;
		nextimage = document.getElementById("photo"+i);
		nextimage.style.display = '';
	}
	imageposinverted = 1-imagepos
	if (firstimage.filters) firstimage.style.filter = 'alpha(opacity='+(imageposinverted*100)+')'; else firstimage.style.opacity = imageposinverted;
	if (nextimage.filters) nextimage.style.filter = 'alpha(opacity='+(imagepos*100)+')'; else nextimage.style.opacity = imagepos;
	if (imagepos == 1) {
		if (jumpto == 0) imagenum++; else imagenum = jumpto;
		if (randomimg) {
			do { jumpto = 1+Math.floor(Math.random()*imagemax); } while (jumpto == imagenum);
		} else jumpto = 0;
		if (imagenum > imagemax) imagenum = 1;
		firstimage = 0; nextimage = 0;
		imagepos = 0;
		window.setTimeout("stepforwardopc()",imagesleep);
	} else window.setTimeout("stepforwardopc()",imagespeed);
}

if (randomimg) jumpto = 2+Math.floor(Math.random()*(imagemax-1));
