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

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

////////////////////////////////////////////////////////////////////////////////
// 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/rock1a/rock001.jpg";
	imgsGallery[0].title = "Scholars Rock 57, 2006";
	imgsGallery[0].caption = "acrylic on canvas";
	imgsGallery[0].caption2 = "28 x 24 in.";

	imgsGallery[1] = new Object();
	imgsGallery[1].image = "../images/rock1a/rock002.jpg";
	imgsGallery[1].title = "Scholars Rock 57, 2006";
	imgsGallery[1].caption = "acrylic on canvas";
	imgsGallery[1].caption2 = "28 x 24 in., detail view";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "../images/rock1a/rock003.jpg";
	imgsGallery[2].title = "Scholars Rock Two, 2006";
	imgsGallery[2].caption = "acrylic on canvas";
	imgsGallery[2].caption2 = "32 x 24 in.";

	imgsGallery[3] = new Object();
	imgsGallery[3].image = "../images/rock1a/rock004.jpg";
	imgsGallery[3].title = "Scholars Rock Two, 2006";
	imgsGallery[3].caption = "acrylic on canvas";
	imgsGallery[3].caption2 = "32 x 24 in., detail view";

	imgsGallery[4] = new Object();
	imgsGallery[4].image = "../images/rock1a/rock005.jpg";
	imgsGallery[4].title = "Scholars Rock 33, 2005-6";
	imgsGallery[4].caption = "acrylic on canvas";
	imgsGallery[4].caption2 = "48 x 55 in.";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "../images/rock1a/rock006.jpg";
	imgsGallery[5].title = "Scholars Rock 33, 2005-6";
	imgsGallery[5].caption = "acrylic on canvas";
	imgsGallery[5].caption2 = "48 x 55 in., detail view";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "../images/rock1a/rock007.jpg";
	imgsGallery[6].title = "Scholars Rock One, 2004";
	imgsGallery[6].caption = "acrylic on canvas";
	imgsGallery[6].caption2 = "48 x 38 in.";
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "../images/rock1a/rock008.jpg";
	imgsGallery[7].title = "Scholars Rock One, 2004";
	imgsGallery[7].caption = "acrylic on canvas";
	imgsGallery[7].caption2 = "48 x 38 in., detail view";
	
	imgsGallery[8] = new Object();
	imgsGallery[8].image = "../images/rock1a/rock009.jpg";
	imgsGallery[8].title = "Scholars Rock Seven, 2005";
	imgsGallery[8].caption = "acrylic on canvas";
	imgsGallery[8].caption2 = "22 x 24 in.";
	
	imgsGallery[9] = new Object();
	imgsGallery[9].image = "../images/rock1a/rock010.jpg";
	imgsGallery[9].title = "Scholars Rock Seven, 2005";
	imgsGallery[9].caption = "acrylic on canvas";
	imgsGallery[9].caption2 = "22 x 24 in., detail view";
	
	imgsGallery[10] = new Object();
	imgsGallery[10].image = "../images/rock1a/rock011.jpg";
	imgsGallery[10].title = "Scholars Rock 11, 2004";
	imgsGallery[10].caption = "acrylic on canvas";
	imgsGallery[10].caption2 = "24 x 22 in.";
	
	imgsGallery[11] = new Object();
	imgsGallery[11].image = "../images/rock1a/rock012.jpg";
	imgsGallery[11].title = "Scholars Rock 11, 2004";
	imgsGallery[11].caption = "acrylic on canvas";
	imgsGallery[11].caption2 = "24 x 22 in., detail view";
	
	imgsGallery[12] = new Object();
	imgsGallery[12].image = "../images/rock1a/rock013.jpg";
	imgsGallery[12].title = "Scholars Rock 10, 2004";
	imgsGallery[12].caption = "acrylic on canvas";
	imgsGallery[12].caption2 = "18 x 22 in.";

	imgsGallery[13] = new Object();
	imgsGallery[13].image = "../images/rock1a/rock014.jpg";
	imgsGallery[13].title = "Scholars Rock Four, 2004";
	imgsGallery[13].caption = "acrylic on canvas";
	imgsGallery[13].caption2 = "32 x 24 in.";

	imgsGallery[14] = new Object();
	imgsGallery[14].image = "../images/rock1a/rock015.jpg";
	imgsGallery[14].title = "Scholars Rock One, v2, 2006";
	imgsGallery[14].caption = "acrylic on canvas";
	imgsGallery[14].caption2 = "24 x 18 in.";
	
	imgsGallery[15] = new Object();
	imgsGallery[15].image = "../images/rock1a/rock016.jpg";
	imgsGallery[15].title = "Scholars Rock One, v2, 2006";
	imgsGallery[15].caption = "acrylic on canvas";
	imgsGallery[15].caption2 = "24 x 18 in., detail view";
	
	

	var start = 0;
	imgs = new MudFadeGallery('imgs', 'imgDisplay', imgsGallery, {startNum: start, preload: true, autoplay: 6});
	
	// set the initial captions
	var title = (imgsGallery[0].title) ? imgsGallery[0].title : "Untitled";
	var caption = (imgsGallery[0].caption) ? imgsGallery[0].caption : "|";
	var caption2 = (imgsGallery[0].caption2) ? imgsGallery[0].caption2 : "|";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_caption").innerHTML = caption;
	$("imgDisplay_caption2").innerHTML = caption2;
	$("imgDisplay_number").innerHTML = "1 of " + imgsGallery.length + " images";
	$("imgDisplay").src = imgsGallery[start].image;
}

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

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