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

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/salt_080413_7.jpg";
	imgsGallery[0].title = "08.04.13 #7 Pilot Peak";
	imgsGallery[0].caption = "8\" x 10\" unique tintype.";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/salt_080410_2.jpg";
	imgsGallery[1].title = "08.04.10 #2 The Great Salt Lake";
	imgsGallery[1].caption = "8\" x 10\" unique tintype.";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/salt_080418_4.jpg";
	imgsGallery[2].title = "08.04.18 #4 Cave";
	imgsGallery[2].caption = "8\" x 10\" unique tintype.";
	
	imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/salt_080417_6.jpg";
	imgsGallery[3].title = "08.04.17 #6 Observation Rock";
	imgsGallery[3].caption = "8\" x 10\" unique tintype.";
			
	imgsGallery[4] = new Object();
	imgsGallery[4].image = "images/salt_080410_29.jpg";
	imgsGallery[4].title = "08.04.10 #29 Road to Lucin";
	imgsGallery[4].caption = "30\" x 40\" Archival Pigment Print.";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "images/salt_080408_27.jpg";
	imgsGallery[5].title = "08.04.08 #27 Military Fence";
	imgsGallery[5].caption = "40\" x 50\" Type C photograph.";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "images/salt_080408_17.jpg";
	imgsGallery[6].title = "08.04.08 #17 Mud";
	imgsGallery[6].caption = "40\" x 50\" Type C photograph.";
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/salt_080410_20.jpg";
	imgsGallery[7].title = "08.04.10 #20  Breakers";
	imgsGallery[7].caption = "40\" x 50\" Type C photograph.";

	imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/salt_080418_17.jpg";
	imgsGallery[8].title = "08.04.18 #17 Salt and Sky";
	imgsGallery[8].caption = "40\" x 50\" Type C photograph.";
	
	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/salt_080416_23.jpg";
	imgsGallery[9].title = "08.04.16 #23 Open Range";
	imgsGallery[9].caption = "30\" x 40\" Archival Pigment Print.";

	imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/salt_080415_24.jpg";
	imgsGallery[10].title = "08.04.10 #24 Knolls ATV Trails";
	imgsGallery[10].caption = "30\" x 40\" Archival Pigment Print.";
	
    imgsGallery[11] = new Object();
	imgsGallery[11].image = "images/salt_080416_22.jpg";
	imgsGallery[11].title = "08.04.16 #22 Military/Civilian Roads";
	imgsGallery[11].caption = "30\" x 40\" Archival Pigment Print.";
	    
	imgsGallery[12] = new Object();
	imgsGallery[12].image = "images/salt_080407_15.jpg";
	imgsGallery[12].title = "08.04.07 #15 Salt Storm";
	imgsGallery[12].caption = "30\" x 40\" Archival Pigment Print.";
	
	imgsGallery[13] = new Object();
	imgsGallery[13].image = "images/salt_080414_2.jpg";
	imgsGallery[13].title = "08.04.14 #4 Chimney";
	imgsGallery[13].caption = "8\" x 10\" unique tintype.";
	
    imgsGallery[14] = new Object();
	imgsGallery[14].image = "images/salt_080417_3.jpg";
	imgsGallery[14].title = "08.04.17 #3 Sandstone";
	imgsGallery[14].caption = "8\" x 10\" unique tintype.";

    imgsGallery[15] = new Object();
	imgsGallery[15].image = "images/salt_080406_5..jpg";
	imgsGallery[15].title = "08.04.06 #5 Our Backyard";
	imgsGallery[15].caption = "8\" x 10\" unique tintype.";

    imgsGallery[16] = new Object();
	imgsGallery[16].image = "images/salt_080412_5.jpg";
	imgsGallery[16].title = "08.04.12 #5 Sun Tunnels";
	imgsGallery[16].caption = "8\" x 10\" unique tintype.";
	
    imgsGallery[17] = new Object();
	imgsGallery[17].image = "images/salt_080413_3.jpg";
	imgsGallery[17].title = "08.04.13 #3  In the Field";
	imgsGallery[17].caption = "8\" x 10\" unique tintype.";
	
	imgsGallery[18] = new Object();
	imgsGallery[18].image = "images/salt_080418_9.jpg";
	imgsGallery[18].title = "08.04.18 #9 Desert Walkers";
	imgsGallery[18].caption = "8\" x 10\" unique tintype.";

   

	
	

    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);