
//This creates an array, gives it the name clcImages and puts the images into it.
	clcImages = new Array("http://www.khsclc.co.uk/images/albums/clc_pres_07/thumbs/DSC_0584.jpg","http://www.khsclc.co.uk/images/albums/clc_pres_07/thumbs/DSC_0585.jpg","http://www.khsclc.co.uk/images/albums/clc_pres_07/thumbs/DSC_0586.jpg","http://www.khsclc.co.uk/images/albums/clc_pres_07/thumbs/DSC_0587.jpg","http://www.khsclc.co.uk/images/albums/clc_pres_07/thumbs/DSC_0588.jpg","http://www.khsclc.co.uk/images/albums/clc_pres_07/thumbs/DSC_0589.jpg","http://www.khsclc.co.uk/images/albums/clc_pres_07/thumbs/DSC_0590.jpg")

	//this sets the image count to the length of the array, this makes it easy to add or remove images
    imgCt = clcImages.length
    firstTime = true

//start the rotate function
 function rotate() {
//check if the browser understands the image object
    if (document.images) {
//is this the first time the images appear? If so, i.e true then show a random image first		
        if (firstTime) {
            thisAd = Math.floor((Math.random() * imgCt))
            firstTime = false
        }
//This waits for the first image to laod before changing to the next image, handy for slow internet connections		
		if (document.khsImages.complete){
			thisAd++			//if loaded add 1 to thisAd
			if (thisAd == imgCt){		//if thisAd equals the image count 
				thisAd = 0				//then reset to zero and start rotate again
			}
        }
        document.khsImages.src=clcImages[thisAd]		//This sets the source of the image cycle khsImages is in the array asImages
        
		}
		setTimeout("rotate()", 5 * 4000)
 }

