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

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/surfers_the_mers.jpg";
	imgsGallery[0].title = "11.03.17 #3  The Mer's";
	imgsGallery[0].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";
	
	imgsGallery[1] = new Object();
	imgsGallery[1].image = "images/surfers_jen.jpg";
	imgsGallery[1].title = "10.02.11 #7 Jen";
	imgsGallery[1].caption = "8\" x 10\" unique tintype. Oceanside, CA, 2010";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/surfers_Andy_Muriel.jpg";
	imgsGallery[2].title = "11.09.30 #1 Andy &#38; Muriel";
	imgsGallery[2].caption = "8\" x 10\" unique tintype. Jalama, CA 2011";
		
    imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/surfers_double_icon.jpg";
	imgsGallery[3].title = "11.09.30 #6 Double Icon";
	imgsGallery[3].caption = "8\" x 10\" unique tintype. Jalama, CA, 2011";
			
	imgsGallery[4] = new Object();
	imgsGallery[4].image = "images/surfers_danielle.jpg";
	imgsGallery[4].title = "10.02.17 #6 Danielle";
	imgsGallery[4].caption = "8\" x 10\" unique tintype. Refugio, CA, 2010";	
	
    imgsGallery[5] = new Object();
	imgsGallery[5].image = "images/surfers_Daniel.jpg";
	imgsGallery[5].title = "10.02.15 #3 Daniel";
	imgsGallery[5].caption = "8\" x 10\" unique tintype. Rincon, CA, 2010";

    imgsGallery[6] = new Object();
	imgsGallery[6].image = "images/surfers_Donald.jpg";
	imgsGallery[6].title = "10.02.11 #2 Donald";
	imgsGallery[6].caption = "8\" x 10\" unique tintype. Oceanside, CA, 2010";
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/surfers_Terezka.jpg";
	imgsGallery[7].title = "11.03.04 #4 Terezka";
	imgsGallery[7].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";
		
    imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/surfers_donavon.jpg";
	imgsGallery[8].title = "11.07.17 #1 Donavon";
	imgsGallery[8].caption = "8\" x 10\" unique tintype. Montauk, NY, 2011";

	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/surfers_dave.jpg";
	imgsGallery[9].title = "11.03.16 #5 Dave";
	imgsGallery[9].caption = "8\" x 10\" unique tintype. Broken Head, OZ, 2011";
			
    imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/surfers_chris_dan.jpg";
	imgsGallery[10].title = "10.02.17 #5 Chris &#38; Dan";
	imgsGallery[10].caption = "8\" x 10\" unique tintype. Refugio, CA, 2010";
	
	imgsGallery[11] = new Object();
	imgsGallery[11].image = "images/surfers_jimmygamboa.jpg";
	imgsGallery[11].title = "10.02.15 #1 Jimmy";
	imgsGallery[11].caption = "8\" x 10\" unique tintype. Rincon, CA, 2010";	
	
	imgsGallery[12] = new Object();
	imgsGallery[12].image = "images/surfers_johnny.jpg";
	imgsGallery[12].title = "11.03.04 #3 Johnny";
	imgsGallery[12].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";		
	
    imgsGallery[13] = new Object();
	imgsGallery[13].image = "images/surfers_christian.jpg";
	imgsGallery[13].title = "10.02.12 #2 Christian";
	imgsGallery[13].caption = "8\" x 10\" unique tintype. San Onofre, CA, 2010";
	
    imgsGallery[14] = new Object();
	imgsGallery[14].image = "images/surfers_061109_1_turtle_cove.jpg"
	imgsGallery[14].title = "06.11.09 #1 Turtle Cove";
	imgsGallery[14].caption = "8\" x 10\" unique tintype. Turtle Cove, NY, 2006";

    imgsGallery[15] = new Object();
	imgsGallery[15].image = "images/surfers_andys_board.jpg";
	imgsGallery[15].title = "09.08.25 #4 Andy's Board";
	imgsGallery[15].caption = "14\" x 17\" unique tintype. Ditch Plains, NY, 2009";
	
    imgsGallery[16] = new Object();
	imgsGallery[16].image = "images/surfers_Nick.jpg";
	imgsGallery[16].title = "11.03.07 #3 Nick";
	imgsGallery[16].caption = "14\" x 17\" unique tintype. The Pass, OZ, 2011";

	imgsGallery[17] = new Object();
	imgsGallery[17].image = "images/surfers_kazzie.jpg";
	imgsGallery[17].title = " 11.03.17 #1 Kazzie";
	imgsGallery[17].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";

	imgsGallery[18] = new Object();
	imgsGallery[18].image = "images/surfers_tony.jpg";
	imgsGallery[18].title = "09.08.25 #9 Tony";
	imgsGallery[18].caption = "14\" x 17\" unique tintype. Ditch Plains, NY, 2009";
		
    imgsGallery[19] = new Object();
	imgsGallery[19].image = "images/surfers_jan.jpg";
	imgsGallery[19].title = "09.08.25 #8 Jan";
	imgsGallery[19].caption = "14\" x 17\" unique tintype. Ditch Plains, NY, 2009";
		
	imgsGallery[20] = new Object();
	imgsGallery[20].image = "images/surfers_rasmus_kyuss.jpg";
	imgsGallery[20].title = "11.03.14 #4 Rasmus &#38; Kyuss";
	imgsGallery[20].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";
	
	imgsGallery[21] = new Object();
	imgsGallery[21].image = "images/surfers_freddie_harry.jpg";
	imgsGallery[21].title = "09.06.13 #3 Freddie &#38; Harry";
	imgsGallery[21].caption = "14\" x 17\" unique tintype. Ditch Plains, NY, 2009";
	
	imgsGallery[22] = new Object();
	imgsGallery[22].image = "images/surfers_melissa.jpg";
	imgsGallery[22].title = "11.02.26 #1 Melissa";
	imgsGallery[22].caption = "8\" x 10\" unique tintype. Wategos, OZ, 2011";
	
	imgsGallery[23] = new Object();
	imgsGallery[23].image = "images/surfers_blake_greg.jpg";
	imgsGallery[23].title = "09.08.27 #7 Blake &#38; Greg";
	imgsGallery[23].caption = "14\" x 17\" unique tintype. Dirt Lot, Montauk, 2009";
			
    imgsGallery[24] = new Object();
	imgsGallery[24].image = "images/surfers_cori.jpg";
	imgsGallery[24].title = "09.02.10 #8 Cori";
	imgsGallery[24].caption = "8\" x 10\" unique tintype. Rincon, CA, 2009";

    imgsGallery[25] = new Object();
	imgsGallery[25].image = "images/surfers_lauren.jpg";
	imgsGallery[25].title = "11.03.07 #1 Lauren";
	imgsGallery[25].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";	
			
	imgsGallery[26] = new Object();
	imgsGallery[26].image = "images/surfers_christianb.jpg"
	imgsGallery[26].title = "11.09.27 #7 Christian";
	imgsGallery[26].caption = "8\" x 10\" unique tintype. San Onofre, CA, 2009";
			
	imgsGallery[27] = new Object();
	imgsGallery[27].image = "images/surfers_lakey.jpg";
	imgsGallery[27].title = "09.02.12 #8 Lakey";
	imgsGallery[27].caption = "8\" x 10\" unique tintype. Rincon, C, 2009";
			
	imgsGallery[28] = new Object();
	imgsGallery[28].image = "images/surfers_renny.jpg";
	imgsGallery[28].title = "09.02.19 #4 Renny";
	imgsGallery[28].caption = "8\" x 10\" unique tintype. Hammonds, CA, 2009";
	
	imgsGallery[29] = new Object();
	imgsGallery[29].image = "images/surfers_steve.jpg";
	imgsGallery[29].title = "09.02.11 #4 Steve";
	imgsGallery[29].caption = "8\" x 10\" unique tintype. Rincon, CA, 2009";
	
	imgsGallery[30] = new Object();
	imgsGallery[30].image = "images/surfers_kassia.jpg";
	imgsGallery[30].title = "10.02.11 #5 Kassia";
	imgsGallery[30].caption = "8\" x 10\" unique tintype. Oceanside, CA, 2010";
	
	imgsGallery[31] = new Object();
	imgsGallery[31].image = "images/surfers_080805_2_Mary Ellen.jpg";
	imgsGallery[31].title = "08.08.05 #2 Mary Ellen";
	imgsGallery[31].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2008";
			
	imgsGallery[32] = new Object();
	imgsGallery[32].image = "images/surfers_candice.jpg";
	imgsGallery[32].title = "11.03.14 #6 Candice";
	imgsGallery[32].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";	
				
	imgsGallery[33] = new Object();
	imgsGallery[33].image = "images/surfers_rusty.jpg";
	imgsGallery[33].title = "11.03.09 #3 Rusty";
	imgsGallery[33].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";

			
    imgsGallery[34] = new Object();
	imgsGallery[34].image = "images/surfers_shir.jpg";
	imgsGallery[34].title = "09.07.12 #6 Shir";
	imgsGallery[34].caption = "8\" x 10\" unique tintype. Dirt Lot, NY 2009";

    imgsGallery[35] = new Object();
	imgsGallery[35].image = "images/surfers_shane_tyler.jpg";
	imgsGallery[35].title = "09.02.19 #7 Shane &#38; Tyler";
	imgsGallery[35].caption = "8\" x 10\" unique tintype. Hammonds, CA, 2009";
	
    imgsGallery[36] = new Object();
	imgsGallery[36].image = "images/surfers_080209_2_shaun.jpg";
	imgsGallery[36].title = "08.02.09 #2 Shaun";
	imgsGallery[36].caption = "8\" x 10\" unique tintype. Rincon, CA, 2008";
			
	imgsGallery[37] = new Object();
	imgsGallery[37].image = "images/surfers_070811_2 jimmy.jpg";
	imgsGallery[37].title = "07.08.11 #2 Jimmy";
	imgsGallery[37].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2007";
	
	imgsGallery[38] = new Object();
	imgsGallery[38].image = "images/surfers_Valerie.jpg";
	imgsGallery[38].title = "08.07.26 #6 Valerie ";
	imgsGallery[38].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2008";

	imgsGallery[39] = new Object();
	imgsGallery[39].image = "images/surfers_mikey.jpg";
	imgsGallery[39].title = "08.07.26 #7 Mikey";
	imgsGallery[39].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2008";
	
	imgsGallery[40] = new Object();
	imgsGallery[40].image ="images/surfers_060918_8_angelika_bettina_leslie.jpg";
	imgsGallery[40].title = "06.09.18 #8 Angelika, Bettina &#38; Leslie";
	imgsGallery[40].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2006";

    imgsGallery[41] = new Object();
	imgsGallery[41].image ="images/surfers_060930_6_lulu+minnie.jpg";
	imgsGallery[41].title = ".06.09.30 #6 Minnie &#38; Lulu";
	imgsGallery[41].caption = "8\" x 10\" unique tintype. Ditch Plains, N, 2006";

    imgsGallery[42] = new Object();
	imgsGallery[42].image = "images/surfers_071016_5_tripoli.jpg";
	imgsGallery[42].title = "07.10.16 #5 Tripoli";
	imgsGallery[42].caption = "8\" x 10\" unique tintype. Ditch Plains, NY. 2007";
	
	imgsGallery[43] = new Object();
	imgsGallery[43].image ="images/surfers_080704_1_abbey.jpg";
	imgsGallery[43].title = "08.07.04 #1 Abbey";
	imgsGallery[43].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2008";

    imgsGallery[44] = new Object();
	imgsGallery[44].image = "images/surfers_070916_11_kim+ed.jpg";
	imgsGallery[44].title = "07.09.16 #10 Kim &#38; Ed";
	imgsGallery[44].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2007";
	
	imgsGallery[45] = new Object();
	imgsGallery[45].image = "images/surfers_leana_joesph.jpg"
	imgsGallery[45].title = "11.02.25 #2 Leana &#38; Joseph";
	imgsGallery[45].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";
   	
	imgsGallery[46] = new Object();
	imgsGallery[46].image = "images/surfers_doug.jpg"
	imgsGallery[46].title = "11.03.09 #4 Doug";
	imgsGallery[46].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";
	
	imgsGallery[47] = new Object();
	imgsGallery[47].image = "images/surfers_060712_4_lonesurfer.jpg"
	imgsGallery[47].title = "06.07.12 #4 Lone Surfer";
	imgsGallery[47].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2006";
	
	imgsGallery[48] = new Object();
	imgsGallery[48].image = "images/surfers_hannah.jpg";
	imgsGallery[48].title = "10.02.08 #5 Hannah";
	imgsGallery[48].caption = "8\" x 10\" unique tintype. Malibu, CA, 2010";
    	
    imgsGallery[49] = new Object();
	imgsGallery[49].image = "images/surfers_ben.jpg";
	imgsGallery[49].title = "10.02.18 #7 Ben";
	imgsGallery[49].caption = "8\" x 10\" unique tintype. Malibu, CA, 2010";
	
	imgsGallery[50] = new Object();
	imgsGallery[50].image = "images/surfers_chris.jpg";
	imgsGallery[50].title = "10.02.17 #2 Chris";
	imgsGallery[50].caption = "8\" x 10\" unique tintype. Refugio, CA, 2010";
	
	imgsGallery[51] = new Object();
	imgsGallery[51].image = "images/surfers_070922_3_gillian.jpg";
	imgsGallery[51].title = "07.09.22 #3 Gillian";
	imgsGallery[51].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2007";
			
	imgsGallery[52] = new Object();
	imgsGallery[52].image = "images/surfers_080804_6_Ed.jpg";
	imgsGallery[52].title = "08.08.04 #6 Hawaiian Ed";
	imgsGallery[52].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2008";	
				
	imgsGallery[53] = new Object();
	imgsGallery[53].image = "images/surfers_070702_7_lily.jpg";
	imgsGallery[53].title = "07.07.02 #7 Lily";
	imgsGallery[53].caption = "8\" x 10\" unique tintype. Ditch Plains, NY, 2007";

	imgsGallery[54] = new Object();
	imgsGallery[54].image = "images/surfers_stephen.jpg";
	imgsGallery[54].title = "11.03.17 #5 Stephen";
	imgsGallery[54].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";
	
	imgsGallery[55] = new Object();
	imgsGallery[55].image = "images/surfers_jemma.jpg"
	imgsGallery[55].title = "11.03.09 #1 Jemma";
	imgsGallery[55].caption = "8\" x 10\" unique tintype. The Pass, OZ, 2011";
   	
    imgsGallery[56] = new Object();
	imgsGallery[56].image = "images/surfers_jordan.jpg";
	imgsGallery[56].title = "11.03.09 #5 Jordan";
	imgsGallery[56].caption = "14\" x 17\" unique tintype. The Pass, OZ, 2011";
	
    imgsGallery[57] = new Object();
	imgsGallery[57].image = "images/surfers_ed.jpg";
	imgsGallery[57].title = "11.03.21 #5 Ed";
	imgsGallery[57].caption = "8\" x 10\" unique tintype. Wategos, OZ, 2011";
	
	imgsGallery[58] = new Object();
	imgsGallery[58].image = "images/surfers_john.jpg";
	imgsGallery[58].title = "11.04.27 #7 John";
	imgsGallery[58].caption = "8\" x 10\" unique tintype. Orange County, CA, 2011";
		
    var start = 0;
	var page = document.location.toString().split("?")[1];
	if (page != null) {
		start = page;
}
	imgs = new MudFadeGallery('imgs', 'imgDisplay', imgsGallery, {startNum: start, preload: true, autoplay: 0});
	
	// set the initial captions
	var title = (imgs.imgsArray[imgs.imgCurrent].title) ? imgs.imgsArray[imgs.imgCurrent].title : "No Title";
	var caption = (imgs.imgsArray[imgs.imgCurrent].caption) ? imgs.imgsArray[imgs.imgCurrent].caption : "No caption";
	$("imgDisplay_title").innerHTML = title;
	$("imgDisplay_caption").innerHTML = caption;
	$(imgs.id+"_number").innerHTML = (parseInt(imgs.imgCurrent)+1) + " of " + imgs.imgTotal;
	$("imgDisplay").src = imgsGallery[start].image;
}

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

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