// store an interval in a variable

var pause = 3000;

// create and initialize a counter                                    

var n = 0; 

// create an array of image file names                                         

var imgs = new Array ( "images/slide1.jpg", 
					   "images/slide2.jpg", 
					   "images/slide3.jpg", 
					   "images/slide4.jpg",
					   "images/slide5.jpg",
					   "images/slide6.jpg" );

// preload all the images

var preload = new Array();                             

for( var i = 1; i < imgs.length; i++ )
{                                            
  preload[i] = new Image();           
  preload[i].src = imgs[i];                                     
}

// a function to display each image for the set interval

function rotate()
{                       
  document.images.pic.src = imgs[n];                   
  ( n == (imgs.length - 1 )) ? n = 0 : n++;  
  setTimeout( "rotate()", pause );                              
}

// specify the onload event-handler

window.onload = rotate;