var numpx = 70; //number of images

var px = new Array();

for (i=0;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);
		}
	}
}

//alert(px[0] + ',' + px[1] + ',' + px[2] + ',' + px[3] + ',' + px[4] + ',' + px[5] + ',' + px[6] + ',' + px[7] + ',' + px[8] + ',' + px[9] + ',' + px[10] + ',' + px[11] + ',' + px[12] + ',' + px[13] + ',' + px[14] + ',' + px[15]);

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 a = 2;
var a2 = 4;
var a3 = 7;
var a4 = 10;
var a5 = 13;
var t = 0;

function slide() {
	if(t == 0) {
		//document.images.home_1.src =  'images/rotation/home_1_' + px[3] + '.jpg';
		//document.images.home_2.src =  'images/rotation/home_1_' + px[6] + '.jpg';
		document.images.home_3.src =  'images/rotation/home_1_' + px[9] + '.jpg';
		document.images.home_4.src =  'images/rotation/home_1_' + px[12] + '.jpg';
		document.images.home_5.src =  'images/rotation/home_1_' + px[15] + '.jpg';
		t = 1;
	}
	var hx = document.images.home_1;
	var hy = eval('document.images.home_' + a);
	if (document.all){
		hx.style.filter="blendTrans(duration=" + z + ")";
		hx.filters.blendTrans.Apply();
	}
	if (document.all){
		hy.style.filter="blendTrans(duration=" + z + ")";
		hy.filters.blendTrans.Apply();
	}
	hx.src = 'images/rotation/home_1_' + px[x] + '.jpg';
	hy.src = 'images/rotation/home_1_' + px[eval('a' + a)] + '.jpg';
	if (document.all){
		hx.filters.blendTrans.Play();
	}
	if (document.all){
		hy.filters.blendTrans.Play();
	}
	
	x +=1;
	if (a == 2) {a2 +=1};
	if (a == 3) {a3 +=1};
	if (a == 4) {a4 +=1};
	if (a == 5) {a5 +=1};
	a +=1;
	if (x > 3) {x = 0;}
	if (a > 5) {a = 2;}
	if (a2 > 6) {a2 = 4};
	if (a3 > 9) {a3 = 7};
	if (a4 > 12) {a4 = 10};
	if (a5 > 15) {a5 = 13};
	setTimeout('slide()', y);
}