var videos = new Array();

videos[1] = "images/beforeafter1.jpg";
videos[2] = "images/beforeafter4.jpg";
//videos[3] = "images/beforeafter2.jpg"; 
videos[0] = "images/beforeafter3.jpg";

var caption = new Array();

caption[1] = "This image was scratched and the colors had changed.  We repaired it so the bride is wearing white.";
caption[2] = "Stored in the dark, negatives and slides can change color, often toward blue or red. ";
//caption[3] = "In cases of major damage like this, we might charge more than our standard pricing. But we can work miracles! ";
caption[0] = "Many old slides are badly scratched. Large scratches must be removed by hand.";


var videoIndex = 0;
var intervalId;
var isPlaying = true;


function Pause() {
timer = setTimeout("initRotation()",0); // 30 secs
return false;
}

function initRotation() {

	intervalId = setInterval("rotateVideo()", 5000);  // 60 secs
}

function rotateVideo() {
	if(isPlaying)
	{
		videoIndex++;
		if ( videoIndex >= videos.length ) {
			videoIndex = 0;
		}
		document.getElementById("beforeafter").src = videos[videoIndex];
		document.getElementById("captionText").innerHTML = caption[videoIndex];
	}

}

function nextPic() {

isPlaying = false;

videoIndex++;
if ( videoIndex >= videos.length ) {
videoIndex = 0;
}

document.getElementById("beforeafter").src = videos[videoIndex];
document.getElementById("captionText").innerHTML = caption[videoIndex];
}


function prevPic() {

isPlaying = false;


if (videoIndex == 0) {
videoIndex = (videos.length)-1;
}
else
{
	videoIndex--;
}


document.getElementById("beforeafter").src = videos[videoIndex];
document.getElementById("captionText").innerHTML = caption[videoIndex];


}
