//----------------------------------------------------------------------------------------------
//   Script Name:     Picture Cycler
//   Purpose:         Cycle 4 pictures in 1 slot
//----------------------------------------------------------------------------------------------
//   Created By:      Recharge Web Design
//   Creation Date:   July 2007
//----------------------------------------------------------------------------------------------
//   Do not forget to recursively call the function.
//   the delay doesnt work right if you dont.
//----------------------------------------------------------------------------------------------


// The image to be changed should have name="cycle"

		// preload images
			pic1= new Image(434, 300); 
			pic1.src= "images/home_1.jpg"; 
			pic2= new Image(434, 300); 
			pic2.src= "images/home_2.jpg"; 
			pic3= new Image(434, 300); 
			pic3.src= "images/home_3.jpg"; 
			pic4= new Image(434, 300); 
			pic4.src= "images/home_4.jpg"; 
		
		// insert the pictures into an array
			var pics = new Array()
			pics[0] = 'images/home_1.jpg';
			pics[1] = 'images/home_2.jpg';
			pics[2] = 'images/home_3.jpg';
			pics[3] = 'images/home_4.jpg';
		
		// set counter time - in milliseconds
			var counter = 5000;
			
		// set up variable to rotate pics
			var tmp = 0;
			
		// set max number of pictures
			var max = pics.length-1;
			
		// declare variable
			var timer = 0;
		
		function cycle_pics()
		{
			document.images.cycle.src = pics[tmp];
			tmp++;
			if (tmp>max) {tmp=0;}
 			timer = setTimeout("cycle_pics();", counter);
		}


