var currentPhotoIndex = 1;
var intval = "";

function rotatePhotos(){
	highlightRefLink(0);
	intval = setInterval('changePhoto()', 5000);
}

function changePhoto(){
	document.getElementById('changingimg').src='/references/' + photos[currentPhotoIndex] + '_hp.jpg';
	highlightRefLink(currentPhotoIndex);
	if(currentPhotoIndex < 3) currentPhotoIndex++;
	else currentPhotoIndex = 0;
}

function highlightRefLink(id){
	for(var i = 0; i <= 3; i++){
	   document.getElementById('reflink' + i).style.textDecoration = 'none';
	   //document.getElementById('reflink' + i).style.fontWeight = 'normal';
	   document.getElementById('reflink' + i).style.backgroundPosition = '0% -23px';
	}
	document.getElementById('reflink' + id).style.textDecoration = 'underline';
	//document.getElementById('reflink' + id).style.fontWeight = 'bold';
	document.getElementById('reflink' + id).style.backgroundPosition = '0% -2px';
}

function userHighlight(id){
	clearInterval(intval);
	currentPhotoIndex = id;
	changePhoto();
	highlightRefLink(id);
}
