var selectedImage = -1;
var images = new Array();

function MM_findObj(n, d) {
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function mouseover(index) {
	/*
		Fired when the user mouses over one of the navigation images.  Here we need
		to find the img object and then change the image to index + 1
	*/
	if (index != selectedImage && imageLoad[index + 1] != "") {
		x = MM_findObj("image" + index);
		x.src =  images[index + 1].src;
	}
}

function mouseout(index) {
	/*
		Fired when the user's mouse leaves the space of an image.  If this image
		is not the selected image then we want to put the normal image back
		index.
	*/
	if (index != selectedImage && imageLoad[index] != "") {
		x = MM_findObj("image" + index);
		x.src =  images[index].src;
	}
}

function mousedown(index) {
	/*
		Fired when the user clicks on an image.  Here we want to return the current
		selected image to normal and change this one to selected index + 2
	*/
	if (selectedImage != -1 && selectedImage != index && imageLoad[selectedImage] != "") {
		/* Return the current selected to normal */
		x = MM_findObj("image" + selectedImage);
		x.src = images[selectedImage].src;
	}
	if (imageLoad[index + 2] != "") {
		x = MM_findObj("image" + index);
		x.src = images[index + 2].src;
	}
	selectedImage = index;
}

function loadimages(a) {
	/*
		Pre-load the images we are going to use
	*/
	for (i=0; i<a.length; i++) {
		if (a[i] != "") {
			images[i] = new Image;
			//alert(a[i]);
			images[i].src = a[i];
		}
	}
}