/* Here are all the things you need in your page.

	<script language="javascript" src="timelinescript.js"></script>

	<body onload="start()">

	<div id="targetimage1div">
	<img src="flower1.jpg" id="targetimage1">
	</div>

*/

// List in order the image names assigned in the <img> tags where the changing will occur.
 	var targetimage = new Array("targetimage1")
 	
// List in order the names of the image groups to be used.
 	var imagearrays = new Array("image1")
 	
// List the image file names for each of the image groups listed above.
	var image1 = new Array("images/student1.jpg","images/student2.jpg","images/student3.jpg","images/student4.jpg");
 		
// Assign different variables, one for each of the image groups, and then set each one equal to 0.
 	var incrementals = new Array("i","j","k")			
	  	var i = 0; 
  		var j = 0; 
  		var k = 0; 
  	
   var initialdelay = new Array(3000,3000,3000)		// Initial time delay before first image change (in milliseconds)
	var timedelay = 3000;  	  	 // Delay between all images in milliseconds (1000 is 1 second)
	var fade = "yes"			    // Optional fade transition for Internet Explorer
	var transdur = ".30"			 // Length of this transition in seconds (accepts decimals)
  	
	function change(towhere,what,whatagain,counter){
  	  		counter++; if (counter >= what.length){counter = 0;}
		if (fade == "yes" && navigator.appName == "Microsoft Internet Explorer"){
	 		document.images[towhere].style.filter="blendTrans(duration='"+transdur+"')";
	 		document.images[towhere].filters.blendTrans.apply();
			document.images[towhere].src=what[counter];
	 		document.images[towhere].filters.blendTrans.play();
		}
		else if (fade == "yes" && transdur > 0){
			var from = document.images[towhere].src
			document.getElementById(towhere+'div').style.backgroundImage="url('"+from+"')";
			document.images[towhere].style.opacity=0;
			setTimeout("quickpause('"+towhere+"','"+what[counter]+"','"+transdur+"')",10);
		}
	  	else {
	  		document.images[towhere].src=what[counter];
  		}
	 	setTimeout("change('"+towhere+"',"+whatagain+",'"+whatagain+"',"+counter+")",timedelay);
	}
	function quickpause(towhere,what,fadedur){
		document.images[towhere].src=what;
		for (i=0; i<=25; i++) {
			setTimeout("fadenotie('"+towhere+"',"+i+")",i*fadedur*1000/25);
		}
	}
	function fadenotie(towhere,famt){
			document.images[towhere].style.opacity=famt/25;
	}
	function start(){
		var xyz = 0;
		while (xyz < imagearrays.length){
	  		setTimeout("change('"+targetimage[xyz]+"',"+imagearrays[xyz]+",'"+imagearrays[xyz]+"',"+incrementals[xyz]+")",initialdelay[xyz]);
	 		xyz++;
		}
	}
