var interval = 2500; // delay between rotating images (in seconds/1000)

var image_index = 0;
var image_list = new Array();
image_list[image_index++] = new imageItem("../images/productshots/monet_still.jpg");
image_list[image_index++] = new imageItem("../images/productshots/cezanne_still.jpg");
image_list[image_index++] = new imageItem("../images/productshots/vincent_still.jpg");
image_list[image_index++] = new imageItem("../images/productshots/3-d_still.jpg");
image_list[image_index++] = new imageItem("../images/productshots/airbrush_still.jpg");
image_list[image_index++] = new imageItem("../images/productshots/classic_still.jpg");
image_list[image_index++] = new imageItem("../images/productshots/oval_still.jpg");
var number_of_image = image_list.length;

var links_index = 0;
var links_list = new Array();
links_list[links_index++] = ("../products/monet.html");
links_list[links_index++] = ("../products/cezanne.html");
links_list[links_index++] = ("../products/vincent.html");
links_list[links_index++] = ("../products/three_d.html");
links_list[links_index++] = ("../products/airbrush.html");
links_list[links_index++] = ("../products/classics.html");
links_list[links_index++] = ("../products/oval.html");

function go() {
//	if the variable is undefined, then load the first url
	if (typeof links_list[image_index] == 'undefined') document.location.href = "../products/monet.html";
	else document.location.href = links_list[image_index];
}

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 getNextImage() {
	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);
}

// Delays the rotation before starting
function ImageRotator(place) {
	document[place].src = "../images/productshots/monet_still.jpg";
	timer = setTimeout("rotateImage('"+place+"')",2000);
}