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

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;
			case "s16":
				elements[i].onclick = function() {
					 imgs.showImg(16);
					 return false;
				}
				break;
			case "s17":
				elements[i].onclick = function() {
					 imgs.showImg(17);
					 return false;
				}
				break;
			case "s18":
				elements[i].onclick = function() {
					 imgs.showImg(18);
					 return false;
				}
				break;
			case "s19":
				elements[i].onclick = function() {
					 imgs.showImg(19);
					 return false;
				}
				break;
			case "s20":
				elements[i].onclick = function() {
					 imgs.showImg(20);
					 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/explorations/explorations13.jpg";
	imgsGallery[0].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/explorations/explorations14.jpg";
	imgsGallery[1].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	imgsGallery[1].caption = "";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/explorations/explorations15.jpg";
	imgsGallery[2].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	imgsGallery[2].caption = "";
	
	imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/explorations/explorations16.jpg";
	imgsGallery[3].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	imgsGallery[3].caption = "";
	
	imgsGallery[4] = new Object();
	imgsGallery[4].image = "images/explorations/explorations17.jpg";
	imgsGallery[4].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	imgsGallery[4].caption = "";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "images/explorations/explorations18.jpg";
	imgsGallery[5].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	imgsGallery[5].caption = "";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "images/explorations/explorations19.jpg";
	imgsGallery[6].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	imgsGallery[6].caption = "";
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/explorations/explorations20.jpg";
	imgsGallery[7].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	imgsGallery[7].caption = "";
	
	imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/explorations/explorations21.jpg";
	imgsGallery[8].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2010";
	imgsGallery[8].caption = "";

	
	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/explorations/explorations1.jpg";
	imgsGallery[9].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[9].caption = "";
	
	imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/explorations/explorations2.jpg";
	imgsGallery[10].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[10].caption = "";
	
	imgsGallery[11] = new Object();
	imgsGallery[11].image = "images/explorations/explorations3.jpg";
	imgsGallery[11].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[11].caption = "";
	
	imgsGallery[12] = new Object();
	imgsGallery[12].image = "images/explorations/explorations4.jpg";
	imgsGallery[12].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[12].caption = "";
	
	imgsGallery[13] = new Object();
	imgsGallery[13].image = "images/explorations/explorations5.jpg";
	imgsGallery[13].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[13].caption = "";
	
	imgsGallery[14] = new Object();
	imgsGallery[14].image = "images/explorations/explorations6.jpg";
	imgsGallery[14].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[14].caption = "";
	
	imgsGallery[15] = new Object();
	imgsGallery[15].image = "images/explorations/explorations7.jpg";
	imgsGallery[15].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[15].caption = "";
	
	imgsGallery[16] = new Object();
	imgsGallery[16].image = "images/explorations/explorations8.jpg";
	imgsGallery[16].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[16].caption = "";
	
	imgsGallery[17] = new Object();
	imgsGallery[17].image = "images/explorations/explorations9.jpg";
	imgsGallery[17].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[17].caption = "";
	
	imgsGallery[18] = new Object();
	imgsGallery[18].image = "images/explorations/explorations10.jpg";
	imgsGallery[18].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[18].caption = "";
	
	imgsGallery[19] = new Object();
	imgsGallery[19].image = "images/explorations/explorations11.jpg";
	imgsGallery[19].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[19].caption = "";
	
	imgsGallery[20] = new Object();
	imgsGallery[20].image = "images/explorations/explorations12.jpg";
	imgsGallery[20].title = "<span class='red'>|</span> media: pen and ink on vellum<br><span class='red'>|</span> original size: 9 x 12 inches<br><span class='red'>|</span> year: 2009";
	imgsGallery[20].caption = "";


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

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

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