function count_images() { if (++num_loaded_images == 43) animate(); }
var num_loaded_images = 0;

images = new Array(43);
for(var i = 0; i < 43; i++) 
{       
  images[i] = new Image();
  images[i].onload = count_images;
  images[i].src = "../../images/slides/slide" + i + ".jpg";
/*
  switch (i) {
     case 0: images[i].alt = "The sign as you enter Milton from the south";
             break;
     case 1: images[i].alt = "17th century cottage in Church Lane";
             break;
     case 2: images[i].alt = "Community Centre and Annexe, Coles Road";
             break;  
     case 3: images[i].alt = "Playing cricket on The Sycamores Recreation Ground";
             break;
     case 4: images[i].alt = "Tesco";
             break;
     case 5: images[i].alt = "Waggon and Horses PH";
             break;
     case 6: images[i].alt = "White Horse PH";
             break;
     case 7: images[i].alt = "All Saints' church";
             break;
     case 8: images[i].alt = "Lion and Lamb PH";
             break;
     case 9: images[i].alt = "Dickersons Pit, Milton Country Park";
             break;
     case 10: images[i].alt = "Jolly Brewers PH";
             break;
     case 11: images[i].alt = "New Apostolic Church";
             break;
     case 12: images[i].alt = "Children's Hospice, Church Lane";
             break;
     case 13: images[i].alt = "Play equipment, The Sycamores";
             break;
     case 14: images[i].alt = "Sheltered housing at Barnabas Court";
             break;
     }
*/
}

function animate()
{
  switch (pos) {
  case 0: document.animation0.src = images[frame].src;
          document.animation0.alt = images[frame].alt;
          break;
  case 1: document.animation1.src = images[frame].src;
          document.animation1.alt = images[frame].alt;
          break;
  case 2: document.animation2.src = images[frame].src;
          document.animation2.alt = images[frame].alt;
          break;
  case 3: document.animation3.src = images[frame].src;
          document.animation3.alt = images[frame].alt;
          break;
  }
  frame = (frame + 1)%43;
  pos = (pos + 1)%4;
  timeout_id1 = setTimeout("animate()", 2000);
}
var frame = 18;
var pos = 4;
var timeout_id = null;

