
// Original:  Robert Bui (astrogate@hotmail.com) -->
// Web Site:  http://astrogate.virtualave.net -->

// This script and many more are available free online at -->
// The JavaScript Source!! http://javascript.internet.com -->

// Begin

// ==============================================
// Copyright 2003 by jsCode.com
// Source: jsCode.com
// Author: etLux
// Free for all; but please leave in the header.
// ==============================================

// Set up the image files to be used.
var theImages1 = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array. Rememeber
// to increment the theImages[x] index!

theImages1[0] = 'images/homepage/01.jpg'
theImages1[1] = 'images/homepage/02.jpg'
theImages1[2] = 'images/homepage/03.jpg'
theImages1[3] = 'images/homepage/04.jpg'
theImages1[4] = 'images/homepage/05.jpg'
theImages1[5] = 'images/homepage/06.jpg'
theImages1[6] = 'images/homepage/07.jpg'
theImages1[7] = 'images/homepage/08.jpg'
theImages1[8] = 'images/homepage/09.jpg'
theImages1[9] = 'images/homepage/10.jpg'
theImages1[10] = 'images/homepage/11.jpg'
theImages1[11] = 'images/homepage/12.jpg'
theImages1[12] = 'images/homepage/13.jpg'
// ======================================
// do not change anything below this line
// ======================================

var j = 0
var p = theImages1.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages1[i]
}

var whichImage = Math.round(Math.random()*(p-1));
function showImage1(){
document.write('<img src="'+theImages1[whichImage]+'">');
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage2(){
document.write('<img src="'+theImages[whichImage]+'">');
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage3(){
document.write('<img src="'+theImages[whichImage]+'">');
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage4(){
document.write('<img src="'+theImages[whichImage]+'">');
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage5(){
document.write('<img src="'+theImages[whichImage]+'">');
}




var interval = 2.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;

var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("images/homepage/01.jpg");
image_list[image_index++] = new imageItem("images/homepage/02.jpg");
image_list[image_index++] = new imageItem("images/homepage/03.jpg");
image_list[image_index++] = new imageItem("images/homepage/04.jpg");
image_list[image_index++] = new imageItem("images/homepage/05.jpg");
image_list[image_index++] = new imageItem("images/homepage/06.jpg");
image_list[image_index++] = new imageItem("images/homepage/07.jpg");
image_list[image_index++] = new imageItem("images/homepage/08.jpg");
image_list[image_index++] = new imageItem("images/homepage/09.jpg");
image_list[image_index++] = new imageItem("images/homepage/10.jpg");
image_list[image_index++] = new imageItem("images/homepage/11.jpg");
image_list[image_index++] = new imageItem("images/homepage/12.jpg");
image_list[image_index++] = new imageItem("images/homepage/13.jpg");
var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}
//  End -->


// STEP TWO: Insert the onLoad event handler into your BODY tag

// <BODY OnLoad="rotateImage('rImage')">

//  STEP THREE: Copy this code into the BODY of your HTML document

//<img name="rImage" src="http://javascript.internet.com/img/image-cycler/01.jpg" width=120 height=90>


