// (C) 2003 Sune Keller
// http://www.sune-keller.dk
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// =======================================
// set the following variables
// =======================================

// Set slideShowSpeed (milliseconds)
//var slideShowSpeed = 5000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images/1.jpg'
Pic[1] = 'images/2.jpg'
Pic[2] = 'images/3.jpg'
Pic[3] = 'images/4.jpg'
Pic[4] = 'images/5.jpg'
Pic[5] = 'images/6.jpg'
Pic[6] = 'images/7.jpg'
Pic[7] = 'images/8.jpg'
Pic[8] = 'images/9.jpg'
Pic[9] = 'images/10.jpg'
Pic[10] = 'images/11.jpg'
Pic[11] = 'images/12.jpg'
Pic[12] = 'images/13.jpg'
Pic[13] = 'images/14.jpg'
Pic[14] = 'images/15.jpg'
Pic[15] = 'images/16.jpg'
Pic[16] = 'images/17.jpg'
Pic[17] = 'images/18.jpg'
Pic[18] = 'images/19.jpg'
Pic[19] = 'images/20.jpg'
Pic[20] = 'images/21.jpg'
Pic[21] = 'images/22.jpg'
Pic[22] = 'images/23.jpg'
Pic[23] = 'images/24.jpg'
Pic[24] = 'images/25.jpg'
Pic[25] = 'images/26.jpg'
Pic[26] = 'images/27.jpg'
Pic[27] = 'images/28.jpg'
Pic[28] = 'images/29.jpg'
Pic[29] = 'images/30.jpg'
Pic[30] = 'images/31.jpg'

// =======================================
// do not edit anything below this line
// =======================================

var t
//var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}


// Get random picture
function getRandomPicture()
{
    var ranNum = Math.round(Math.random()*(p-1));
    return ranNum;
}


// Set slideShowSpeed (milliseconds)
function getRandomSpeed()
{
    var ranNum = Math.round(Math.random()*5);
    ranNum = (ranNum * 1000) + 8000;
    return ranNum;
}

function runSlideShow()
{
   if (document.all)
   {
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[getRandomPicture()].src
   
   if (document.all)
   {
      document.images.SlideShow.filters.blendTrans.Play()
   }
   t = setTimeout('runSlideShow()', getRandomSpeed())
}

function runSlideShow2()
{
   if (document.all)
   {
      document.images.SlideShow2.style.filter="blendTrans(duration=2)"
      document.images.SlideShow2.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow2.filters.blendTrans.Apply()      
   }
   document.images.SlideShow2.src = preLoad[getRandomPicture()].src
   
   if (document.all)
   {
      document.images.SlideShow2.filters.blendTrans.Play()
   }
   t = setTimeout('runSlideShow2()', getRandomSpeed())
}

function runSlideShow3()
{
   if (document.all)
   {
      document.images.SlideShow3.style.filter="blendTrans(duration=2)"
      document.images.SlideShow3.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow3.filters.blendTrans.Apply()      
   }
   document.images.SlideShow3.src = preLoad[getRandomPicture()].src
   
   if (document.all)
   {
      document.images.SlideShow3.filters.blendTrans.Play()
   }
   t = setTimeout('runSlideShow3()', getRandomSpeed())
}

function runSlideShow4()
{
   if (document.all)
   {
      document.images.SlideShow4.style.filter="blendTrans(duration=2)"
      document.images.SlideShow4.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow4.filters.blendTrans.Apply()      
   }
   document.images.SlideShow4.src = preLoad[getRandomPicture()].src
   
   if (document.all)
   {
      document.images.SlideShow4.filters.blendTrans.Play()
   }
   t = setTimeout('runSlideShow4()', getRandomSpeed())
}


// Start all slideshows on page
function startSlideShows()
{
	setTimeout('runSlideShow()', getRandomSpeed()-3000);
	setTimeout('runSlideShow2()', getRandomSpeed());
	setTimeout('runSlideShow3()', getRandomSpeed()-2000);
	setTimeout('runSlideShow4()', getRandomSpeed());
}
