// <![CDATA[
	
	// -----------------------------------------------------------------------------------
	// 
	//  by Scott Upton
	// http://www.uptonic.com | http://www.couloir.org
	//

	//var photoId = 0;
	var photoDir = "images/";
	var borderSize = 20
	
	// get current photo id from URL
	var thisURL = document.location.href;
	var splitURL = thisURL.split("#");
	var photoId = splitURL[1] - 1;
	
	// if no id in query string then set i=1
	photoId = (!photoId)? 0:photoId;
	
	// List of photos in this gallery
	photoArray = new Array("franconia_ridge.jpg","bigsur.jpg","cassis.jpg","sugarloaf.jpg","eiffel.jpg","victoire.jpg","gull.jpg","lincoln.jpg","zealand.jpg","seine.jpg","bigsur2.jpg","gargoyle.jpg","cannon.jpg","sunset.jpg");
	
	var photoNum = photoArray.length;
	
	// Pixel width of each photo in this gallery
	photoWidthArray = new Array("683","688","365","514","585","669","536","567","405","596","675","550","322","666");
	
	// Pixel height of each photo in this gallery
	photoHeightArray = new Array("366","387","486","313","341","301","392","348","320","404","384","413","487","346");
	
	// Captions for photos
	captionArray = new Array("Franconia Ridge NH","Big Sur coastline","Cassis, France on the Mediterranean Coast","Atop Middle Sugarloaf - Twin Mountain, NH","Straight down from atop the Eiffel Tower","Mt. St. Victoire, Aix-en-Provence, France","Ogunquit, Maine","View South from Mt. Lincoln on Franconia Ridge","Zealand Pond","Notre Dame, Paris","Big Sur Coastline","Tireless Sentry atop Notre Dame Cathedral","Cannon Mt. NH seen form Artist's Bluff","Sunset from Mt. Jefferson");
	
	// Create access to 'Detect' object and a place to put instances of 'HTMLobj'
	API = new Detect();
	
	// CREATE INSTANCES & LOAD
	loadAPI = function(){
		// Instantiate HTMLobj
		API.Container = new HTMLobj('Container');
		API.PhotoContainer = new HTMLobj('PhotoContainer');
		API.Photo = new HTMLobj('Photo');
		
		nextPhoto();
	}
	onload = loadAPI;
	
	// Fade in photo when it is loaded from the server
	// Called by the image.onload event
	initFade = function(){
		// Be certain the tween is complete before fading, too
		var fade_timer = setInterval('startFade()', 1000);
		


		// Fade photo in when ready and clear listener
		startFade = function(){
		if (API._iex) {
		document.getElementById('Photo').filters[0].apply();
		document.getElementById('Photo').filters[0].play();
		}

			if(API.Container._tweenRunning == false){
				clearInterval(fade_timer);
				API.PhotoContainer.fadeIn(0,15,33);

				
			} else {
				return;
			}
		}
	}
	
	// Advance Photo ID by one
	advancePhoto = function(){
	//StopShow();
		// Cycle through to end, then repeat
		if(photoId == (photoArray.length - 1)){
			photoId = 0;
		} else {
			photoId++;
		}
		return photoId;
	}
	
	// Function to load subsequent photos in gallery
	nextPhoto = function(){		
		// Hide photo container temporarily
		API.PhotoContainer.hide();
		API.PhotoContainer.setOpacity(0);
				
		// Get dimensions of photo
		var wNew = photoWidthArray[photoId];
		var hNew = photoHeightArray[photoId];
		
		// Start tween on a delay
		setTimeout('API.Container.tweenTo(easeInQuad, [API.Container.getWidth()-borderSize, API.Container.getHeight()-borderSize], ['+wNew+','+hNew+'], 7)',500);
		
		// Set source, width, and height of new photo
		document.getElementById('Photo').src = photoDir + photoArray[photoId];
		document.getElementById('Photo').width = wNew;
		document.getElementById('Photo').height = hNew;
		document.getElementById('NextLink').href = "#" + (photoId+1);
		document.getElementById('Caption').innerHTML = captionArray[photoId];
		document.getElementById('Counter').innerHTML = (photoId+1)+' of '+photoNum;
		
		// Advance counter to next photo
		advancePhoto();
	//	t = setTimeout('nextPhoto()', 4500)
	}
	StopShow = function() { clearTimeout(this.t);
	}
	function changeFilter(filter){
	if(!document.getElementById('Photo').style.filter){ alert('This feature only works on Explorer5.5 + '); return}
	document.getElementById('Photo').style.filter=filter
	
}
	// ]]>
