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

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/test/_MG_1540.jpg";
	imgsGallery[0].title = "Title for first Image";
	imgsGallery[0].caption = "This is the first image...";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/test/_MG_1541.jpg";
	imgsGallery[1].title = "Title for second Image";
	imgsGallery[1].caption = "This is the second image...";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/test/_MG_1542.jpg";
	imgsGallery[2].title = "Title for third Image";
	imgsGallery[2].caption = "This is the third image...";
	
	imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/test/_MG_1543.jpg";
	imgsGallery[3].title = "Title for fourth image";
	imgsGallery[3].caption = "This is the fourth image...";
	
	imgsGallery[4] = new Object();
	imgsGallery[4].image = "images/test/_MG_1544.jpg";
	imgsGallery[4].title = "Title for fourth image";
	imgsGallery[4].caption = "This is the fourth image...";

	imgsGallery[5] = new Object();
	imgsGallery[5].image = "images/test/_MG_1547.jpg";
	imgsGallery[5].title = "Title for first Image";
	imgsGallery[5].caption = "This is the first image...";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "images/test/_MG_1548.jpg";
	imgsGallery[6].title = "Title for first Image";
	imgsGallery[6].caption = "This is the first image...";	
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/test/_MG_1549.jpg";
	imgsGallery[7].title = "Title for first Image";
	imgsGallery[7].caption = "This is the first image...";		
	
	imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/test/_MG_1550.jpg";
	imgsGallery[8].title = "Title for first Image";
	imgsGallery[8].caption = "This is the first image...";	
	
	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/test/_MG_1551.jpg";
	imgsGallery[9].title = "Title for first Image";
	imgsGallery[9].caption = "This is the first image...";	
	
	imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/test/_MG_1554.jpg";
	imgsGallery[10].title = "Title for first Image";
	imgsGallery[10].caption = "This is the first image...";
	
	imgsGallery[11] = new Object();
	imgsGallery[11].image = "images/test/_MG_1555.jpg";
	imgsGallery[11].title = "Title for first Image";
	imgsGallery[11].caption = "This is the first image...";	
	
	imgsGallery[12] = new Object();
	imgsGallery[12].image = "images/test/_MG_1556.jpg";
	imgsGallery[12].title = "Title for first Image";
	imgsGallery[12].caption = "This is the first image...";	
	
	imgsGallery[13] = new Object();
	imgsGallery[13].image = "images/test/_MG_1571.jpg";
	imgsGallery[13].title = "Title for first Image";
	imgsGallery[13].caption = "This is the first image...";	
	
	imgsGallery[14] = new Object();
	imgsGallery[14].image = "images/test/_MG_1572.jpg";
	imgsGallery[14].title = "Title for first Image";
	imgsGallery[14].caption = "This is the first image...";	
	
	imgsGallery[15] = new Object();
	imgsGallery[15].image = "images/test/_MG_1576.jpg";
	imgsGallery[15].title = "Title for first Image";
	imgsGallery[15].caption = "This is the first image...";		
	
	imgsGallery[16] = new Object();
	imgsGallery[16].image = "images/test/_MG_1580.jpg";
	imgsGallery[16].title = "Title for first Image";
	imgsGallery[16].caption = "This is the first image...";		
	
	imgsGallery[17] = new Object();
	imgsGallery[17].image = "images/test/_MG_1581.jpg";
	imgsGallery[17].title = "Title for first Image";
	imgsGallery[17].caption = "This is the first image...";		
	
	imgsGallery[18] = new Object();
	imgsGallery[18].image = "images/test/_MG_1582.jpg";
	imgsGallery[18].title = "Title for first Image";
	imgsGallery[18].caption = "This is the first image...";		
	
	imgsGallery[19] = new Object();
	imgsGallery[19].image = "images/test/_MG_1584.jpg";
	imgsGallery[19].title = "Title for first Image";
	imgsGallery[19].caption = "This is the first image...";		
	
	imgsGallery[20] = new Object();
	imgsGallery[20].image = "images/test/_MG_1589.jpg";
	imgsGallery[20].title = "Title for first Image";
	imgsGallery[20].caption = "This is the first image...";		
	
	imgsGallery[21] = new Object();
	imgsGallery[21].image = "images/test/_MG_1557.jpg";
	imgsGallery[21].title = "Title for first Image";
	imgsGallery[21].caption = "This is the first image...";		
	
	imgsGallery[22] = new Object();
	imgsGallery[22].image = "images/test/_MG_1559.jpg";
	imgsGallery[22].title = "Title for first Image";
	imgsGallery[22].caption = "This is the first image...";	
	
	imgsGallery[23] = new Object();
	imgsGallery[23].image = "images/test/_MG_1562.jpg";
	imgsGallery[23].title = "Title for first Image";
	imgsGallery[23].caption = "This is the first image...";	
	
	imgsGallery[24] = new Object();
	imgsGallery[24].image = "images/test/_MG_1564.jpg";
	imgsGallery[24].title = "Title for first Image";
	imgsGallery[24].caption = "This is the first image...";	
	
	imgsGallery[25] = new Object();
	imgsGallery[25].image = "images/test/_MG_1568.jpg";
	imgsGallery[25].title = "Title for first Image";
	imgsGallery[25].caption = "This is the first image...";	
	
	imgsGallery[26] = new Object();
	imgsGallery[26].image = "images/test/_MG_1569.jpg";
	imgsGallery[26].title = "Title for first Image";
	imgsGallery[26].caption = "This is the first image...";		
	
	imgsGallery[27] = new Object();
	imgsGallery[27].image = "images/test/_MG_1573.jpg";
	imgsGallery[27].title = "Title for first Image";
	imgsGallery[27].caption = "This is the first image...";		
		
	imgsGallery[28] = new Object();
	imgsGallery[28].image = "images/test/_MG_1574.jpg";
	imgsGallery[28].title = "Title for first Image";
	imgsGallery[28].caption = "This is the first image...";		
		
	imgsGallery[29] = new Object();
	imgsGallery[29].image = "images/test/_MG_1529.jpg";
	imgsGallery[29].title = "Title for first Image";
	imgsGallery[29].caption = "This is the first image...";			
	
	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 caption";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_caption").innerHTML = caption;
	$("imgDisplay_number").innerHTML = "1 of " + imgsGallery.length + " projects";
	$("imgDisplay").src = imgsGallery[start].image;
}

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

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