
// RTP's photo tour
var numImages = 28;
var i = 1;
var f=0;
var sInterval;
var sImage;

function swapImage(){
	f=0;
	i=i+1;
 
 document.Gallery.src='../ImageLibrary/Photo-tour/' + i + '.jpg';
 document.Gallery.style.filter="alpha(opacity="+f+"); moz-opacity: 0."+f;
 sInterval = window.setInterval("startTransition()", 100);
 if (i==numImages){
 	i=0;
 	 
 }
}
function stopInt(){
	window.clearInterval(sInterval);
}
function startTransition(){
	f=f+10;
	document.Gallery.style.filter="alpha(opacity="+f+"); moz-opacity: 0."+f;
	if (f==100){
		stopInt();
		f=0;
	}
}

function stopShow(){
	window.clearInterval(sImage);
}

function startShowOnLoad(){
	i=1;
	sImage = setInterval("swapImage()", 7000);

}
function startShow(){
	window.clearInterval(sImage);
	window.clearInterval(sInterval);
	document.Gallery.src='../ImageLibrary/Photo-tour/1.jpg';
	i=1;
	sImage = setInterval("swapImage()", 7000);

}
function nextImage(){
	stopShow();
	if (i < numImages){
		i = (i + 1);
		document.Gallery.src='../ImageLibrary/Photo-tour/' + i + '.jpg';
	}
	else{
		i = 1;
		document.Gallery.src='../ImageLibrary/Photo-tour/' + i + '.jpg';
	}
}

function prevImage(){
	stopShow();
	if (i == 1){
		i = numImages;
		document.Gallery.src='../ImageLibrary/Photo-tour/' + i + '.jpg';
	}
	else{
		i = (i - 1);
		document.Gallery.src='../ImageLibrary/Photo-tour/' + i + '.jpg';
	}
}