var killphoto=1
var newphoto=2
var botphoto=3
var currentphoto

function movenext(totphoto){
	blendimage(totphoto,700)
	newphoto=newphoto+1
    killphoto=killphoto+1
    botphoto=botphoto+1
	if (newphoto>totphoto){
		newphoto=1	
	}
    if (killphoto>totphoto){
		killphoto=1	
	}
    if (botphoto>totphoto){
		botphoto=1	
	}
}
		
function startit(totphoto){
	startit=setInterval ('movenext('+totphoto+')', 8000);
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function blendimage(totphoto, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//set the current image as background
	for (i=1;i<=totphoto;i++){
		document.getElementById('slide'+i).style.zIndex=document.getElementById('slide'+i).style.zIndex-1
		if (document.getElementById('slide'+i).style.zIndex==0){
			document.getElementById('slide'+i).style.zIndex=totphoto
		}
		if (document.getElementById('slide'+i).style.zIndex==totphoto){
			currentphoto = 'slide' + i;
		}
	}
	
	//make image transparent
	changeOpac(0, currentphoto);
	
	//make new image

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + currentphoto + "')",(timer * speed));
		timer++;
	}
}

