/** Random Logo Javascript File
*
* This file work via the use of and inital array table.
* All available logos are added to the array in the format of
* image[x] = 'image'     where x is the next available number in the array
* 
* A random number is then generated between 0 and the length of the array
* to decide which image to display.
*
* The image is the displayed as the background of the uppermost table row on the page
* This is called by defining the desired row with   id="logo" 
*/

var imageID = 0; 

function StringArray (n) { //create a new Array and assign all values to ' ' to avoid null values. 
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '
  }
}

image = new StringArray(10) //assign images to the array
image[0] = '..//images//logo1.jpg'
image[1] = '..//images//logo2.jpg'
image[2] = '..//images//logo3.jpg'
image[3] = '..//images//logo4.jpg'
image[4] = '..//images//logo5.jpg'
image[5] = '..//images//logo6.jpg'
image[6] = '..//images//logo1.jpg'
image[7] = '..//images//logo2.jpg'
image[8] = '..//images//logo3.jpg'
image[9] = '..//images//logo4.jpg'


function getRandomImage() 
{
    imageID = Math.round((image.length - 1)*Math.random()) //create a random number between 0 and number of images in list.
	return(image[imageID]) //call image from list
}

function randomImage()
{
document.all.logo.background = getRandomImage() //assign the random image to the table cell.
}
