var phototimeout_delay = 5000; // milliseconds
currentphoto = 0;
var photos = new Array(3);
photos[0] = "Fete/Photos 2009/Loose women morris dancers.jpg";
photos[1] = "Fete/Photos 2009/Melody Marshall School dancers 2.jpg";
photos[2] = "Fete/Photos 2009/Melody Marshall School dancers.jpg";
photos[3] = "Fete/Photos 2009/Clara.jpg";
photos[4] = "Fete/Photos 2009/Amanda face painting.jpg";
photos[5] = "Fete/Photos 2009/WI Tea Tent.jpg";
photos[6] = "Fete/Photos 2009/Charley Golding Hip Hop Street Dancers.jpg";
photos[7] = "Fete/Photos 2009/East Farleigh Primary School soft toy Tom Bola.jpg";
photos[8] = "Fete/Photos 2009/Gillian Hawkes and her handmade necklaces.jpg";
photos[9] = "Fete/Photos 2009/Splat the Rat.jpg";
photos[10] = "Fete/Photos 2009/Flag Tug of War team.jpg";
photos[11] = "Fete/Photos 2009/The Fox at Fant Tug of War team.jpg";
photos[12] = "Fete/Photos 2009/Another Losing Team.JPG";
photos[13] = "Fete/Photos 2009/FLAG success 2009.jpg";


var titles = new Array(3);
titles[0] = "1/14 Loose Women Morris Dancers open the Fete";
titles[1] = "2/14 Young Dancers from the Melody Marshall School of Dance";
titles[2] = "3/14 Even Younger Dancers from the Melody Marshall School of Dance";
titles[3] = "4/14 Clara paints her hand";
titles[4] = "5/14 Amanda Margerum face painting";
titles[5] = "6/14 WI Tea Tent";
titles[6] = "7/14 Charley Golding's Hip Hop Street Dancers";
titles[7] = "8/14 East Farleigh Primary School soft toy Tom Bola";
titles[8] = "9/14 Gillian Hawkes and her Handmade Necklaces";
titles[9] = "10/14 Splat!!! the Rat";
titles[10] = "11/14 FLAG Tug of War team - How could we lose!";
titles[11] = "12/14 The Winning Tug of War team - The Fox at Fant";
titles[12] = "13/14 Admiral Pub team about to lose to the Fox";
titles[13] = "14/14 FLAG - Thanks for watching";

function nextphoto() {
if (++currentphoto > photos.length-1) {
  currentphoto = 0;
}
  document.images.photoshow.src = photos[currentphoto];
  document.getElementById('phototitle').innerHTML = titles[currentphoto];
}

function previousphoto() {

currentphoto = currentphoto -1;

if (currentphoto < 0) {
  currentphoto = photos.length-1
}
  document.images.photoshow.src = photos[currentphoto];
  document.getElementById('phototitle').innerHTML = titles[currentphoto];
}

function startstopphoto() {
var text=document.getElementById('photosbutton').innerHTML
document.getElementById('photosbutton').innerHTML = (text == "Stop") ? "Start" : "Stop";
phototimeout();
}


function phototimeout() {
if (document.getElementById('photosbutton').innerHTML == "Stop") {
  nextphoto();
  window.setTimeout("phototimeout()", phototimeout_delay);
}
}

