// <![CDATA[
	
	// -----------------------------------------------------------------------------------
	// 
	// This page coded by Scott Upton
	// http://www.uptonic.com | http://www.couloir.org
	//
	// This work is licensed under a Creative Commons License
	// Attribution-ShareAlike 2.0
	// http://creativecommons.org/licenses/by-sa/2.0/
	//
	// Associated API copyright 2002, Travis Beckham (www.squidfingers.com)
	//
	// -----------------------------------------------------------------------------------
	// --- version date: 04/30/05 ------------------------------------------------------
	
	var photoDir = "gallery/"; // Location of photos for gallery
	var borderSize = 6;	 // = 2x CSS border size
	
	// 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 to 0
	photoId = (!photoId)? 0:photoId;
		
	// Define each photo's name, height, width, and caption
	var photoArray = new Array(
		// Source, Width, Height, Caption
		
new Array("004.jpg" , "400" , "300" , "Friday Night Praise & Worship<br> Click on the image to view previous or next image"),
new Array("014.jpg" , "400" , "300" , "Sweatin' In The Spirit"),
new Array("025.jpg" , "400" , "300" , "Friday Night Praise & Worship"),
new Array("027.jpg" , "400" , "300" , "Friday Night Praise & Worship"),
new Array("033.jpg" , "400" , "533" , "Gifts for All"),
new Array("044.jpg" , "400" , "300" , "The Queen Within - Poetry"),
new Array("053.jpg" , "400" , "300" , "Friday Praise & Worship Service"),
new Array("056.jpg" , "400" , "300" , "Bryn Mawr Hospital Vendor and Attendees"),
new Array("068.jpg" , "400" , "300" , "Jewelry Vendor and Attendees"),
new Array("088.jpg" , "400" , "300" , "Friday Night Dinner"),
new Array("085.jpg" , "400" , "533" , "Janis Ruise Ministering"),
new Array("095.jpg" , "400" , "300" , "Minister of Music"),
new Array("099.jpg" , "400" , "533" , "Financial Workshop"),
new Array("100.jpg" , "400" , "300" , "Teenage Workshop"),
new Array("107.jpg" , "400" , "300" , "Workshop"),
new Array("109.jpg" , "400" , "300" , "Medial Workshop"),
new Array("112.jpg" , "400" , "300" , "Saturday's Panelist"),
new Array("114.jpg" , "400" , "533" , "Janis Ruise Ministries Banner"),
new Array("115.jpg" , "400" , "300" , "Saturday's Luncheon"),
new Array("116.jpg" , "400" , "300" , "Saturday's Luncheon"),
new Array("117.jpg" , "400" , "300" , "Saturday's Luncheon"),
new Array("118.jpg" , "400" , "300" , "Saturday's Luncheon"),
new Array("123.jpg" , "400" , "300" , "Saturday's Praise Party"),
new Array("126.jpg" , "400" , "300" , "Prayer Chapel Praise Dancers"),
new Array("136.jpg" , "400" , "300" , "Saturday's Praise Party"),
new Array("WorshipService2008WC.jpg", "400", "300", "2008 Women's Conference Worship Service. Mothers and Daughters embrace."),
new Array("SweatingintheSpirit2008WC.jpg", "400", "300", "2008 Women's Conference. Sweatin in the Spirit."),            
new Array("012_12-a.jpg", "460", "280", "2006 Women's Conference Worship Service."),                         
new Array("016_16-a.jpg", "473", "260", "2006 Women's Conference Worship Service."),                        
new Array("042_42-a.jpg", "480", "311", "2006 Women's Conference Worship Service."),                       
new Array("061_61-1-a.jpg", "400", "200", "2006 Women's Conference Worship Service."),                               
new Array("Janis-Ruise-PM-a.gif", "300", "400", "2008 Porter Memorial Annual Women's Day Service- Jersey City, NJ"),            
new Array("Janis-Ruise-PM2-a.gif", "400", "267", "2008 Porter Memorial Annual Women's Day Service- Jersey City, NJ.  Evangelist Ruise, Committee of Three and First Lady, Narcissus Porter."),            
new Array("Janis-Ruise-PM3-a.gif", "400", "266", "Porter Memorial Annual Women's Day Service- Jersey City, NJ.  Evangelist Ruise, Pastor Nathaniel W. Porter and First Lady, Narcissus Porter."),            
new Array("Janis-Ruise-PM4-a.gif", "400", "300", "Porter Memorial Annual Women's Day Service- Jersey City, NJ.  Evangelist Ruise and Pastor Nathaniel W. Porter."),
new Array("DSCF2764.gif", "400", "385", "Mountiantop Revival, Jersey City, New Jersey"),
new Array("DSCF2772.gif", "400", "659", "Mountiantop Revival, Jersey City, New Jersey"),
new Array("DSCF2971.gif", "400", "358", "OWSEOG Conference, Pocono Mountains, Pennsylvania"),
new Array("DSCF2973.gif", "400", "461", "OWSEOG Conference, Pocono Mountains, Pennsylvania"),
new Array("DSCN1169.jpg", "400", "510", "2008 Beauty Today Ministries Women's Conference, Atlanta Georgia"),
new Array("DSCN1178.gif", "400", "377", "2008 Beauty Today Ministries Women's Conference, Atlanta Georgia"),
new Array("DSCN1180.gif", "400", "387", "2008 Beauty Today Ministries Women's Conference, Atlanta Georgia"),
new Array("DSCN1182.gif", "400", "517", "2008 Beauty Today Ministries Women's Conference, Atlanta Georgia"),
new Array("DSCN1192.jpg", "400", "210", "2008 Beauty Today Ministries Women's Conference, Atlanta Georgia"),
new Array("DSCF3083.jpg", "400", "270", "2008 Annual Women's Conference"),
new Array("DSCF3085.jpg", "400", "239", "2008 Annual Women's Conference"),
new Array("DSCF3087.jpg", "400", "300", "2008 Annual Women's Conference"),
new Array("DSCF3088.jpg", "400", "286", "2008 Annual Women's Conference"),
new Array("DSCF3095.jpg", "400", "250", "2008 Annual Women's Conference"),
new Array("DSCF3096.jpg", "400", "245", "2008 Annual Women's Conference"),
new Array("DSCF3120.jpg", "400", "353", "2008 Annual Women's Conference"),
new Array("DSCF3138.jpg", "400", "300", "2008 Annual Women's Conference"),
new Array("DSCF3141.jpg", "400", "300", "2008 Annual Women's Conference"),
new Array("DSCF3161.jpg", "400", "300", "2008 Annual Women's Conference"),
new Array("DSCF3171.jpg", "400", "300", "2008 Annual Women's Conference"),
new Array("DSCF3195.jpg", "400", "230", "2008 Annual Women's Conference"),
new Array("DSCF3202.jpg", "400", "235", "2008 Annual Women's Conference")

);
	
	// Number of photos in this gallery
	var photoNum = photoArray.length;
	
	// Create access to 'Detect' object and a place to put instances of 'HTMLobj'
	API = new Detect();
	
	// CREATE INSTANCES & LOAD
	loadAPI = function(){
		// Instantiate HTMLobj
		API.Gallery		= new HTMLobj('Gallery');
		API.Photo			= new HTMLobj('Photo');
		API.PhotoGallery	= new HTMLobj('PhotoGallery');
		API.LinkGallery	= new HTMLobj('LinkGallery');
		API.PrevLink		= new HTMLobj('PrevLink');
		API.NextLink		= new HTMLobj('NextLink');
		API.CaptionBlock	= new HTMLobj('CaptionBlock');
		API.Counter			= new HTMLobj('Counter');
		API.Caption			= new HTMLobj('Caption');
		API.LoadImg			= new HTMLobj('LoadImg');
		
		// Show initial photo
		cyclePhoto(photoId);
	}
	onload = loadAPI;
	
	// Fade in photo when it is loaded from the server
	initFade = function(){
		// Show PhotoGallery again
		API.PhotoGallery.show();
		
		// 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.Gallery._tweenRunning == false){
				clearInterval(fade_timer);
				
				// Be certain fade is done running before allowing next/previous links to work
				// This avoids rapid fade-in when users click next/previous links in quick succession
				var adv_timer = setInterval('permitNextPrev()', 500);
				
				// Permit next/previous links to function normally when fade is completed
				permitNextPrev = function(){
					if(API.Photo._fadeRunning == false){
						clearInterval(adv_timer);
						
						// Only show links if there is more than one photo in array
						if(photoNum > 1){
							API.LinkGallery.displayShow();
							document.getElementById('NextLink').onclick = nextPhoto;
							document.getElementById('PrevLink').onclick = prevPhoto;
						}
					} else {
						return;
					}
				}
				// Swap out loading animation to spare CPU cycles when hidden anyway
				API.LoadImg.setSrc("gallery/slideshow/start.gif");
				
				// Show caption again
				API.CaptionBlock.show();
				
				// Fade photo in
				API.Photo.fadeIn(0,15,33);
			} else {
				return;
			}
		}
	}
	
	// Prevent next/previous
	falsify = function(){
		return false;
	}
	
	// Go to next photo
	nextPhoto = function(){
		// Go to next photo
		if(photoId == (photoArray.length - 1)){
			photoId = 0;
		} else {
			photoId++;
		}
		cyclePhoto(photoId);
	}
	
	// Go to previous photo
	prevPhoto = function(){
		// If at start, go back to end
		if(photoId == 0){
			photoId = photoArray.length - 1;
		} else {
			photoId--;
		}
		cyclePhoto(photoId);
	}
	
	// Alter class of elements
	changeElementClass = function(objId,setClass) {
		document.getElementById(objId).className = setClass;
	}
	
	// Function to load subsequent photos in gallery
	cyclePhoto = function(photoId){
				
		// Swap in loading animation
		API.LoadImg.setSrc("gallery/slideshow/loading-dove.gif");
		
		// Hide link Gallery if it is not already hidden
		API.LinkGallery.displayHide();
		
		// Hide photo Gallery and caption temporarily
		API.Photo.hide();
		API.Photo.setOpacity(0);
		API.CaptionBlock.hide();
		
		// Get dimensions of photo
		var wNew = photoArray[photoId][1];
		var hNew = photoArray[photoId][2];
		
		// Start tween on a delay
		var wCur = API.Gallery.getWidth() - borderSize;
		var hCur = API.Gallery.getHeight() - borderSize;
		
		// Begin tweening on a short timer
		setTimeout('API.Gallery.tweenTo(easeInQuad, ['+wCur+', '+hCur+'], ['+wNew+','+hNew+'], 7)',500);
		setTimeout('API.LinkGallery.sizeTo('+wNew+','+hNew+')',500);
		setTimeout('API.PrevLink.sizeTo('+wNew/2+','+hNew+')',500);
		setTimeout('API.NextLink.sizeTo('+wNew/2+','+hNew+')',500);
		setTimeout('API.CaptionBlock.sizeTo('+wNew+',18)',500);
		
		// Get new photo source
		var newPhoto = photoDir + photoArray[photoId][0];
		
		// Set source, width, and height of new photo
		API.Photo.setSrc(newPhoto);		
		API.Photo.sizeTo(wNew,hNew);
		
		// Set links to new targets based on photoId
		API.NextLink.setHref("#" + (photoId+1));
		API.PrevLink.setHref("#" + (photoId+1));
		API.Counter.setInnerHtml((photoId+1)+" of "+photoNum+" |");
		API.Caption.setInnerHtml(photoArray[photoId][3]);
		
		// Event listeners for onload and onclick events
		document.getElementById('Photo').onload = initFade;
		
		// Block next/previous links until permitNextPrev() has fired
		document.getElementById('NextLink').onclick = falsify;
		document.getElementById('PrevLink').onclick = falsify;
	}
	// ]]>