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

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

////////////////////////////////////////////////////////////////////////////////
// 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/per_bab001.jpg";
	imgsGallery[0].title = "Babycakes";
	imgsGallery[0].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "/images/per_bab002.jpg";
	imgsGallery[1].title = "Babycakes";
	imgsGallery[1].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "/images/per_bab003.jpg";
	imgsGallery[2].title = "Babycakes";
	imgsGallery[2].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[3] = new Object();
	imgsGallery[3].image = "/images/per_bab004.jpg";
	imgsGallery[3].title = "Babycakes";
	imgsGallery[3].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";

	imgsGallery[4] = new Object();
	imgsGallery[4].image = "/images/per_bab005.jpg";
	imgsGallery[4].title = "Babycakes";
	imgsGallery[4].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "/images/per_bab006.jpg";
	imgsGallery[5].title = "Babycakes";
	imgsGallery[5].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "/images/per_bab007.jpg";
	imgsGallery[6].title = "Babycakes";
	imgsGallery[6].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";

	imgsGallery[7] = new Object();
	imgsGallery[7].image = "/images/per_bab008.jpg";
	imgsGallery[7].title = "Babycakes";
	imgsGallery[7].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[8] = new Object();
	imgsGallery[8].image = "/images/per_bab009.jpg";
	imgsGallery[8].title = "Babycakes";
	imgsGallery[8].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre"; 
	
	imgsGallery[9] = new Object();
	imgsGallery[9].image = "/images/per_bab010.jpg";
	imgsGallery[9].title = "Babycakes";
	imgsGallery[9].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[10] = new Object();
	imgsGallery[10].image = "/images/per_bab011.jpg";
	imgsGallery[10].title = "Babycakes";
	imgsGallery[10].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[11] = new Object();
	imgsGallery[11].image = "/images/per_bab012.jpg";
	imgsGallery[11].title = "Babycakes";
	imgsGallery[11].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";
	
	imgsGallery[12] = new Object();
	imgsGallery[12].image = "/images/per_bab013.jpg";
	imgsGallery[12].title = "Babycakes";
	imgsGallery[12].caption = "Performance, cake icing applied to the artist’s pregnant belly, Montreal<br /><b>June 21st, 2008</b><br /><i>Hosted by La Central Gallerie Powerhouse</i><br /><br />Studio photos by Kate Fellerath<br />Studio Icing by Elizabeth Belliveau<br />Performance Documentation by Laura St Pierre";

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