/*
Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
For this script and more, visit http://www.javascriptkit.com
*/

var delay=4000 //set delay in miliseconds
var curindex=0

var randomimages=new Array()

	randomimages[0]="fotos/1_.jpg"
	randomimages[1]="fotos/2_.jpg"
	randomimages[2]="fotos/3_.jpg"
	randomimages[3]="fotos/4_.jpg"
	randomimages[4]="fotos/5_.jpg"
	randomimages[5]="fotos/6_.jpg"
	randomimages[6]="fotos/7_.jpg"
	randomimages[7]="fotos/8_.jpg"
	randomimages[8]="fotos/10_.jpg"

var preload=new Array()

for (n=0;n<randomimages.length;n++)
{
	preload[n]=new Image()
	preload[n].src=randomimages[n]
}

document.write('<img id="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'" alt="" />')

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)
