<!--//array of images-->
var imageson=new Array();
imageson[0]=new Array;
imageson[0][0]="images/r1.jpg";
imageson[0][1]="images/r2.jpg";
imageson[0][2]="images/r3.jpg";
imageson[0][3]="images/r4.jpg";
 
  //declare variables-note these are global variables
 
  var x=0;
  var y=0;
  var imagenum=4;
  var pic=imageson[0][0] //this required for netscape try without it in both browsers!
					  //otherwise error that pic is not defined
//now we create our function
 function cycle() 
 {
  
  var pic=document.pic.src=imageson[0][x]; //note that x is larger each time thus changing the image

  if (x<imagenum)//if x is smaller than the variable imagenum - do this section
  	{
	if(y>=2){
		document.pic.src=imageson[0][0];
		setTimeout("cycle(pic)", 0);
	}
	else{
	  setTimeout("cycle(pic)", 4000);
	 }
  	}
	//if x is 11 reset x to 0 so it can loop (has been tested for memory leaks)
	if (x==4)	  //watch out for the == not = problem
		{
		x=0;
		y++;
		if(y<2){
		cycle();//this calls the function after setting x to 0
		}
		else
			document.pic.src=imageson[0][0];
		}
	else
	{
		x++;//everytime we call this function 1 is added to variable x
	}
	
	
  }