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

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;
			case "s8":
				elements[i].onclick = function() {
					 imgs.showImg(8);
					 return false;
				}
				break;
			case "s9":
				elements[i].onclick = function() {
					 imgs.showImg(9);
					 return false;
				}
				break;
			case "s10":
				elements[i].onclick = function() {
					 imgs.showImg(10);
					 return false;
				}
				break;
			case "s11":
				elements[i].onclick = function() {
					 imgs.showImg(11);
					 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/cholla/cholla-worldchanging.png";
	imgsGallery[0].title = "<span class='red'>|</span> title: Worldchanging: A User's Guide for<br /><span class='indented'>the 21st Century</span><br /><span class='red'>|</span> project: Book<br /><span class='red'>|</span> art direction: Stefan Sagmeister<br /><span class='red'>|</span> design: Matthias Ernstberger, Roy Rub<br /><span class='red'>|</span> photography: various<br /><span class='red'>|</span> editor: Alex Steffen<br /><span class='red'>|</span> editor at publisher: Deborah Aaronson<br /><span class='red'>|</span> client: Harry N Abrams Inc., Publishers<br /><span class='red'>|</span> size: 6 5/8 x 9 1/2in, 178mm x 250mm<br><span class='indented'>x 58mm<br /><span class='red'>|</span> first print run: 200,000 copies<br /><span class='red'>|</span> year: 2006";
	imgsGallery[0].caption = "<em>Worldchanging</em> reports about new, positive developments in science, engineering, architecture, business and politics that will change this world. Through the die-cut holes of the slipcase the (of course recycled) paper on the book cover yellows significantly over time, allowing the sun to imprint (and change) the book cover itself. Sagmeister Inc. designed this book to appeal to a core green audience and a wide spectrum of the general public.";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/cholla/cholla-benzin.png";
	imgsGallery[1].title = "<span class='red'>|</span> title: Benzin<br /><span class='red'>|</span> project: Book<br /><span class='red'>|</span> design: Thomas Bruggisser, Michel Fries<br /><span class='red'>|</span> year: 2000";
	imgsGallery[1].caption = "";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/cholla/cholla-mattmo.png";
	imgsGallery[2].title = "<span class='red'>|</span> title: Mattmo<br /><span class='red'>|</span> project: Book<br /><span class='red'>|</span> design: Mattmo Studio<br /><span class='red'>|</span> year: 2002";
	imgsGallery[2].caption = "";
		
	imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/cholla/cholla-nytleisure.png";
	imgsGallery[3].title = "<span class='red'>|</span> title: The New York Times, Arts &amp; Leisure<br /><span class='indented'>Week<br /><span class='red'>|</span> project: Promotional ad and web site<br /><span class='red'>|</span> design: The New York Times<br /><span class='red'>|</span> year: 2008";
	imgsGallery[3].caption = "";
	
	imgsGallery[4] = new Object();
	imgsGallery[4].image = "images/cholla/cholla-newtime.png";
	imgsGallery[4].title = "<span class='red'>|</span> title: A new time, SNP The Scottish<br /><span class='indented'>National Party<br /><span class='red'>|</span> project: Branding<br /><span class='red'>|</span> design: unknown<br /><span class='red'>|</span> year: 2007";
	imgsGallery[4].caption = "";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "images/cholla/cholla-vilcek.png";
	imgsGallery[5].title = "<span class='red'>|</span> title: The Vilcek Foundation<br /><span class='red'>|</span> project: Award trophy<br /><span class='red'>|</span> art direction: Stefan Sagmeister<br /><span class='red'>|</span> design: Stefan Sagmeister, Matthias<br /><span class='indented'>Ernstberger<br /><span class='red'>|</span> 3-D consulting: Nick Herman<br /><span class='red'>|</span> 3-D design: Aly Khalifa<br /><span class='red'>|</span> photos: –––<br /><span class='red'>|</span> year: 2005, 2009";
	imgsGallery[5].caption = "This Vilcek Prize award trophy was created for a major new award program honoring outstanding achievements of foreign-born Americans within the fields of the visual arts and biomedical research. The first winners are artists Christo and Jeanne-Claude as well as cancer researcher Joan Massague. The trophy represents a visualization of the pinnacle an individual or group can reach, each trophy is individually designed and cast for the winner.";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "images/cholla/cholla-kids-museum.png";
	imgsGallery[6].title = "<span class='red'>|</span> title: Power-Play<br /><span class='red'>|</span> project: Signage, Children's Museum Houston<br /><span class='red'>|</span> design: unknown<br /><span class='red'>|</span> year: 2009";
	imgsGallery[6].caption = "";
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/cholla/cholla-coke.png";
	imgsGallery[7].title = "<span class='red'>|</span> title: Coca Cola, Paris, France<br /><span class='red'>|</span> project: ad campaign; wending machine keys<br /><span class='red'>|</span> design: unknown<br /><span class='red'>|</span> year: 2008";
	imgsGallery[7].caption = "";
	
	imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/cholla/cholla-fishing.png";
	imgsGallery[8].title = "<span class='red'>|</span> title: Take Me Fishing<br /><span class='red'>|</span> project: Promotional campaing, ad and<br /><span class='indented'>web site<br /><span class='red'>|</span> design: unknown<br /><span class='red'>|</span> year: 2008";
	imgsGallery[8].caption = "";
	
	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/cholla/cholla-philharm.png";
	imgsGallery[9].title = "<span class='red'>|</span> title: Philharmonische Gesellschaft Bremen<br /><span class='red'>|</span> project: Identity<br /><span class='red'>|</span> design: Jung und Pfeffer, Visuelle<br /><span class='indented'>Kommunikation, Bremen, Germany;<br /><span class='indented'>Petra Michel<br /><span class='red'>|</span> year: 2003";
	imgsGallery[9].caption = "";
	
	imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/cholla/cholla-calida.png";
	imgsGallery[10].title = "<span class='red'>|</span> title: Just Be. Calida<br /><span class='red'>|</span> project: Packaging<br /><span class='red'>|</span> design: unknown<br /><span class='red'>|</span> year: 2000";
	imgsGallery[10].caption = "";
	
	imgsGallery[11] = new Object();
	imgsGallery[11].image = "images/cholla/cholla-livraison.png";
	imgsGallery[11].title = "<span class='red'>|</span> title: Livraison<br /><span class='red'>|</span> project: Multipurpose<br /><span class='red'>|</span> design: Students of Ècole des beaux-arts<br /><span class='indented'>de Rennes, France<br /><span class='red'>|</span> Instructor: Jérôme Saint-Loubert Bié<br /><span class='red'>|</span> year: 2005";
	imgsGallery[11].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 : "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);