// (C) 2003 CodeLifter.com
// Free for all users, but leave in this  header

// =======================================
// set the following variables
// =======================================

// Set speed (milliseconds)
var speed = 3000

// 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] = 'kyackHomepage.jpg'
Pic[1] = 'cyclingHomepage.jpg'
Pic[2] = 'rowingHomepage.jpg'
Pic[3] = 'runningHomepage.jpg'
Pic[4] = 'walkingHomepage.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]
}

function runBGSlideShow(){
   if (document.body){
   document.getElementById('homepageBody').style.background = 'url(images/'+ Pic[j] + ')';
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runBGSlideShow()', speed)
   }
}



runBGSlideShow();

//=======================================
// Display a ramdom image on each call
//=======================================

function displayRandomImage(){
   var index = Math.floor(Math.random() * Pic.length);
   document.getElementById('homepageBody').style.background = 'url(images/'+ Pic[index] + ')';
}

// perform select image to display when the document is loaded
    window.onload=function(){
			 displayRandomImage();
    };