/*******************************************************************************

FILE: mud_Scripts.js
REQUIRES: prototype.js, mud_FadeGallery.js
AUTHOR: Takashi Okamoto mud(tm) - http://www.mudcorp.com/
VERSION: 2.0 - converted to use prototype.js
DATE: 01/05/2006

--------------------------------------------------------------------------------

This file is part of MudFadeGallery.

	MudFadeGallery is free for anyone to use, but this header MUST be
	included, and may not be modified.

*******************************************************************************/

////////////////////////////////////////////////////////////////////////////////
// GLOBAL VARS

var imgsGallery = new Array();
var imgs;

///////////////////////////////////////////////////////////////////////////////
// MOUSE EVENTS

function setOnMouseClick() {
	var elements = document.getElementsByTagName("a");
	for (var i = 0; i < elements.length; i++) {
		switch(elements[i].className) {
			case "next":
				elements[i].onclick = function() {
					 imgs.nextImg();
					 return false;
				}
				break;
			case "prev":
				elements[i].onclick = function() {
					 imgs.prevImg();
					 return false;
				}
				break;
			case "s0":
				elements[i].onclick = function() {
					 imgs.showImg(0);
					 return false;
				}
				break;
			case "s1":
				elements[i].onclick = function() {
					 imgs.showImg(1);
					 return false;
				}
				break;
			case "s2":
				elements[i].onclick = function() {
					 imgs.showImg(2);
					 return false;
				}
				break;
			case "s3":
				elements[i].onclick = function() {
					 imgs.showImg(3);
					 return false;
				}
				break;
		}
	}
}

////////////////////////////////////////////////////////////////////////////////
// INIT

function init() {
	setOnMouseClick();
	// images gallery
	// load images note: imgsGallery[].image isn't an array of images, just strings to hold location
	imgsGallery[0] = new Object();
	imgsGallery[0].image = "images/od_990508_2B.jpg";
	imgsGallery[0].title = "99.05.08 #2B";
	imgsGallery[0].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/od_990508_2a.jpg";
	imgsGallery[1].title = "99.05.08 #2A";
	imgsGallery[1].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/od_990911_12.jpg";
	imgsGallery[2].title = "99.09.11 #12";
	imgsGallery[2].caption = "5\" x 7\" Platinum/Palladium Print";
	
		imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/od_990911_3.jpg";
	imgsGallery[3].title = "99.09.11 #3";
	imgsGallery[3].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[4] = new Object();
	imgsGallery[4].image = "images/od_990918_15.jpg";
	imgsGallery[4].title = "99.09.18 #15";
	imgsGallery[4].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "images/od_010413_13A.jpg";
	imgsGallery[5].title = "01.04.13 #13A";
	imgsGallery[5].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "images/od_990818_7.jpg";
	imgsGallery[6].title = "99.08.18 #7";
	imgsGallery[6].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/od_991015_7.jpg";
	imgsGallery[7].title = "99.10.15 #7";
	imgsGallery[7].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/od_2K0211_6.jpg";
	imgsGallery[8].title = "00.02.11 #6";
	imgsGallery[8].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/od_990918_12.jpg";
	imgsGallery[9].title = "99.09.18 #12";
	imgsGallery[9].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/od_991015_11.jpg";
	imgsGallery[10].title = "99.10.15 #11";
	imgsGallery[10].caption = "5\" x 7\" Platinum/Palladium Print";
	
    imgsGallery[11] = new Object();
	imgsGallery[11].image = "images/od_2k1124_14.jpg";
	imgsGallery[11].title = "00.11.24 #14";
	imgsGallery[11].caption = "5\" x 7\" Platinum/Palladium Print";

	imgsGallery[12] = new Object();
	imgsGallery[12].image = "images/od_010114_13A.jpg";
	imgsGallery[12].title = "01.01.14 #13A";
	imgsGallery[12].caption = "5\" x 7\" Platinum/Palladium Print";
	
	imgsGallery[13] = new Object();
	imgsGallery[13].image = "images/od_990130_polaneg.jpg";
	imgsGallery[13].title = "99.01.30 #Pola Neg";
	imgsGallery[13].caption = "4\" x 5\" Platinum/Palladium Print";

    imgsGallery[14] = new Object();
	imgsGallery[14].image = "images/od_990130_19.jpg";
	imgsGallery[14].title = "99.01.30 #4";
	imgsGallery[14].caption = "4\" x 5\" Platinum/Palladium Print";
	
    imgsGallery[15] = new Object();
	imgsGallery[15].image = "images/od_050600_40.jpg";
	imgsGallery[15].title = "05.06.00 #40";
	imgsGallery[15].caption = "8\" x 10\" Gum over Platinum/Palladium Print";
	
	imgsGallery[16] = new Object();
	imgsGallery[16].image = "images/od_020709_25rev.jpg";
	imgsGallery[16].title = "02.07.09 #25";
	imgsGallery[16].caption = "8\" x 10\" Platinum/Palladium Print and 40\" x 50&#8221 Gelatin Silver Print";
	
	var start = 0;
	var page = document.location.toString().split("?")[1];
	if (page != null) {
		start = page;
}
	imgs = new MudFadeGallery('imgs', 'imgDisplay', imgsGallery, {startNum: start, preload: true, autoplay: 0});
	
	// set the initial captions
	var title = (imgs.imgsArray[imgs.imgCurrent].title) ? imgs.imgsArray[imgs.imgCurrent].title : "No Title";
	var caption = (imgs.imgsArray[imgs.imgCurrent].caption) ? imgs.imgsArray[imgs.imgCurrent].caption : "No caption";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_caption").innerHTML = caption;
	$(imgs.id+"_number").innerHTML = (parseInt(imgs.imgCurrent)+1) + " of " + imgs.imgTotal;
	$("imgDisplay").src = imgsGallery[start].image;
}

////////////////////////////////////////////////////////////////////////////////
// EVENTS

Event.observe(window, 'load', init, false);