// JScript source code
// The list of images to display in the supporters slideshow
//creating a array of the image object
var imageSupporters=new Array(
"images/Supporters/awardsforall.jpg",
"images/Supporters/bbcbreathingspaceslogo.jpg",
"images/Supporters/ChildrenInNeed2.jpg",
"images/Supporters/lloydstsbfoundation.jpg",
"images/Supporters/MineralsTrust.jpg",
"images/Supporters/scf-logo.gif",
"images/Supporters/Colour_logo.jpg",
"images/Supporters/AyrshireLeader.jpg",
"images/Supporters/EuroAgriFund.jpg",
"images/Supporters/ScotGov.jpg",
"images/Supporters/LOGOCRT.jpg",
"images/Supporters/CoalRegen.jpg"
)
          
//variable that will increment through the images
var initialS = true;

// set the delay between images
var timeDelayS;

// number of last image ... used to ensure we don't get
// the same image twice in a row
var numS = -1;
 
//preload the images in the cache so that the images load faster
//create new instance of images in memory 
var imagePreloadS = new Array()
for (i=0;i<imageSupporters.length;i++)
{
   	imagePreloadS [i]=new Image()
	// set the src attribute
	imagePreloadS [i].src=imageSupporters[i]
}

// Find the next image by random - and ensure it is not the 
// same as the one previously selected.
function nextImageS()
{
	var newNum = num;
	while (newNum == num)
	{
		newNum = Math.floor(Math.random()*11);
	}
	num = newNum;
	return imageSupporters[num];
}



	
//for automatic Slideshow of the Images
function slideshowSupporters_automatic(pathToRoot)
{ 
	// Is this the first time? setthe first image some more time.
	if (initialS )
	{	
		initialS = false;	
		timeDelayS=setTimeout("slideshowSupporters_automatic('" + pathToRoot + "')", 4000) 
	}
    else
    {
    	if (document.images.supporters.filters)
    	{
    		document.images.supporters.filters.item(0).Apply();
     		document.images.supporters.filters.item(0).Play();
     	}
     	
       	//sets the timer value to 4 seconds,we can create a timing loop by using the setTimeout method
       	timeDelayS=setTimeout("slideshowSupporters_automatic('" + pathToRoot + "')", 8000) 
       	document.images.supporters.src= pathToRoot + nextImageS();  
     }
}