var currentPhoto = 0;
var secondPhoto = 1;

var currentPhoto2 = 0;
var secondPhoto2 = 1;

var currentOpacity = new Array();
var currentOpacity2 = new Array();
var imageArray = new Array("http://www.rotaform.nl/images/header1.jpg","http://www.rotaform.nl/images/header2.jpg");
var imageArray2 = new Array("http://www.rotaform.nl/images/header1b.jpg","http://www.rotaform.nl/images/header2b.jpg");

var FADE_STEP = 2;
var FADE_INTERVAL = 20;

var pause = false;

function init() {
}

function crossFade() {
	if(pause)return;

	currentOpacity[currentPhoto]-=FADE_STEP;
	currentOpacity[secondPhoto] += FADE_STEP;
	
	currentOpacity2[currentPhoto]-=FADE_STEP;
	currentOpacity2[secondPhoto] += FADE_STEP;

	if(document.all) {
		document.getElementsByName("photo")[currentPhoto].style.filter = "alpha(opacity=" + currentOpacity[currentPhoto] + ")";
		document.getElementsByName("photo")[secondPhoto].style.filter = "alpha(opacity=" + currentOpacity[secondPhoto] + ")";
	} else {
		document.getElementsByName("photo")[currentPhoto].style.MozOpacity = currentOpacity[currentPhoto]/100;
		document.getElementsByName("photo")[secondPhoto].style.MozOpacity = currentOpacity[secondPhoto]/100;
	}

	if(document.all) {
		document.getElementsByName("photo2")[currentPhoto2].style.filter = "alpha(opacity=" + currentOpacity[currentPhoto2] + ")";
		document.getElementsByName("photo2")[secondPhoto2].style.filter = "alpha(opacity=" + currentOpacity[secondPhoto2] + ")";
	} else {
		document.getElementsByName("photo2")[currentPhoto2].style.MozOpacity = currentOpacity[currentPhoto2]/100;
		document.getElementsByName("photo2")[secondPhoto2].style.MozOpacity = currentOpacity[secondPhoto2]/100;
	}
	
	if(currentOpacity[secondPhoto]/100>=.98) {
		currentPhoto = secondPhoto;
		secondPhoto++;
		if(secondPhoto == imageArray.length)secondPhoto=0;
		pause = true;
		xInterval = setTimeout("pause=false",2000);
	}
}
