var addIndex = 0;
var which=0;

var preloadedimages = new Array();

function AddPlayImg(photo){
	preloadedimages[addIndex] = new Image();
	preloadedimages[addIndex++].src = photo;
}

function applyeffect(){
	if (document.all && swap.filters){
		swap.filters.revealTrans.Transition=Math.floor(Math.random()*23);
		swap.filters.revealTrans.stop();
		swap.filters.revealTrans.apply();
	}
}



function playeffect(){
	if (document.all && swap.filters)
		swap.filters.revealTrans.play();
}



function backward(){
	if (which>0){
		which--;
		applyeffect();
		document.images.swap.src = preloadedimages[which].src;
		playeffect();
		//keeptrack();
	}
}

function forward(){
	if (which<addIndex-1){
		applyeffect();
		document.images.swap.src = preloadedimages[which].src;
		playeffect();
		which++;
	}else{
		applyeffect();
		document.images.swap.src = preloadedimages[which].src;
		playeffect();
		which = 0;
	}
	//keeptrack();
	setTimeout('forward()', 5000);
}