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

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_hannah.jpg";
	imgsGallery[0].title = "10.02.08 #5 Hannah";
	imgsGallery[0].caption = "8\" x 10\" unique tintype. Malibu";
	
	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";
	
	imgsGallery[2] = new Object();
	imgsGallery[2].image = "images/surfers_kassia.jpg";
	imgsGallery[2].title = "10.02.11 #5 Kassia";
	imgsGallery[2].caption = "8\" x 10\" unique tintype. Oceanside";
		
	imgsGallery[3] = new Object();
	imgsGallery[3].image = "images/surfers_chris_dan.jpg";
	imgsGallery[3].title = "10.02.17 #5 Chris &#38; Dan";
	imgsGallery[3].caption = "8\" x 10\" unique tintype. Refugio";
		
	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";	
	
    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";

    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";
	
	imgsGallery[7] = new Object();
	imgsGallery[7].image = "images/surfers_Holly.jpg";
	imgsGallery[7].title = "10.02.18 #4 Holly";
	imgsGallery[7].caption = "8\" x 10\" unique tintype. Malibu";
		
    imgsGallery[8] = new Object();
	imgsGallery[8].image = "images/surfers_ben.jpg";
	imgsGallery[8].title = "10.02.18 #7 Ben";
	imgsGallery[8].caption = "8\" x 10\" unique tintype. Malibu";

	imgsGallery[9] = new Object();
	imgsGallery[9].image = "images/surfers_chris.jpg";
	imgsGallery[9].title = "10.02.17 #2 Chris";
	imgsGallery[9].caption = "8\" x 10\" unique tintype. Refugio";
			
    imgsGallery[10] = new Object();
	imgsGallery[10].image = "images/surfers_kathy.jpg";
	imgsGallery[10].title = "10.02.08 #3 Kathy";
    imgsGallery[10].caption = "8\" x 10\" unique tintype. Malibu";
	
	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";	
	
	imgsGallery[12] = new Object();
	imgsGallery[12].image = "images/surfers_shannon.jpg";
	imgsGallery[12].title = "10.02.14 #1 Shannon";
	imgsGallery[12].caption = "8\" x 10\" unique tintype. Hollister Ranch";		
	
    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";
	
    imgsGallery[14] = new Object();
	imgsGallery[14].image = "images/surfers_061109_1_turtle_cove.jpg"
	imgsGallery[14].title = "06.11.09 # Turtle Cove";
	imgsGallery[14].caption = "8\" x 10\" unique tintype. Turtle Cove";

    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";
	
    imgsGallery[16] = new Object();
	imgsGallery[16].image = "images/surfers_len.jpg";
	imgsGallery[16].title = "09.08.24 #4 Len";
	imgsGallery[16].caption = "14\" x 17\" unique tintype. Radars, Camp Hero";

	imgsGallery[17] = new Object();
	imgsGallery[17].image = "images/surfers_meg.jpg";
	imgsGallery[17].title = " 09.08.25 #3 Meg";
	imgsGallery[17].caption = "14\" x 17\" unique tintype. Ditch Plains";

	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";
		
    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";
		
	imgsGallery[20] = new Object();
	imgsGallery[20].image = "images/surfers_jason.jpg";
	imgsGallery[20].title = "09.07.12 #5 Jason";
	imgsGallery[20].caption = "14\" x 17\" unique tintype. Ditch Plains";
	
	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";
	
	imgsGallery[22] = new Object();
	imgsGallery[22].image = "images/surfers_sian.jpg";
	imgsGallery[22].title = "09.06.13 #5 Sian";
	imgsGallery[22].caption = "14\" x 17\" unique tintype. Ditch Plains";
	
	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. Ditch Plains";
			
    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";

    imgsGallery[25] = new Object();
	imgsGallery[25].image = "images/surfers_olaf.jpg";
	imgsGallery[25].title = "09.02.21 #6 Olaf";
	imgsGallery[25].caption = "8\" x 10\" unique tintype. Hollister Ranch";	
			
	imgsGallery[26] = new Object();
	imgsGallery[26].image = "images/surfers_kadin.jpg"
	imgsGallery[26].title = "09.02.08 #3 Kadin";
	imgsGallery[26].caption = "8\" x 10\" unique tintype. Rincon";
			
	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";
			
	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";
	
	imgsGallery[29] = new Object();
	imgsGallery[29].image = "images/surfers_steve.jpg";
	imgsGallery[29].title = "09,02.11 # Steve";
	imgsGallery[29].caption = "8\" x 10\" unique tintype. Rincon";
	
	imgsGallery[30] = new Object();
	imgsGallery[30].image = "images/surfers_mark.jpg";
	imgsGallery[30].title = "09.02.19 #8 Mark";
	imgsGallery[30].caption = "8\" x 10\" unique tintype. Hammonds";
	
	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";
			
	imgsGallery[32] = new Object();
	imgsGallery[32].image = "images/surfers_090203_9_charlotte.jpg";
	imgsGallery[32].title = "09.02.03 #9 Charlotte";
	imgsGallery[32].caption = "8\" x 10\" unique tintype. Bolsa Chica";	
				
	imgsGallery[33] = new Object();
	imgsGallery[33].image = "images/surfers_heather.jpg";
	imgsGallery[33].title = "08.02.16 #11 Heather";
	imgsGallery[33].caption = "8\" x 10\" unique tintype. Rincon";
			
    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. Ditch Plains";

    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";
	
    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";
			
	imgsGallery[37] = new Object();
	imgsGallery[37].image = "images/surfers_the_ranch.jpg";
	imgsGallery[37].title = "09.02.21 # The Ranch";
	imgsGallery[37].caption = "8\" x 10\" unique tintype. The Ranch";	
	
	imgsGallery[21] = new Object();
	imgsGallery[21].image = "images/surfers_070922_3_gillian.jpg";
	imgsGallery[21].title = "07.09.22 #3 Gillian";
	imgsGallery[21].caption = "8\" x 10\" unique tintype. Ditch Plains";
			
	imgsGallery[22] = new Object();
	imgsGallery[22].image = "images/surfers_080804_6_Ed.jpg";
	imgsGallery[22].title = "08.08.04 #6 Ed";
	imgsGallery[22].caption = "8\" x 10\" unique tintype. Ditch Plains";	
				
	imgsGallery[23] = new Object();
	imgsGallery[23].image = "images/surfers_070702_7_lily.jpg";
	imgsGallery[23].title = "07.07.02 #7 Lily";
	imgsGallery[23].caption = "8\" x 10\" unique tintype. Ditch Plains";
			
	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";
	
	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";

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

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

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

    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";
	
	imgsGallery[45] = new Object();
	imgsGallery[45].image = "images/surfers_090717_1_angela_lee.jpg"
	imgsGallery[45].title = "09.07.17 #1 Angela &#38; Lee";
	imgsGallery[45].caption = "8\" x 10\" unique tintype. Ditch Plains";
   	
	imgsGallery[46] = new Object();
	imgsGallery[46].image = "images/surfers_glenn.jpg"
	imgsGallery[46].title = "09.08.24 #5 Glenn";
	imgsGallery[46].caption = "14\" x 17\" unique tintype. Radars, Camp Hero";
	
	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";
	
	
	
	
    	


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