//
// pictshow.js
// The script will create a dynamic picture show 
// (3 images) in the centre of the index page
// Author: fgj absil
// Date: 05 Dec 2006, 06/01/07
//

// initialize and preload the collection of images
var imgArray = new Array()
imgArray[0] = new Image();
imgArray[1] = new Image();
imgArray[2] = new Image();
imgArray[3] = new Image();
imgArray[4] = new Image();
imgArray[5] = new Image();
imgArray[6] = new Image();
imgArray[7] = new Image();
imgArray[8] = new Image();
imgArray[9] = new Image();
imgArray[10] = new Image();
imgArray[11] = new Image();
imgArray[12] = new Image();
imgArray[13] = new Image();

imgArray[0].src="photo/score03.jpg"
imgArray[1].src="photo/violin06.jpg"
imgArray[2].src="photo/guitar04.jpg"
imgArray[3].src="photo/tsax10.jpg"
imgArray[4].src="photo/flute03.jpg"
imgArray[5].src="photo/keybd08.jpg"
imgArray[6].src="photo/mtools02.jpg"
imgArray[7].src="photo/keybd03.jpg"
imgArray[8].src="photo/tsax07.jpg"
imgArray[9].src="photo/violin09.jpg"
imgArray[10].src="photo/flute08.jpg"
imgArray[11].src="photo/trumpet01.jpg"
imgArray[12].src="photo/flugel02.jpg"
imgArray[13].src="photo/tvalve09.jpg"

// This function is executed upon loading the index page
function init() {
  // set the timer interval (in milliseconds) for the
  // picture show update
  intervalID = setInterval(changeImg,2500);
}

// function for swapping pictures (jpg-images) in table cell
function changeImg() {
  // identify the image fields (an array) in the table on the index page 
  var thisImg = new Array()
  thisImg[0] = (document.all) ? document.all.jpgField1 : document.getElementById("jpgField1") 
  thisImg[1] = (document.all) ? document.all.jpgField2 : document.getElementById("jpgField2") 
  thisImg[2] = (document.all) ? document.all.jpgField3 : document.getElementById("jpgField3") 
  // thisImg[3] = (document.all) ? document.all.jpgField4 : document.getElementById("jpgField4") 
  // thisImg[4] = (document.all) ? document.all.jpgField5 : document.getElementById("jpgField5") 

  // randomize the field and the image in the field
  var imgIndex
  var jpgIndex
  jpgIndex =  Math.floor(imgArray.length*Math.random())+0;
  imgIndex =  Math.floor(thisImg.length*Math.random())+0;
  // alert("function CHANGEIMG entered. Img= "+jpgIndex+" Field: "+imgIndex)
  thisImg[imgIndex].width="180";
  thisImg[imgIndex].src=imgArray[jpgIndex].src;
}



