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

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;
			case "s12":
				elements[i].onclick = function() {
					 imgs.showImg(12);
					 return false;
				}
				break;
			case "s13":
				elements[i].onclick = function() {
					 imgs.showImg(13);
					 return false;
				}
				break;
			case "s14":
				elements[i].onclick = function() {
					 imgs.showImg(14);
					 return false;
				}
				break;
			case "s15":
				elements[i].onclick = function() {
					 imgs.showImg(15);
					 return false;
				}
				break;
			case "s16":
				elements[i].onclick = function() {
					 imgs.showImg(16);
					 return false;
				}
				break;
			case "s17":
				elements[i].onclick = function() {
					 imgs.showImg(17);
					 return false;
				}
				break;
			case "s18":
				elements[i].onclick = function() {
					 imgs.showImg(18);
					 return false;
				}
				break;
			case "s19":
				elements[i].onclick = function() {
					 imgs.showImg(19);
					 return false;
				}
				break;
			case "s20":
				elements[i].onclick = function() {
					 imgs.showImg(20);
					 return false;
				}
				break;
			case "s21":
				elements[i].onclick = function() {
					 imgs.showImg(21);
					 return false;
				}
				break;
			case "s22":
				elements[i].onclick = function() {
					 imgs.showImg(22);
					 return false;
				}
				break;
			case "s23":
				elements[i].onclick = function() {
					 imgs.showImg(23);
					 return false;
				}
				break;
			case "s24":
				elements[i].onclick = function() {
					 imgs.showImg(24);
					 return false;
				}
				break;
			case "s25":
				elements[i].onclick = function() {
					 imgs.showImg(25);
					 return false;
				}
				break;
			case "s26":
				elements[i].onclick = function() {
					 imgs.showImg(26);
					 return false;
				}
				break;
			case "s27":
				elements[i].onclick = function() {
					 imgs.showImg(27);
					 return false;
				}
				break;
			case "s28":
				elements[i].onclick = function() {
					 imgs.showImg(28);
					 return false;
				}
				break;
			case "s29":
				elements[i].onclick = function() {
					 imgs.showImg(29);
					 return false;
				}
				break;
			case "s30":
				elements[i].onclick = function() {
					 imgs.showImg(30);
					 return false;
				}
				break;
			case "s31":
				elements[i].onclick = function() {
					 imgs.showImg(31);
					 return false;
				}
				break;
			case "s32":
				elements[i].onclick = function() {
					 imgs.showImg(32);
					 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/00.jpg";
	imgsGallery[0].title = "Urban Outfitters";
	imgsGallery[0].subtitle = "Since 2003";
	imgsGallery[0].caption = "When we open a new store, we design a tote bag that reflects that city's unique personality and vibe. We gave away our first in 2003 and it's become kind of a tradition. Unfortunately, the bags are gone, but all 32 from across the map are presented here for your viewing pleasure.";

	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/01.jpg";
	imgsGallery[1].title = "Charleston, SC";
	imgsGallery[1].subtitle = "November 2005";
	imgsGallery[1].caption = "Save the Garden Theatre.";

	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/02.jpg";
	imgsGallery[2].title = "Vancouver, BC";
	imgsGallery[2].subtitle = "March 2007";
	imgsGallery[2].caption = "";

	imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/03.jpg";
	imgsGallery[3].title = "Las Vegas, NV";
	imgsGallery[3].subtitle = "December 2006";
	imgsGallery[3].caption = "";

	imgsGallery[4] = new Object();
	imgsGallery[4].image = "images/04.jpg";
	imgsGallery[4].title = "Boston, MA";
	imgsGallery[4].subtitle = "July 2005";
	imgsGallery[4].caption = "Baked Beans and the T and everything in between. This bag celebrates the One Year Anniversary of our Faneuil Hall store.";

	imgsGallery[5] = new Object();
	imgsGallery[5].image = "images/05.jpg";
	imgsGallery[5].title = "Fresno, CA";
	imgsGallery[5].subtitle = "November 2006";
	imgsGallery[5].caption = "";

	imgsGallery[6] = new Object();
	imgsGallery[6].image = "images/06.jpg";
	imgsGallery[6].title = "Ardmore, PA";
	imgsGallery[6].subtitle = "November 2006";
	imgsGallery[6].caption = "";

	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/07.jpg";
	imgsGallery[7].title = "Birmingham, AL";
	imgsGallery[7].subtitle = "February 2007";
	imgsGallery[7].caption = "";

	imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/08.jpg";
	imgsGallery[8].title = "Pittsburgh, PA";
	imgsGallery[8].subtitle = "November 2004";
	imgsGallery[8].caption = "The Steelers' 'Steel Curtain' defense shut 'em down in the 70s.";

	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/09.jpg";
	imgsGallery[9].title = "Schaumberg, IL";
	imgsGallery[9].subtitle = "July 2004";
	imgsGallery[9].caption = "Shop Urban in Mom's Suburban.";

	imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/10.jpg";
	imgsGallery[10].title = "Oak Brook, IL";
	imgsGallery[10].subtitle = "January 2006";
	imgsGallery[10].caption = "";

	imgsGallery[11] = new Object();
	imgsGallery[11].image = "images/11.jpg";
	imgsGallery[11].title = "Elmhurst, NY";
	imgsGallery[11].subtitle = "November 2004";
	imgsGallery[11].caption = "Kings from Queens, from Queens come Kings.";

	imgsGallery[12] = new Object();
	imgsGallery[12].image = "images/12.jpg";
	imgsGallery[12].title = "McLean, VA";
	imgsGallery[12].subtitle = "September 2005";
	imgsGallery[12].caption = "Virginia is for Lovers.";

	imgsGallery[13] = new Object();
	imgsGallery[13].image = "images/13.jpg";
	imgsGallery[13].title = "Dallas, TX";
	imgsGallery[13].subtitle = "February 2004";
	imgsGallery[13].caption = "Who shot J.R.? UO shot J.R.";

	imgsGallery[14] = new Object();
	imgsGallery[14].image = "images/14.jpg";
	imgsGallery[14].title = "Bloomington, MN";
	imgsGallery[14].subtitle = "July 2004";
	imgsGallery[14].caption = "Shop 'til you drop at the Mall Of America.";

	imgsGallery[15] = new Object();
	imgsGallery[15].image = "images/15.jpg";
	imgsGallery[15].title = "Los Angeles, CA";
	imgsGallery[15].subtitle = "November 2006";
	imgsGallery[15].caption = "UCLA's blue and gold shop in Westwood.";

	imgsGallery[16] = new Object();
	imgsGallery[16].image = "images/16.jpg";
	imgsGallery[16].title = "Rancho Cucamonga, CA";
	imgsGallery[16].subtitle = "August 2005";
	imgsGallery[16].caption = "Oh, oh, pride of Cucamonga/Oh, oh, silver apples in the sun.";

	imgsGallery[17] = new Object();
	imgsGallery[17].image = "images/17.jpg";
	imgsGallery[17].title = "Charlotte, NC";
	imgsGallery[17].subtitle = "August 2004";
	imgsGallery[17].caption = "Tarheel Country.";

	imgsGallery[18] = new Object();
	imgsGallery[18].image = "images/18.jpg";
	imgsGallery[18].title = "Thousand Oaks, CA";
	imgsGallery[18].subtitle = "November 2004";
	imgsGallery[18].caption = "";

	imgsGallery[19] = new Object();
	imgsGallery[19].image = "images/19.jpg";
	imgsGallery[19].title = "Chicago, IL";
	imgsGallery[19].subtitle = "March 2006";
	imgsGallery[19].caption = "Bucktown or Wicker Park. Which side are you on?";

	imgsGallery[20] = new Object();
	imgsGallery[20].image = "images/20.jpg";
	imgsGallery[20].title = "Lone Tree, CO";
	imgsGallery[20].subtitle = "June 2004";
	imgsGallery[20].caption = "Sunshine, snow and shopping in the 'Red Earth' state.";

	imgsGallery[21] = new Object();
	imgsGallery[21].image = "images/21.jpg";
	imgsGallery[21].title = "Simi Valley, CA";
	imgsGallery[21].subtitle = "November 2005";
	imgsGallery[21].caption = "";

	imgsGallery[22] = new Object();
	imgsGallery[22].image = "images/22.jpg";
	imgsGallery[22].title = "San Luis Obispo, CA";
	imgsGallery[22].subtitle = "January 2006";
	imgsGallery[22].caption = "";

	imgsGallery[23] = new Object();
	imgsGallery[23].image = "images/23.jpg";
	imgsGallery[23].title = "Washington, DC";
	imgsGallery[23].subtitle = "August 2004";
	imgsGallery[23].caption = "";

	imgsGallery[24] = new Object();
	imgsGallery[24].image = "images/24.jpg";
	imgsGallery[24].title = "Portland, OR";
	imgsGallery[24].subtitle = "March 2004";
	imgsGallery[24].caption = "";

	imgsGallery[25] = new Object();
	imgsGallery[25].image = "images/25.jpg";
	imgsGallery[25].title = "Studio City, CA";
	imgsGallery[25].subtitle = "July 2006";
	imgsGallery[25].caption = "Lights! Camera! Action! Shop!";

	imgsGallery[26] = new Object();
	imgsGallery[26].image = "images/26.jpg";
	imgsGallery[26].title = "Scottsdale, AZ";
	imgsGallery[26].subtitle = "December 2005";
	imgsGallery[26].caption = "";

	imgsGallery[27] = new Object();
	imgsGallery[27].image = "images/27.jpg";
	imgsGallery[27].title = "Palm Beach Gardens, FL";
	imgsGallery[27].subtitle = "March 2006";
	imgsGallery[27].caption = "";

	imgsGallery[28] = new Object();
	imgsGallery[28].image = "images/28.jpg";
	imgsGallery[28].title = "Richmond, VA";
	imgsGallery[28].subtitle = "May 2006";
	imgsGallery[28].caption = "";

	imgsGallery[29] = new Object();
	imgsGallery[29].image = "images/29.jpg";
	imgsGallery[29].title = "Montclair, NJ";
	imgsGallery[29].subtitle = "July 2006";
	imgsGallery[29].caption = "";

	imgsGallery[30] = new Object();
	imgsGallery[30].image = "images/30.jpg";
	imgsGallery[30].title = "Durham, NC";
	imgsGallery[30].subtitle = "September 2006";
	imgsGallery[30].caption = "";

	imgsGallery[31] = new Object();
	imgsGallery[31].image = "images/31.jpg";
	imgsGallery[31].title = "Torrance, CA";
	imgsGallery[31].subtitle = "September 2006";
	imgsGallery[31].caption = "";

	imgsGallery[32] = new Object();
	imgsGallery[32].image = "images/32.jpg";
	imgsGallery[32].title = "Cambridge, MA";
	imgsGallery[32].subtitle = "September 2005";
	imgsGallery[32].caption = "25th anniversary of our first store opening. Were you even born yet?";

	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 subtitle = (imgsGallery[0].subtitle) ? imgsGallery[0].subtitle : "No Sub-Title";
	var caption = (imgsGallery[0].caption) ? imgsGallery[0].caption : "";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_subtitle").innerHTML = subtitle;
	$("imgDisplay_caption").innerHTML = caption;
	$("imgDisplay_number").innerHTML = "1 of " + imgsGallery.length;
	$("imgDisplay").src = imgsGallery[start].image;
}

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

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