var alertTimerId = 0;
var photos=new Array()
var photoslink=new Array()
var photoslinknewwindow=new Array()
var which=0
var time_const=10000;

//define images. You can have as many as you want:
photos[0]="rotation1.png"
photos[1]="rotation2.png"
photos[2]="rotation3.png"
photos[3]="rotation4.png"
photos[4]="rotation5.png"

//Specify whether images should be linked or not (1=linked)
var linkornot=1

//Set corresponding URLs for above images. Define ONLY if variable linkornot equals "1"
photoslink[0]="http://www.averagepersongardening.com/seed_subscriptions.php"
photoslink[1]="javascript: load_articles(34);"
photoslink[2]="http://www.averagepersongardening.com/affiliate/affiliate_index.php"
photoslink[3]="javascript: window_change(3);"
photoslink[4]="http://www.ehow.com/how_5658358_grow-oregano-home-vegetable-garden.html"

//Set corresponding new window targets = 0 = no, 1 = yes
photoslinknewwindow[0]=1;
photoslinknewwindow[1]=0;
photoslinknewwindow[2]=1;
photoslinknewwindow[3]=0;
photoslinknewwindow[4]=1;

//do NOT edit pass this line

var preloadedimages=new Array()
for (i=0;i<photos.length;i++){
preloadedimages[i]=new Image()
preloadedimages[i].src=photos[i]
}


function applyeffect(id){
if (document.all && photoslider.filters){
//photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23)
photoslider.filters.revealTrans.Transition=id
photoslider.filters.revealTrans.stop()
photoslider.filters.revealTrans.apply()
}
}



function playeffect(){
if (document.all && photoslider.filters)
photoslider.filters.revealTrans.play()
}

function keeptrack(){
// window.status="Image "+(which+1)+" of "+photos.length
}


function backward(){
	clearTimeout ( alertTimerId );
	if (which==0){
		which=photos.length;
	}
	which--
	applyeffect(7)
	document.images.photoslider.src=photos[which]
	playeffect()
	keeptrack()
	alertTimerId = setTimeout ("forward(1)", time_const );
}

function forward(id){
if (id==0) {
	clearTimeout ( alertTimerId );
}
if (which==photos.length-1){
	which=-1;
}
	which++
	applyeffect(6)
	document.images.photoslider.src=photos[which]
	playeffect()
	keeptrack()
	alertTimerId = setTimeout ("forward(1)", time_const );
}

function transport(){
	if (photoslinknewwindow[which]==1) {
		window.open(photoslink[which])	//new window
	}
	else {		
		window.location=photoslink[which]	//same window
	}

}

function start_our_timer() {
	alertTimerId = setTimeout ("forward(1)", time_const );
}
