
var slideSource;
var count = 1; //Count starts on 1 so that the initial slide is not repeated when moving into the slideShow function
var slideArrayLength = 0;

function setUp(){
	
	var slide = new Array(); //Get these photos from the mySQL table for each category
		slide[0] = 'images/bannerCoreValues.jpg';
		slide[1] = 'images/bannerStudents.jpg';
		slide[2] = 'images/bannerChildren.jpg';
		
	slideArrayLength = slide.length;
	slideSource = new Array();
	
	for(var i=0; i<slideArrayLength; i++) 
	{
	  slideSource[i] = new Image();
	  slideSource[i].src = slide[i];
	}
	
	document.getElementById('slide').style.backgroundImage = "url("+slideSource[0].src+")";  //This is to set the initial picture to be displayed
	setInterval( "slideShow()", 5000 ); //Repeates the slideshow over and over at X interval
}

function slideShow(){
    document.getElementById('slide').style.backgroundImage = "url("+slideSource[count].src+")";
	count++;
	if(count >= slideArrayLength )
	{
		count = 0;
	}	
}
