// ======================================================================
// THE USER SHOULD CHANGE THIS PART TO CUSTOMIZE THE SCRIPT
// ======================================================================

// gSlideshowInterval - determines how often the slide show is
// refreshed (time given in seconds).

gSlideshowInterval = 8;

// gNumberOfImages - the total number of images available for display.
// This is used both to set up the image array and to manage the actual
// slideshow.

gNumberOfImages = 11;

// gImages - An array that holds the URLs identifying the images to be
// shown in the slide show.

gImages = new Array(gNumberOfImages);

gImages[0] = "combat_consulting_02_300.png";
gImages[1] = "us_cellular_coliseum_01_300.png"; 
gImages[2] = "1057_x_logo.png";
gImages[3] = "967_i_rock_logo.png";
gImages[4] = "kubed_br_logo.png";
gImages[5] = "car_x_logo.png";
gImages[6] = "APA_white_logo.png";
gImages[7] = "national_guard_logo.png";
gImages[8] = "budweiser_black_logo.png";
gImages[9] = "kubed_br_logo.png";
gImages[10] = "combat_consulting_02_300.png";


urls= new Array(gNumberOfImages);

urls[0]="http://www.combatconsulting.net";
urls[1]="http://www.uscellularcoliseum.com";
urls[2]="http://www.1057thex.com";
urls[3]="http://www.967irock.com";
urls[4]="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=145411731";
urls[5]="http://www.carx.com";
urls[6]="http://www.poolplayers.com/";
urls[7]="http://www.1800goguard.com/";
urls[8]="http://www.budweiser.com/";
urls[9]="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=145411731";
urls[0]="http://www.combatconsulting.net";


// ======================================================================
// DON'T CHANGE THIS PART
// ======================================================================

// canManipulateImages - check if the browser we're using can do
// clever stuff with document images.

function canManipulateImages() {
if (document.images)
return true;
else
return false;
}

// loadSlide
//
// Load a given image into place by substituting its URL for the URL
// currently loaded by the <IMG> object called 'slide'.

function loadSlide(imageURL,imageHREF,imageURL_one,imageHREF_one) {
if (gImageCapableBrowser) {
document.getElementById('slide').src=imageURL;
document.getElementById('slideurl').href=imageHREF;
return false;
}
else {
return true;
}
}

// nextSlide
//
// Update the counter that shows which slide is being displayed, and
// load it into place. The modulo (%) is there to ensure that we roll
// over when we reach the end of the slideshow.

function nextSlide() {
while(true) {
gNextImage = pickRandom(gNumberOfImages);
if (gNextImage != gCurrentImage)
break;
}
gCurrentImage = gNextImage;
loadSlide(gImages[gCurrentImage],urls[gCurrentImage]);
}

// pickRandom
//
// Return a random number in a given range (it returns a number
// between 0 and (range - 1). If 'Math.random' isn't implemented in
// this version of JavaScript, return a value faked up from the
// current time.

function pickRandom(range) {
if (Math.random)
return Math.round(Math.random() * (range-1));
else {
var now = new Date();
return (now.getTime() / 1000) % range;
}
}

// gImageCapableBrowser - is this browser hip to images? Set up
// a global variable so that we don't have to keep calling a function
// (useful if the function becomes costly to compute).

gImageCapableBrowser = canManipulateImages();

// gCurrentImage - a variable used to keep track of the image
// currently being displayed to the user.

gCurrentImage = 0;

// Set up the timer. This will call the 'nextSlide()' function repeatedly at
// the specified interval (and will continue to do so until the page is unloaded).

setInterval("nextSlide()",gSlideshowInterval * 1000);