//    IMAGE CYCLER v2.0     
//     by Angus Turnbull      
//  http://www.twinhelix.com  
// Visit for more scripts!   


function imgCycle(dir) { with (this)

{

 // Stop any exiting play function if this is called manually.

 stop();


 // Increment and mod by the image array length.

 currImg += dir;

 currImg = currImg % data.length;

 if (currImg < 0) currImg += data.length;


 // The image in question -- perhaps nested within its parent layer for NS4.

 var imgRef = parLyr.document.images[myName + 'Img'];


 // IE filters active?

 var f = imgRef.filters;

 if (f&&f.length&&f[0]) f[0].Apply();

 // Swap the image, and play the filter if applicable.

 imgRef.src = data[currImg].src;

 if (f&&f.length&&f[0]) f[0].Play();

}}


function imgPlay() { with (this)

{

 // Cycle one image forwards -- cycle() will stop an existing timeout if applied.

 cycle(1);

 timer = setTimeout(myName + '.play()', delay);

}}


function imgStop()

{

 // Clear the play timer to stop autocycling.

 clearTimeout(this.timer);

 this.timer = null;

}


function ImageCycle(myName, delay, parLyr)

{

 this.myName = myName;

 this.delay = delay;

 this.timer = 0;

 this.parLyr = (document.layers && parLyr ? eval(parLyr) : window);

 this.currImg = 0;


 this.data = new Array();

 for (var i = 3; i < arguments.length; i++)

 {

  // Preload images into an array before swapping.

  this.data[i - 3] = new Image();

  this.data[i - 3].src = arguments[i];

 }

 

 this.cycle = imgCycle;

 this.play = imgPlay;

 this.stop = imgStop;

}









// *** START EDITING HERE ***


// Create a new image object, and pass its own name and delay between cycles in milliseconds.

// The third parameter is optional -- if you're positioning the image within an NS4 layer make

// it a string that when evaluated returns a reference to the layer, or just leave it null as is. 

// The fourth parameter onwards is a list of image filenames, replace with your own images of course.


var picRotate1 = new ImageCycle('picRotate1', '5500', null,

 'artists/fischer/fischer1t.jpg', 'artists/christie/christie2t.jpg','artists/winn/winn3t.jpg', 'artists/speights/speights2t.jpg','artists/serras/serras1t.jpg');


//New objects by Epaul

var picRotate2 = new ImageCycle('picRotate2', '16000', null,

 'images/bahiass.jpg', 'artists/stoller/stoller2t.jpg', 'artists/friedler/friedler3t.jpg', 'artists/knack/knack1t.jpg',  'artists/beunaiche/beunaiche2t.jpg', 'artists/woods/woods1t.jpg');

var picRotate3 = new ImageCycle('picRotate3', '9000', null,

 'artists/medvedev/medvedev1t.jpg', 'artists/allen/allen2t.jpg', 'artists/lehrer/lehrer2t.jpg', 'artists/homer/homer1t.jpg', 'artists/shank/shank2t.jpg');


// Start onload, make sure any other functions are called as well...

var imgOldOL = window.onload;

window.onload = function()

{

 if (imgOldOL) imgOldOL();

 picRotate1.play();
 picRotate2.play();
 picRotate3.play();

}

