
var delay=5000 //set delay in miliseconds
var curindex=0
var randomimages=new Array()

	randomimages[0]="http://www.valorem.be/media/slideshow/1.jpg";
	randomimages[1]="http://www.valorem.be/media/slideshow/2.jpg";
	randomimages[2]="http://www.valorem.be/media/slideshow/3.jpg";
	randomimages[3]="http://www.valorem.be/media/slideshow/4.jpg";
	randomimages[4]="http://www.valorem.be/media/slideshow/5.jpg";

var preload=new Array()
for (n=0;n<randomimages.length;n++)
{
	preload[n]=new Image()
	preload[n].src=randomimages[n]
}
if(document.getElementById('valorem-expertises')){
	document.getElementById('valorem-expertises').innerHTML='<img name="defaultimage" alt="valorem expertises" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">';
	setInterval("rotateimage()",delay);
}

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];
	}

