﻿//Define images
if (document.images){
	var randomnumber=Math.floor(Math.random()*18)
	var picNum = randomnumber;
	var rotateSpeed = 3500;
	
	var pic = new Array();
	pic[0] = new Image();
	pic[0].src = "/images/rotates/0.png";
	pic[1] = new Image();
	pic[1].src = "/images/rotates/1.png";
	pic[2] = new Image();
	pic[2].src = "/images/rotates/2.png";
	pic[3] = new Image();
	pic[3].src = "/images/rotates/3.png";
	pic[4] = new Image();
	pic[4].src = "/images/rotates/4.png";
	pic[5] = new Image();
	pic[5].src = "/images/rotates/5.png";
	pic[6] = new Image();
	pic[6].src = "/images/rotates/6.png";
	pic[7] = new Image();
	pic[7].src = "/images/rotates/7.png";
	pic[8] = new Image();
	pic[8].src = "/images/rotates/8.png";
	pic[9] = new Image();
	pic[9].src = "/images/rotates/9.png";
	pic[10] = new Image();
	pic[10].src = "/images/rotates/10.png";
	pic[11] = new Image();
	pic[11].src = "/images/rotates/11.png";
	pic[12] = new Image();
	pic[12].src = "/images/rotates/12.png";
	pic[13] = new Image();
	pic[13].src = "/images/rotates/13.png";
	pic[14] = new Image();
	pic[14].src = "/images/rotates/14.png";
	pic[15] = new Image();
	pic[15].src = "/images/rotates/15.png";
	pic[16] = new Image();
	pic[16].src = "/images/rotates/16.png";
	pic[17] = new Image();
	pic[17].src = "/images/rotates/17.png";
	
	var target = new Array();
	target[0] = "/techpol_guide.html"
	target[1] = "/trans_guide.html"
	target[2] = "/energy_guide.html"
	target[3] = "/germline_guide.html"
	target[4] = "/kevorkian_guide.html"
	target[5] = "/species_guide.html"
	target[6] = "/nano_guide.html"
	target[7] = "/wire_guide.html"
	target[8] = "/research_ethics_guide.html"
	target[9] = "/fmri_guide.html"
	target[10] = "/mouse_guide.html"
	target[11] = "/agency_guide.html"
	target[12] = "/nanorisk_guide.html"
	target[13] = "/climate_guide.html"
	target[14] = "/journal_guide.html"
	target[15] = "/tap_guide.html"
	target[16] = "/nanoen_guide.html"
	target[17] = "/trolly_guide.html"
}

//Rotate the pictures function
function rotatePics() {
	if(picNum < (pic.length - 1)) {
		picNum++;
	}
	else {
		picNum = 0;
	}
	document.pic.src = pic[picNum].src;
	setTimeout('rotatePics()', rotateSpeed);
}

//Makes it so the picture when clicked on links to corresponding page
function makeLinkTo() {
	window.location = target[picNum];
}