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

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;
			case "s4":
				elements[i].onclick = function() {
					 imgs.showImg(4);
					 return false;
				}
				break;
			case "s5":
				elements[i].onclick = function() {
					 imgs.showImg(5);
					 return false;
				}
				break;
			case "s6":
				elements[i].onclick = function() {
					 imgs.showImg(6);
					 return false;
				}
				break;
			case "s7":
				elements[i].onclick = function() {
					 imgs.showImg(7);
					 return false;
				}
				break;
			case "s8":
				elements[i].onclick = function() {
					 imgs.showImg(8);
					 return false;
				}
				break;
			case "s9":
				elements[i].onclick = function() {
					 imgs.showImg(9);
					 return false;
				}
				break;
			case "s10":
				elements[i].onclick = function() {
					 imgs.showImg(10);
					 return false;
				}
				break;				
			case "s11":
				elements[i].onclick = function() {
					 imgs.showImg(11);
					 return false;
				}
				break;
			case "s12":
				elements[i].onclick = function() {
					 imgs.showImg(12);
					 return false;
				}
				break;
			case "s13":
				elements[i].onclick = function() {
					 imgs.showImg(13);
					 return false;
				}
				break;
			case "s14":
				elements[i].onclick = function() {
					 imgs.showImg(14);
					 return false;
				}
				break;
			case "s15":
				elements[i].onclick = function() {
					 imgs.showImg(15);
					 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/ryo/ryo_8.jpg";
	imgsGallery[0].title = "Ryoan-Ji 8";
	imgsGallery[0].caption = "Pen on Paper";
	imgsGallery[0].caption2 = "approx. 24 x 36 in.";

	imgsGallery[1] = new Object();
	imgsGallery[1].image = "../images/ryo/ryo_8_det.jpg";
	imgsGallery[1].title = "Ryoan-Ji 8, detail";
	imgsGallery[1].caption = "Pen on Paper";
	imgsGallery[1].caption2 = "approx. 24 x 36 in.";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "../images/ryo/ryo_18.jpg";
	imgsGallery[2].title = "Ryoan-Ji 18";
	imgsGallery[2].caption = "Pen on Paper";
	imgsGallery[2].caption2 = "approx. 24 x 36 in.";

	imgsGallery[3] = new Object();
	imgsGallery[3].image = "../images/ryo/ryo_18_det.jpg";
	imgsGallery[3].title = "Ryoan-Ji 18, detail";
	imgsGallery[3].caption = "Pen on Paper";
	imgsGallery[3].caption2 = "approx. 24 x 36 in.";

	imgsGallery[4] = new Object();
	imgsGallery[4].image = "../images/ryo/ryo_17.jpg";
	imgsGallery[4].title = "Ryoan-Ji 17";
	imgsGallery[4].caption = "Pen on Paper";
	imgsGallery[4].caption2 = "approx. 24 x 36 in.";

	imgsGallery[5] = new Object();
	imgsGallery[5].image = "../images/ryo/ryo_17_det.jpg";
	imgsGallery[5].title = "Ryoan-Ji 17, detail";
	imgsGallery[5].caption = "Pen on Paper";
	imgsGallery[5].caption2 = "approx. 24 x 36 in.";

	imgsGallery[6] = new Object();
	imgsGallery[6].image = "../images/ryo/ryo_10.jpg";
	imgsGallery[6].title = "Ryoan-Ji 10";
	imgsGallery[6].caption = "Pen on Paper";
	imgsGallery[6].caption2 = "approx. 24 x 36 in.";

	imgsGallery[7] = new Object();
	imgsGallery[7].image = "../images/ryo/ryo_10_det.jpg";
	imgsGallery[7].title = "Ryoan-Ji 10, detail";
	imgsGallery[7].caption = "Pen on Paper";
	imgsGallery[7].caption2 = "approx. 24 x 36 in.";

	imgsGallery[8] = new Object();
	imgsGallery[8].image = "../images/ryo/ryo_44.jpg";
	imgsGallery[8].title = "Ryoan-Ji 44";
	imgsGallery[8].caption = "Pen on Paper";
	imgsGallery[8].caption2 = "approx. 24 x 30 in.";

	imgsGallery[9] = new Object();
	imgsGallery[9].image = "../images/ryo/ryo_44_det.jpg";
	imgsGallery[9].title = "Ryoan-Ji 44, detail";
	imgsGallery[9].caption = "Pen on Paper";
	imgsGallery[9].caption2 = "approx. 24 x 30 in.";

	imgsGallery[10] = new Object();
	imgsGallery[10].image = "../images/ryo/ryo_21.jpg";
	imgsGallery[10].title = "Ryoan-Ji 21";
	imgsGallery[10].caption = "Pen on Paper";
	imgsGallery[10].caption2 = "approx. 24 x 36 in.";

	imgsGallery[11] = new Object();
	imgsGallery[11].image = "../images/ryo/ryo_21_det.jpg";
	imgsGallery[11].title = "Ryoan-Ji 21, detail";
	imgsGallery[11].caption = "Pen on Paper";
	imgsGallery[11].caption2 = "approx. 24 x 36 in.";

	imgsGallery[12] = new Object();
	imgsGallery[12].image = "../images/ryo/ryo_15.jpg";
	imgsGallery[12].title = "Ryoan-Ji 15";
	imgsGallery[12].caption = "Pen on Paper";
	imgsGallery[12].caption2 = "approx. 22 x 30 in.";

	imgsGallery[13] = new Object();
	imgsGallery[13].image = "../images/ryo/ryo_15_det.jpg";
	imgsGallery[13].title = "Ryoan-Ji 15, detail";
	imgsGallery[13].caption = "Pen on Paper";
	imgsGallery[13].caption2 = "approx. 22 x 30 in.";	

	imgsGallery[14] = new Object();
	imgsGallery[14].image = "../images/ryo/ryo_winter1.jpg";
	imgsGallery[14].title = "Ryoan-Ji in Winter 1";
	imgsGallery[14].caption = "Pen on Paper";
	imgsGallery[14].caption2 = "approx. 18 x 24 in.";

	imgsGallery[15] = new Object();
	imgsGallery[15].image = "../images/ryo/ryo_winter1_det.jpg";
	imgsGallery[15].title = "Ryoan-Ji in Winter 1, detail";
	imgsGallery[15].caption = "Pen on Paper";
	imgsGallery[15].caption2 = "approx. 18 x 24 in.";

	var start = 0;
	imgs = new MudFadeGallery('imgs', 'imgDisplay', imgsGallery, {startNum: start, preload: true, autoplay: 6});
	
	// set the initial captions
	var title = (imgsGallery[0].title) ? imgsGallery[0].title : "Untitled";
	var caption = (imgsGallery[0].caption) ? imgsGallery[0].caption : "|";
	var caption2 = (imgsGallery[0].caption2) ? imgsGallery[0].caption2 : "|";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_caption").innerHTML = caption;
	$("imgDisplay_caption2").innerHTML = caption2;
	$("imgDisplay_number").innerHTML = "1 of " + imgsGallery.length + " images";
	$("imgDisplay").src = imgsGallery[start].image;
}

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

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