var slideCache = new Array();
function RunSlideShowWithLinks(pictureID,linkID,imageLinks,displaySecs)
{
	var separator = imageLinks.indexOf(";");
	var nextImage = imageLinks.substring(0,separator);
	if (slideCache[nextImage] && slideCache[nextImage].loaded)
	{
		var futureImages= imageLinks.substring(separator +1,imageLinks.length) + ';' + nextImage;
		separator = futureImages.indexOf(";");
		var nextLink = futureImages.substring(0,separator);
		futureImages= futureImages.substring(separator+1,imageLinks.length) + ';' + nextLink;

		if (document.all)
		{
			document.getElementById(pictureID).style.filter=
				"blendTrans(duration=1)";
			document.getElementById(pictureID).filters.blendTrans.Apply();
		}
		document.getElementById(pictureID).src = nextImage;
		document.getElementById(linkID).href = nextLink;
		if (document.all)
		{
			document.getElementById(pictureID).filters.blendTrans.Play();
		}
		setTimeout("RunSlideShowWithLinks('"+pictureID+"','"+linkID+"','"+futureImages+"',"+displaySecs+")",
			displaySecs*1000);
		// Identify the next image to cache.
		separator = futureImages.indexOf(";");
		nextImage = futureImages.substring(0,separator);
	} else {
		setTimeout("RunSlideShowWithLinks('"+pictureID+"','"+linkID+"','"+imageLinks+"',"+displaySecs+")",250);
	}
	// Cache the next image to improve performance.
	if (slideCache[nextImage] == null) {
		slideCache[nextImage] = new Image;
		slideCache[nextImage].loaded = false;
		slideCache[nextImage].onload = function(){this.loaded=true};
		slideCache[nextImage].src = nextImage;
	}		
}

function changeImage(index,jan) {
var JAN_CODE = "" + jan;
	if (document.all) {
		document.all('changePhoto').src = 'http://www.moshimo.com/item_image/' + JAN_CODE + '/' + index + '/l.jpg';
	} else if (document.layers) {
		document.layers['changePhoto'].src = 'http://www.moshimo.com/item_image/' + JAN_CODE + '/' + index + '/l.jpg';
	} else if (document.getElementById) {
		document.getElementById('changePhoto').src = 'http://www.moshimo.com/item_image/' + JAN_CODE + '/' + index + '/l.jpg';
	}
}