/*
Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
For this script and more, visit http://www.javascriptkit.com
*/

var delay=4500 //set delay in miliseconds
var curindex=0

var randomimages=new Array()

	randomimages[0]="media/clients/gsk.gif"
	randomimages[1]="media/clients/pg.gif"
	randomimages[2]="media/clients/pepsico.gif"
	randomimages[3]="media/clients/dell.gif"
	randomimages[4]="media/clients/sw.gif"
	randomimages[5]="media/clients/westjet.gif"
	randomimages[6]="media/clients/estee.gif"
	randomimages[7]="media/clients/ml.gif"
	randomimages[8]="media/clients/sb.gif"
	randomimages[9]="media/clients/kpmg.gif"
	randomimages[10]="media/clients/bobj.gif"
	randomimages[11]="media/clients/ig.gif"														

var preload=new Array()

for (n=0;n<randomimages.length;n++)
{
	preload[n]=new Image()
	preload[n].src=randomimages[n]
}

document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')

function rotateimage()
{

if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
curindex=curindex==0? 1 : curindex-1
}
else
curindex=tempindex

	document.images.defaultimage.src=randomimages[curindex]
}

setInterval("rotateimage()",delay)