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

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

////////////////////////////////////////////////////////////////////////////////
// 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/manning1.jpg";
	imgsGallery[0].title = "Manning House";
	imgsGallery[0].caption = " ";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/manning2.jpg";
	imgsGallery[1].title = "Manning House";
	imgsGallery[1].caption = " ";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/manning3.jpg";
	imgsGallery[2].title = "Manning House";
	imgsGallery[2].caption = " ";
	
	imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/manning4.jpg";
	imgsGallery[3].title = "Manning House";
	imgsGallery[3].caption = " ";
	
	imgsGallery[4] = new Object();
	imgsGallery[4].image = "images/manning5.jpg";
	imgsGallery[4].title = "Manning House";
	imgsGallery[4].caption = " ";
	
	imgsGallery[5] = new Object();
	imgsGallery[5].image = "images/fairlight1.jpg";
	imgsGallery[5].title = "Fairlight House";
	imgsGallery[5].caption = " ";
	
	imgsGallery[6] = new Object();
	imgsGallery[6].image = "images/fairlight2.jpg";
	imgsGallery[6].title = "Fairlight House";
	imgsGallery[6].caption = " ";
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/fairlight3.jpg";
	imgsGallery[7].title = "Fairlight House";
	imgsGallery[7].caption = " ";
	
	imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/fairlight4.jpg";
	imgsGallery[8].title = "Fairlight House";
	imgsGallery[8].caption = " ";
	
	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/edith1.jpg";
	imgsGallery[9].title = "Edith Street Aparments";
	imgsGallery[9].caption = " ";
	
	imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/edith2.jpg";
	imgsGallery[10].title = "Edith Street Aparments";
	imgsGallery[10].caption = " ";
	
	imgsGallery[11] = new Object();
	imgsGallery[11].image = "images/edith3.jpg";
	imgsGallery[11].title = "Edith Street Aparments";
	imgsGallery[11].caption = " ";
	
	imgsGallery[12] = new Object();
	imgsGallery[12].image = "images/edith4.jpg";
	imgsGallery[12].title = "Edith Street Aparments";
	imgsGallery[12].caption = " ";
	
	imgsGallery[13] = new Object();
	imgsGallery[13].image = "images/queen1.jpg";
	imgsGallery[13].title = "Queen Street House";
	imgsGallery[13].caption = " ";
	
	imgsGallery[14] = new Object();
	imgsGallery[14].image = "images/queen2.jpg";
	imgsGallery[14].title = "Queen Street House";
	imgsGallery[14].caption = " ";
	
	imgsGallery[15] = new Object();
	imgsGallery[15].image = "images/fern2.jpg";
	imgsGallery[15].title = "Fern Street House";
	imgsGallery[15].caption = " ";
	
	imgsGallery[16] = new Object();
	imgsGallery[16].image = "images/breath1.jpg";
	imgsGallery[16].title = "Breath Artwork, Caslereigh Street Sydney";
	imgsGallery[16].caption = "Assiting Lisa Cahill Artist";
	
	imgsGallery[17] = new Object();
	imgsGallery[17].image = "images/darby1.jpg";
	imgsGallery[17].title = "Shackel Street House";
	imgsGallery[17].caption = " ";
	
	imgsGallery[18] = new Object();
	imgsGallery[18].image = "images/tuck1.jpg";
	imgsGallery[18].title = "Tuckombil House";
	imgsGallery[18].caption = " ";
	
	imgsGallery[19] = new Object();
	imgsGallery[19].image = "images/tuck2.jpg";
	imgsGallery[19].title = "Tuckombil House";
	imgsGallery[19].caption = " ";
	
	imgsGallery[20] = new Object();
	imgsGallery[20].image = "images/uts1.jpg";
	imgsGallery[20].title = "UTS Competition Entry";
	imgsGallery[20].caption = "with Mackenzie Pronk Architects";
	
	imgsGallery[21] = new Object();
	imgsGallery[21].image = "images/uts2.jpg";
	imgsGallery[21].title = "UTS Competition Entry";
	imgsGallery[21].caption = "with Mackenzie Pronk Architects";
	
	
	var start = 0;
	imgs = new MudFadeGallery('imgs', 'imgDisplay', imgsGallery, {startNum: start, preload: true, autoplay: 2});
	
	// set the initial captions
	var title = (imgsGallery[0].title) ? imgsGallery[0].title : "No Title";
	var caption = (imgsGallery[0].caption) ? imgsGallery[0].caption : "";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_caption").innerHTML = caption;
	$("imgDisplay_number").innerHTML = "1 of " + imgsGallery.length + " projects";
	$("imgDisplay").src = imgsGallery[start].image;
}

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

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