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

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/photography/image_0.png";
imgsGallery[0].title = "image 1";
	
imgsGallery[0].caption = "";

imgsGallery[1] = new Object();
imgsGallery[1].image = "images/photography/image_1.jpg";
	
imgsGallery[1].title = "image 2";
imgsGallery[1].caption = "";

imgsGallery[2] = new Object();
	
imgsGallery[2].image = "images/photography/image_2.jpg";
imgsGallery[2].title = "image 3";
imgsGallery[2].caption = ""; 

imgsGallery[3] = new Object();
imgsGallery[3].image = "images/photography/image_3.jpg";
imgsGallery[3].title = "image 4";
imgsGallery[3].caption = "";

imgsGallery[4] = new Object();
imgsGallery[4].image = "images/photography/image_4.jpg";
imgsGallery[4].title = "image 5";
imgsGallery[4].caption = "";

imgsGallery[5] = new Object();
imgsGallery[5].image = "images/photography/image_5.jpg";
imgsGallery[5].title = "image 6";
imgsGallery[5].caption = "";

imgsGallery[6] = new Object();
imgsGallery[6].image = "images/photography/image_6.jpg";
imgsGallery[6].title = "image 7";
imgsGallery[6].caption = "";

imgsGallery[7] = new Object();
imgsGallery[7].image = "images/photography/image_7.jpg";
imgsGallery[7].title = "image 8";
imgsGallery[7].caption = "";

imgsGallery[8] = new Object();
imgsGallery[8].image = "images/photography/image_8.jpg";
imgsGallery[8].title = "image 9";
imgsGallery[8].caption = "";

imgsGallery[9] = new Object();
imgsGallery[9].image = "images/photography/image_9.jpg";
imgsGallery[9].title = "image 10";
imgsGallery[9].caption = "";

imgsGallery[10] = new Object();
imgsGallery[10].image = "images/photography//image_10.jpg";
imgsGallery[10].title = "image 11";
imgsGallery[10].caption = "";

imgsGallery[11] = new Object();
imgsGallery[11].image = "images/photography/image_11.jpg";
imgsGallery[11].title = "image 12";
imgsGallery[11].caption = "";

imgsGallery[12] = new Object();
imgsGallery[12].image = "images/photography/image_12.jpg";
imgsGallery[12].title = "image 13";
imgsGallery[12].caption = "";

imgsGallery[13] = new Object();
imgsGallery[13].image = "images/photography/image_13.jpg";
imgsGallery[13].title = "image 14";
imgsGallery[13].caption = "";

imgsGallery[14] = new Object();
imgsGallery[14].image = "images/photography/image_14.jpg";
imgsGallery[14].title = "image 15";
imgsGallery[14].caption = "";

imgsGallery[15] = new Object();
imgsGallery[15].image = "images/photography/image_15.jpg";
imgsGallery[15].title = "image 16";
imgsGallery[15].caption = "";

imgsGallery[16] = new Object();
imgsGallery[16].image = "images/photography/image_16.jpg";
imgsGallery[16].title = "image 17";
imgsGallery[16].caption = "";

imgsGallery[17] = new Object();
imgsGallery[17].image = "images/photography/image_17.jpg";
imgsGallery[17].title = "image 18";
imgsGallery[17].caption = "";

imgsGallery[18] = new Object();
imgsGallery[18].image = "images/photography/image_18.jpg";
imgsGallery[18].title = "image 19";
imgsGallery[18].caption = "";



	
	var start = 0;
	imgs = new MudFadeGallery('imgs', 'imgDisplay', imgsGallery, {startNum: start, preload: true, autoplay: 4});
	
	// set the initial captions
	var title = (imgsGallery[0].title) ? imgsGallery[0].title : "No Title";
	var caption = (imgsGallery[0].caption) ? imgsGallery[0].caption : "No caption";
	$("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);