var numpx = 146; //number of images

var px = new Array();

px[0] = 'a';
px[1] = 'b';
px[2] = 'c';
px[3] = 'd';

for (i=4;i<16;i++) {
	checkpx(i);
}

function checkpx(x) {
	px[x] = Math.floor(Math.random()*(numpx+1));
	for (j=0;j<x;j++) {
		if (px[x] == px[j] || px[x] == 0 || px[x] == (numpx+1)) {
			checkpx(x);
		}
	}
}

if (px[4] == 0) {
	px[4] = numpx;
}

var x = 0; //number of switching images on page (where to start switching)
var y = 5000; //delay in ms
var z = 2; //transition duration
var t = 4;

function slide() {
	var hw = document.images.home_1;
	var hx = document.images.home_2;
	var hy = document.images.home_3;
	var hz = document.images.home_4;
	if (document.all){
		hw.style.filter="blendTrans(duration=" + z + ")";
		hw.filters.blendTrans.Apply();
		hx.style.filter="blendTrans(duration=" + z + ")";
		hx.filters.blendTrans.Apply();
		hy.style.filter="blendTrans(duration=" + z + ")";
		hy.filters.blendTrans.Apply();
		hz.style.filter="blendTrans(duration=" + z + ")";
		hz.filters.blendTrans.Apply();
	}
	
	hw.src = 'images/rotation/rotation_' + px[t] + '.jpg';
	hx.src = 'images/rotation/rotation_' + px[(t+1)] + '.jpg';
	hy.src = 'images/rotation/rotation_' + px[(t+2)] + '.jpg';
	hz.src = 'images/rotation/rotation_' + px[(t+3)] + '.jpg';
	
	if (document.all){
		hw.filters.blendTrans.Play();
		hx.filters.blendTrans.Play();
		hy.filters.blendTrans.Play();
		hz.filters.blendTrans.Play();
	}
	
	t+=4;
	if (t > 15) {
		t = 0;
	}
	
	setTimeout('slide()', y);
}
