/*
	Script: styles.js
	
	Copyright: Fishnet NewMedia (c) 2005
	
	Create: 12.06.05
	
	Version: 1.0
	
	Compatibility: JavaScript 1.2
	
	Changes: none
*/

var thumbnails = null;

// create an object literal to be used as an 
// associative array for storing image objects
var image_cache = {};
image_cache["spacer"] = imageLoad("/images/spacer.gif");
for (var i = 1; i <= thumbnail_total; i++) {
	var num = i < 10 ? "0" + i.toString() : i;
	image_cache["photo_name_" + num] = imageLoad(thumbnail_path + "photo_name_" + num + ".gif");
	//image_cache["photo1_" + num] = imageLoad(thumbnail_path + "photo1_" + num + ".jpg");
	//image_cache["photo2_" + num] = imageLoad(thumbnail_path + "photo2_" + num + ".jpg");
}

function imageLoad(filename) {
    // create a new image object and returns object to caller
    var img = new Image();
    img.src = filename;
    return img;
}

function initThumb() {
	// create a reference to all swatches
	thumbnails = document.getElementsByName("thumbnail");
	// set the mouseover event handler for all swatches
	for (var i = 0; thumbnails[i]; i++) {
		//thumbnails[i].onclick = clickThumb;
		thumbnails[i].onmouseover = mouseOverThumb;
		thumbnails[i].onmouseout = mouseOutThumb;
	}
}

/*
function clickThumb() {
	// reset all thumbnail borders
	for (var i = 0; thumbnails[i]; i++) {
		thumbnails[i].className = "box";
	}
	// swap the photos
	var regx = /\d+/;
	var match = null;
	match = regx.exec(this.src);
	document.photo1_.src = image_cache["photo1_" + match[0]].src;
	document.photo2_.src = image_cache["photo2_" + match[0]].src;
}
*/

function mouseOverThumb() {
	// change the thumbnail border
	this.className = "box_hover";
	// swap the photo name image
	var regx = /\d+/;
	var match = null;
	match = regx.exec(this.src);
	document.photo_name.src = image_cache["photo_name_" + match[0]].src;
}

function mouseOutThumb() {
	// change the thumbnail border
	if (this.className == "box_hover") this.className = "box";
	document.photo_name.src = image_cache["spacer"].src;
}