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

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/articles/76/76vazan-1.jpg";
	imgsGallery[0].title = "<strong>Bill Vazan</strong> <em>Bus Ride #139 (Boulevard Pie IX, Montréal)</em>, April 22 1970 (detail) Contact sheets 51 x 61 cm courtesy of centre VOX, Montreal";
	imgsGallery[0].caption = "";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "../../images/articles/76/76vazan-2.jpg";
	imgsGallery[1].title = "<strong>Bill Vazan</strong> <em>Intercommunication Line</em>, 1968 / 2002 Ink and geographical map 82 x 113 cm courtesy of centre VOX, Montreal";
	imgsGallery[1].caption = "";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "../../images/articles/76/76vazan-3.jpg";
	imgsGallery[2].title = "<strong>Bill Vazan</strong> <em>401 Coming and Going</em>, 2006 – 2007 (details) digital images courtesy of centre VOX, Montreal";
	imgsGallery[2].caption = "";
	
	imgsGallery[3] = new Object();
	imgsGallery[3].image = "../../images/articles/76/76vazan-4.jpg";
	imgsGallery[3].title = "<strong>Bill Vazan</strong> <em>Yonge Street Walk, Toronto, 1969</em> 163 ektachromes courtesy of centre VOX";
	imgsGallery[3].caption = "";
	
	imgsGallery[4] = new Object();
	imgsGallery[4].image = "../../images/articles/76/76vazan-5.jpg";
	imgsGallery[4].title = "<strong>Bill Vazan</strong> <em>Worldline, 1971</em> Mixed materials Courtesy of centre VOX, Montreal";
	imgsGallery[4].caption = "";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "../../images/articles/76/76vazan-6.jpg";
	imgsGallery[5].title = "<strong>Bill Vazan</strong> <emYonge Street Walk, Toronto, 1969</em> 163 ektachromes courtesy of centre VOX"
	imgsGallery[5].caption = "";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "../../images/articles/76/76vazan-7.jpg";
	imgsGallery[6].title = "<strong>Bill Vazan</strong> <em>Montreal Walks (artist notes)</em>, n.d. Courtesy of centre VOX, Montreal";
	imgsGallery[6].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 : "";
	var caption = (imgsGallery[0].caption) ? imgsGallery[0].caption : "";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_caption").innerHTML = caption;
	$("imgDisplay_number").innerHTML = "1 of " + imgsGallery.length + " images";
	$("imgDisplay").src = imgsGallery[start].image;
}

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

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