var killphoto=1
var newphoto=2
var botphoto=3
var totphoto=3

function movenext(){
			for (i=1;i<=totphoto;i++){
				if (i==newphoto){
				document.getElementById("homelink"+i+"on").style.display = 'block'
				document.getElementById("homelink"+i+"off").style.display = 'none'
				}else{
				document.getElementById("homelink"+i+"on").style.display = 'none'
				document.getElementById("homelink"+i+"off").style.display = 'block'
				}
			}
			
	blendimage('homeContent'+killphoto,'homeContent'+newphoto,'homeContent'+botphoto,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(){
	startit=setInterval ('movenext()', 5000);
}


//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(divkill, divnew, divbot, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divnew).style.display='block'
	document.getElementById(divbot).style.zIndex=1
	document.getElementById(divkill).style.zIndex=2
	document.getElementById(divnew).style.zIndex=3
	
	//make image transparent
	changeOpac(0, divnew);
	
	//make new image

	//fade in image
	x=100
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + divnew + "')",(timer * speed));
		setTimeout("changeOpac(" + x + ",'" + divkill + "')",(timer * speed));
		timer++;
		x--
	}
}

function clearit(whichdiv){
			clearInterval(startit);
			for (i=1;i<=totphoto;i++){
				if (i==whichdiv){
				document.getElementById("homeContent"+i).style.display = 'inline-block'
				document.getElementById("homelink"+i+"on").style.display = 'inline-block'
				document.getElementById("homelink"+i+"off").style.display = 'none'
				}else{
				document.getElementById("homeContent"+i).style.display = 'none'
				document.getElementById("homelink"+i+"on").style.display = 'none'
				document.getElementById("homelink"+i+"off").style.display = 'inline-block'
				}
			}
			changeOpac(100, "homeContent"+whichdiv);
		}

