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

var randomimages=new Array(
							"images/products/biala_shipka.jpg",
							"images/products/biala_shipka_pechena.jpg",
							"images/products/carska_turshia.jpg",
							"images/products/celi_domati.jpg",
							"images/products/celi_domati_nebeleni.jpg",
							"images/products/fiferoni.jpg",
							"images/products/guvech.jpg",
							"images/products/kompot_kaisii.jpg",
							"images/products/kompot_praskovi.jpg",
							"images/products/konfitur_qgodi.jpg",
							"images/products/krastavichki_extra.jpg",
							"images/products/marinovana_kapiq.jpg",
							"images/products/meshana_turshia.jpg",
							"images/products/paprikash.jpg",
							"images/products/pechena_kapiq.jpg",
							"images/products/kompot_qgodi.jpg",
							"images/products/riazano_zele_1.jpg",
							"images/products/riazano_zele_2.jpg",
							"images/products/kompot_sini_slivi.jpg",
							"images/products/sladko_qgodi.jpg",
							"images/products/sladko_smokini.jpg",
							"images/products/sladko_zeleni_orehcheta.jpg",
							"images/products/sterilizirani_kornishoni_1.jpg",
							"images/products/sterilizirani_kornishoni_2.jpg",
							"images/products/turshiq_chesyn.jpg",
							"images/products/turshiq_krastavica.jpg",
							"images/products/zelen_fasul.jpg",
							"images/products/zelevi_lista_1.jpg",
							"images/products/zelevi_lista_2.jpg")

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))]+'" height="275">')

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)