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

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;


		}
	}
}

////////////////////////////////////////////////////////////////////////////////
// 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/whitecolumns/wr_01_lg.jpg";
	imgsGallery[0].title = "White Room";
	imgsGallery[0].caption = "Installation View";
	imgsGallery[0].caption2 = "|";
	imgsGallery[0].titleB = "Room Model, 2002";
	imgsGallery[0].captionB = "latex paint on walls";
	imgsGallery[0].captionB2 = "|";


	imgsGallery[1] = new Object();
	imgsGallery[1].image = "../images/whitecolumns/wr_02_lg.jpg";
	imgsGallery[1].title = "Installation View";
	imgsGallery[1].caption = "|";
	imgsGallery[1].caption2 = "|";
	imgsGallery[1].titleB = "|";
	imgsGallery[1].captionB = "|";
	imgsGallery[1].captionB2 = "|";

	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "../images/whitecolumns/wr_03_lg.jpg";
	imgsGallery[2].title = "Incubator with Lamp (Pink/Blue), 2002";
	imgsGallery[2].caption = "polystyrene, polyurethane, resin and aluminum";
	imgsGallery[2].caption2 = "53 in. x 22 in. x 26 in.";
	imgsGallery[2].titleB = "|";
	imgsGallery[2].captionB = "|";
	imgsGallery[2].captionB2 = "|";

	imgsGallery[3] = new Object();
	imgsGallery[3].image = "../images/whitecolumns/wr_04_lg.jpg";
	imgsGallery[3].title = "Incubator with Lamp (Blue/Pink), 2002";
	imgsGallery[3].caption = "polystyrene, polyurethane, resin and aluminum";
	imgsGallery[3].caption2 = "53 in. x 22 in. x 26 in.";
	imgsGallery[3].titleB = "|";
	imgsGallery[3].captionB = "|";
	imgsGallery[3].captionB2 = "|";

	imgsGallery[4] = new Object();
	imgsGallery[4].image = "../images/whitecolumns/wr_05_lg.jpg";
	imgsGallery[4].title = "Incubator with Lamp (Blue/Pink), 2002";
	imgsGallery[4].caption = "polystyrene, polyurethane, resin and aluminum";
	imgsGallery[4].caption2 = "53 in. x 22 in. x 26 in.";
	imgsGallery[4].titleB = "|";
	imgsGallery[4].captionB = "|";
	imgsGallery[4].captionB2 = "|";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "../images/whitecolumns/wr_06_lg.jpg";
	imgsGallery[5].title = "Tree Model 1";
	imgsGallery[5].caption = "digital C-print on Sintra";
	imgsGallery[5].caption2 = "16 x 14 in.";
	imgsGallery[5].titleB = "|";
	imgsGallery[5].captionB = "|";
	imgsGallery[5].captionB2 = "|";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "../images/whitecolumns/whitecolumns_invite_512.jpg";
	imgsGallery[6].title = "White Columns";
	imgsGallery[6].caption = "Invitation to Exhibit";
	imgsGallery[6].caption2 = "|";
	imgsGallery[6].titleB = "|";
	imgsGallery[6].captionB = "|";
	imgsGallery[6].captionB2 = "|";



	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 : "|";
	var caption = (imgsGallery[0].caption) ? imgsGallery[0].caption : "|";
	var caption2 = (imgsGallery[0].caption2) ? imgsGallery[0].caption2 : "|";
	var titleB = (imgsGallery[0].titleB) ? imgsGallery[0].titleB : "|";
	var captionB = (imgsGallery[0].captionB) ? imgsGallery[0].captionB : "|";
	var captionB2 = (imgsGallery[0].captionB2) ? imgsGallery[0].captionB2 : "|";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_caption").innerHTML = caption;
	$("imgDisplay_caption2").innerHTML = caption2;
	$("imgDisplay_titleB").innerHTML = titleB;
	$("imgDisplay_captionB").innerHTML = captionB;
	$("imgDisplay_captionB2").innerHTML = captionB2;
	$("imgDisplay_number").innerHTML = "1 of " + imgsGallery.length + " images";
	$("imgDisplay").src = imgsGallery[start].image;
}

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

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