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

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;
		}
	}
}

////////////////////////////////////////////////////////////////////////////////
// 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/metropolis/metropolis3.png";
	imgsGallery[0].title = "<span class='red'>|</span> title: Metropolis Magazine<br /><span class='red'>|</span> project: Typographic design<br /><span class='red'>|</span> design: Kontour<br /><span class='red'>|</span> client: Metropolis Magazine, New York<br /><span class='red'>|</span> year: 2008, March issue";
	imgsGallery[0].caption = "Metropolis&rsquo; March issue focused on on what was termed local flavor-design work and initiatives that are inspired by their specific environments. Writers like Bruce Sterling, John Hockenberry, and Roberta Brandes Gratz, among others, weighed in on the subject of localism. For visual pacing five explorations in &ldquo;local type&rdquo; were interspersed between these essays. Typographers were invited to represent their hometown or current city of residence by using a typeface of their own design in a way that expresses its local flavor. This project uses the Kontour typefaces Elido and TripleStrip";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/metropolis/metropolis1.png";
	imgsGallery[1].title = "<span class='red'>|</span> title: Metropolis Magazine<br /><span class='red'>|</span> project: Typographic design<br /><span class='red'>|</span> design: Kontour<br /><span class='red'>|</span> client: Metropolis Magazine, New York<br /><span class='red'>|</span> year: 2008, March issue";
	imgsGallery[1].caption = "Metropolis&rsquo; March issue focused on on what was termed local flavor-design work and initiatives that are inspired by their specific environments. Writers like Bruce Sterling, John Hockenberry, and Roberta Brandes Gratz, among others, weighed in on the subject of localism. For visual pacing five explorations in &ldquo;local type&rdquo; were interspersed between these essays. Typographers were invited to represent their hometown or current city of residence by using a typeface of their own design in a way that expresses its local flavor. This project uses the Kontour typefaces Elido and TripleStrip";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/metropolis/metropolis2.png";
	imgsGallery[2].title = "<span class='red'>|</span> title: Metropolis Magazine<br /><span class='red'>|</span> project: Typographic design, detail<br /><span class='red'>|</span> design: Kontour<br /><span class='red'>|</span> client: Metropolis Magazine, New York<br /><span class='red'>|</span> year: 2008, March issue";
	imgsGallery[2].caption = "Metropolis&rsquo; March issue focused on on what was termed local flavor-design work and initiatives that are inspired by their specific environments. Writers like Bruce Sterling, John Hockenberry, and Roberta Brandes Gratz, among others, weighed in on the subject of localism. For visual pacing five explorations in &ldquo;local type&rdquo; were interspersed between these essays. Typographers were invited to represent their hometown or current city of residence by using a typeface of their own design in a way that expresses its local flavor. This project uses the Kontour typefaces Elido and TripleStrip";

	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);
