/***************************************************************************
* Create a photo object                                                    *
***************************************************************************/
function photo(id, galleries_id, photo_ref, section_code, src, width, height, caption, thumbnail, thumbnail_width, thumbnail_height, home, gallery, description, takendate, photographer, location) {
	this.id = id;
	this.galleries_id = galleries_id;
	this.photo_ref = photo_ref;
	this.section_code = section_code;
	this.src = src;
	this.width = width;
	this.height = height;
	this.caption = caption;
	this.thumbnail = thumbnail;
	this.thumbnail_width = thumbnail_width;
	this.thumbnail_height = thumbnail_height;
	this.home = home;
	this.gallery = gallery;
	this.description = description;
	this.takendate = takendate;
	this.photographer = photographer;
	this.location = location;
}
/***************************************************************************
* Create a gallery object                                                  *
***************************************************************************/

function gallery(id,featured_images,title,section_code) {
	this.id = id;
	this.featured_images = featured_images;
	this.title = title;
	this.section_code = section_code;}

/***************************************************************************
* Select a random value from a comma separated list                        *
***************************************************************************/
function randomListVal(list) {
	arrayVals = list.split(',');
	pos=  Math.round(Math.random() * (arrayVals.length - 1));
	debug('Returning ' + arrayVals[pos] + ' as random image');
	return arrayVals[pos];
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {

	imageID = randomListVal('408676,380969,380960,376710,376709,376708,376707,376706,376705,376704,376703,376702,376701,376699,368556,368555,368553,368545,365870,365866,365864,365861,365858,365857,365848,365843,365842,365841,365840,365839,361419,361418,361417,361415,361414,361413,361410,361409,361408,361407,360087,360081,360076,360074,360072,360071,360070,360069,360068,360067');
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			if (!basic) {
			img.src = 'images/' + photos[j].src;
			img.width = photos[j].width;
			img.height = photos[j].height;
			}
			else {
				newImage = new Image(photos[j].width,photos[j].height);
				newImage.src = 'images/' + photos[j].src;
				document.images[img.name] = newImage;
				debug(newImage.src);
			}
			break;
		}
	}
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline() {
	
	imageID = randomListVal('408676,380969,380960,376710,376709,376708,376707,376706,376705,376704,376703,376702,376701,376699,368556,368555,368553,368545,365870,365866,365864,365861,365858,365857,365848,365843,365842,365841,365840,365839,361419,361418,361417,361415,361414,361413,361410,361409,361408,361407,360087,360081,360076,360074,360072,360071,360070,360069,360068,360067');
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			if (photos[j].galleries_id != '') {
						document.write('<a href="' + photos[j].section_code + '_' + photos[j].galleries_id + '.html">');
						}
						else {
						document.write('<a href="gallery.html">');
						}
			document.write('<img src="images/' + photos[j].src + '" width="' + photos[j].width + '" height="' + photos[j].height + '" class="mainhomepageimage" id="mainSample" name="mainSample" alt="' + photos[j].caption  + '" border="0">');
			document.write('</a>');
			break;
		}
	}
	
}

/***************************************************************************
* Show the next image in a gallery.  field = hidden field containing       *
* image_id                                                                 *
*  img = reference to image object in which to show image                  *
***************************************************************************/
function next(field,img) {

	debug('IN next');
	imageID = field.value;
	
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			break;
		}
	}
	debug('image is ' + j);
	nextImg = -1;
	k= j + 1;
	while (nextImg < 0) {
		for (; k < photos.length; k++) {
			debug('testing image ' + k + ': gallery = ' + photos[k].galleries_id + '(existing: ' + photos[j].galleries_id + ')');
			if (photos[k].galleries_id == photos[j].galleries_id) {
				nextImg = k;
				debug('setting  nextImg = ' + k);
				break;
			}
		}
		if (nextImg == -1) {
			k = 0;
		}
	}
	if (nextImg != -1) {
		updateImage(nextImg, field,img);
	}


}


/***************************************************************************
* Set a new image on the gallery detail page given its array position      *
***************************************************************************/
function updateImage (nextImg, field,img) {
	debug('Updating image');
	if (!basic && !(0)) {
		debug('In updateImage');
		debug('setting  img src = ' + photos[nextImg].src);
		
					
						document.getElementById('imagePhoto').innerHTML = '<img class="mainphoto" src="images/' + photos[nextImg].src + ' " id="mainPic" name="mainPic" width="' + photos[nextImg].width + '" height="' + photos[nextImg].height + '" alt="' + photos[nextImg].caption + '" border="0">';
						field.value = photos[nextImg].id;
			document.getElementById('imageTitle').innerHTML = photos[nextImg].caption;
			temp = '';
			if (photos[nextImg].description != '') {
				temp = temp +  '<p id="imageDescription">' + photos[nextImg].description + '</p>';
			}
			if (photos[nextImg].photo_ref != '') {
				temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + photos[nextImg].photo_ref + '</p>';
			}
			if (photos[nextImg].takendate != '') {
				debug('Resetting taken date');
				temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + photos[nextImg].takendate + '</p>';
			}
			
			if (photos[nextImg].location != '') {
				debug('Resetting location');
				temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  photos[nextImg].location + '</p>';
			}
			
			if (photos[nextImg].photographer != '') {
				debug('Resetting photographer');
				temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + photos[nextImg].photographer + '</p>';
			}
			if (temp != '') {				temp = temp + '<div class="spacer"></div>';			}					if (temp == '') {
			document.getElementById('imageDetails').style.visibility = 'hidden';
		}
		else {
			document.getElementById('imageDetails').style.visibility = 'visible';
		}
		document.getElementById('imageDetails').innerHTML =temp;	
		
	}
	else {
		debug('Redirecting to id ' + photos[nextImg].id);
		window.location = 'photo_' + photos[nextImg].id + '.html';
	}
}

/***************************************************************************
* Show the previous image for a gallery. field = hidden field containing   *
* image_id                                                                 *
*  img = reference to image object in which to show image                  *
***************************************************************************/
function previous(field,img) {

	
	imageID = field.value;
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			break;
		}
	}
	debug('image is ' + j);
	nextImg = -1;
	k= j  -1;
	while (nextImg < 0) {
		for (; k >= 0; k--) {
			if (photos[k].galleries_id == photos[j].galleries_id) {
				nextImg = k;
				break;
			}
		}
		if (nextImg == -1) {
			k = photos.length -1;
		}
	}
	if (nextImg != -1) {
		updateImage(nextImg, field,img);	
	}
}

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.
        *
* Gallery_id = id of gallery to choose                                     *
* 
 img = reference to html image                                       *
* in which to show image                                                   *
***************************************************************************/
function showGalleryImage(gallery_id, img) {
	debug('Image = ' + gallery_id);
	for (i = 0; i < galleries.length; i++) {
		if (galleries[i].id == gallery_id) {
			imageID = randomListVal(galleries[i].featured_images);
				for (j = 0; j < photos.length; j++) {
					if (photos[j].id == imageID) {
						
						img.src = 'images/' + photos[j].thumbnail;
						img.width = photos[j].thumbnail_width;
						img.height = photos[j].thumbnail_height;
						
						break;
					}
				}
			break;
		}
	} 
	}

/***************************************************************************
* If we have dynamic HTML                                                  *
*  replace the galleries link with a list that                             *
* doesn't include the current gallery                                      *
***************************************************************************/
function showGalleries(gallery_id) {
	debug('Showing links for gallery ' + gallery_id);
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
			debug('Testing gallery ' + galleries[i].id);
			
			if (galleries[i].id != gallery_id) {
				debug('Adding link');
				if (temp != '') {
					temp = temp + ' | ';
				}
				temp = temp + '<a href="gallery_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}
/***************************************************************************
* Create the array of Photo objects                                        *
***************************************************************************/
photos = new Array();
photos[0] = new photo(297629,'25901','','gallery','Coral crab.jpg',400,267,'Red Coral Crab','Coral crab_thumb.jpg',130, 87,0, 0,'Red Coral Crab','','','UAE');
photos[1] = new photo(297634,'25901','','gallery','Batfish1.jpg',400,591,'Batfish in sunlight','Batfish1_thumb.jpg',130, 192,0, 0,'Batfish','','UAE','');
photos[2] = new photo(298879,'25901','','gallery','Lionfish on coral wild angle.jpg',250,358,'Lionfish on reef','Lionfish on coral wild angle_thumb.jpg',130, 186,0, 0,'Lionfish on reef ','','','UAE');
photos[3] = new photo(298882,'25901','','gallery','Lionfish profile.jpg',400,285,'Lionfish in profile','Lionfish profile_thumb.jpg',130, 93,0, 0,'Lionfish in profile','','','UAE');
photos[4] = new photo(299236,'25901','','gallery','Moray in pipe 1.jpg',400,572,'Moray eel in pipe','Moray in pipe 1_thumb.jpg',130, 186,0, 0,'Moray eel in pipe','','','');
photos[5] = new photo(299255,'25901','','gallery','Razor fish.jpg',400,572,'Razorfish/Shrimpfish','Razor fish_thumb.jpg',130, 186,0, 0,'Razorfish in sunlight','','','UAE');
photos[6] = new photo(299285,'25901','','gallery','Snowflake moray.jpg',400,317,'Snowflake moray with cleaner shrimps','Snowflake moray_thumb.jpg',130, 103,0, 0,'Snowflake moray and shrimps','','','UAE');
photos[7] = new photo(300429,'25901','','gallery','School of fish.jpg',400,267,'School of trevally','School of fish_thumb.jpg',130, 87,0, 0,'School of trevally<br>\n','','','UAE');
photos[8] = new photo(300432,'25901','','gallery','Soft Coral.jpg',400,446,'Soft coral','Soft Coral_thumb.jpg',130, 145,0, 0,'Soft coral','','','UAE');
photos[9] = new photo(357491,'25901','','gallery','Ep Boxfish .jpg',400,281,'Boxfish','Ep Boxfish _thumb.jpg',130, 91,0, 0,'','','','UAE');
photos[10] = new photo(360067,'25901','','gallery','Goby on whip coral AB.jpg',400,249,'Goby on whip coral','Goby on whip coral AB_thumb.jpg',130, 81,0, 0,'','','','UAE');
photos[11] = new photo(360068,'25901','','gallery','Seascape with turtle AB.jpg',400,579,'Seascape with turtle','Seascape with turtle AB_thumb.jpg',130, 188,0, 0,'','','','');
photos[12] = new photo(360071,'25901','','gallery','turtle 3 copyAB1.jpg',400,316,'Green turtle overhead','turtle 3 copyAB1_thumb.jpg',130, 103,0, 0,'','','','');
photos[13] = new photo(360076,'25901','','gallery','Ep hermit crab AB2.jpg',400,276,'Hermit crab','Ep hermit crab AB2_thumb.jpg',130, 90,0, 0,'','','','');
photos[14] = new photo(365864,'25901','','gallery','Squatlobster D.jpg',400,260,'Squat lobster','Squatlobster D_thumb.jpg',130, 85,0, 0,'','','','UAE');
photos[15] = new photo(376706,'25901','','gallery','Ep Moray 171.jpg',400,280,'Large moray eel at home','Ep Moray 171_thumb.jpg',130, 91,0, 0,'','','','UAE');
photos[16] = new photo(376709,'25901','','gallery','Moray F1.jpg',400,338,'Moray eel at home','Moray F1_thumb.jpg',130, 110,0, 0,'','','','UAE');
photos[17] = new photo(297632,'20655','','gallery','Diver and coral 1.jpg',400,609,'Diver and fan coral','Diver and coral 1_thumb.jpg',130, 198,0, 0,'Diver ','','','Philippines');
photos[18] = new photo(298188,'20655','','gallery','Diver and coral 2.jpg',400,591,'Diver and crinoid','Diver and coral 2_thumb.jpg',130, 192,0, 0,'','','','Philippines');
photos[19] = new photo(298192,'20655','','gallery','Diver and coral 3.jpg',274,400,'Diver and soft coral','Diver and coral 3_thumb.jpg',130, 190,0, 0,'','','','Philippines');
photos[20] = new photo(298196,'20655','','gallery','Diver and coral 4.jpg',400,616,'Diver and soft red coral','Diver and coral 4_thumb.jpg',130, 200,0, 0,'','','','Philippines');
photos[21] = new photo(298208,'20655','','gallery','Diver on wreck 1.jpg',400,600,'Diver on wreck - Bonaire','Diver on wreck 1_thumb.jpg',130, 195,0, 0,'','','','Bonaire');
photos[22] = new photo(298209,'20655','','gallery','Diver on wreck 2.jpg',400,312,'Diver on wreck ','Diver on wreck 2_thumb.jpg',130, 101,0, 0,'Diver on wreck','','','Bonaire');
photos[23] = new photo(297561,'25900','','gallery','Banded Shrimp.jpg',400,333,'Banded Shrimp','Banded Shrimp_thumb.jpg',130, 108,0, 0,'','','','');
photos[24] = new photo(297628,'25900','','gallery','Clownfish 1.jpg',400,522,'Clownfish','Clownfish 1_thumb.jpg',130, 170,0, 0,'Clownfish','','','Maldives');
photos[25] = new photo(297630,'25900','','gallery','Christmas tree worm.jpg',400,535,'Christmas tree worm','Christmas tree worm_thumb.jpg',130, 174,0, 0,'Christmas tree worm','','','Philippines');
photos[26] = new photo(298201,'25900','','gallery','Diver and seahorse.jpg',400,269,'Diver and seahorse','Diver and seahorse_thumb.jpg',130, 87,0, 0,'','','','UAE');
photos[27] = new photo(298240,'25900','','gallery','Catfish2.jpg',400,267,'Catfish seek protection in numbers','Catfish2_thumb.jpg',130, 87,0, 0,'Catfish','','','UAE');
photos[28] = new photo(298252,'25900','','gallery','Frogfish1.jpg',400,540,'Commerson\'s frogfish','Frogfish1_thumb.jpg',130, 176,0, 0,'','','','Suluwesi Indonesia');
photos[29] = new photo(298253,'25900','','gallery','Frogfish in pofile.jpg',400,538,'Frogfish in profile','Frogfish in pofile_thumb.jpg',130, 175,0, 0,'Frogfish in profile','','','');
photos[30] = new photo(298268,'25900','','gallery','Frogfish in profile 21.jpg',400,607,'Frogfish','Frogfish in profile 21_thumb.jpg',130, 197,0, 0,'','','','Suluwesi');
photos[31] = new photo(298272,'25900','','gallery','Frogfish in profile 1.jpg',400,306,'Frogfish in ambush','Frogfish in profile 1_thumb.jpg',130, 99,0, 0,'Frogfish in ambush','','','UAE');
photos[32] = new photo(298870,'25900','','gallery','Jawfish with eggs.jpg',400,303,'Jawfish with eggs in mouth','Jawfish with eggs_thumb.jpg',130, 98,0, 0,'Jawfish with eggs','','','UAE');
photos[33] = new photo(298872,'25900','','gallery','Lionfish close up.jpg',400,286,'Lionfish close up','Lionfish close up_thumb.jpg',130, 93,0, 0,'Lionfish close up','','','UAE');
photos[34] = new photo(299226,'25900','','gallery','Mantis shrimp1.jpg',400,321,'Mantis Shrimp','Mantis shrimp1_thumb.jpg',130, 104,0, 0,'','','','Philippines');
photos[35] = new photo(299239,'25900','','gallery','Parrotfish.jpg',400,615,'Parrot fish','Parrotfish_thumb.jpg',130, 200,0, 0,'Parrot fish close up','','','Maldives');
photos[36] = new photo(299249,'25900','','gallery','Pipefish.jpg',400,574,'Pipefish ','Pipefish_thumb.jpg',130, 187,0, 0,'Close up of pipefish on soft coral','','','UAE');
photos[37] = new photo(299250,'25900','','gallery','Pufferfish close up.jpg',400,296,'Pufferfish - full face','Pufferfish close up_thumb.jpg',130, 96,0, 0,'Pufferfish face on','','','UAE');
photos[38] = new photo(299283,'25900','','gallery','Shrimp on seastar.jpg',400,261,'Banded shrimp on pincushion seastar','Shrimp on seastar_thumb.jpg',130, 85,0, 0,'Banded shrimp on pincushion seastar','','','UAE');
photos[39] = new photo(299288,'25900','','gallery','Stonefish.jpg',400,510,'Stonefish waiting for dinner','Stonefish_thumb.jpg',130, 166,0, 0,'Stonefish','','','Maldives');
photos[40] = new photo(300435,'25900','','gallery','Squat lobster.jpg',400,555,'Squatlobster on crinoid ','Squat lobster_thumb.jpg',130, 180,0, 0,'Squatlobster on crinoid ','','','UAE');
photos[41] = new photo(300441,'25900','','gallery','Triggerfish1.jpg',400,542,'Triggerfish up close','Triggerfish1_thumb.jpg',130, 176,0, 0,'Triggerfish up close','','','Maldives');
photos[42] = new photo(360074,'25900','','gallery','Ep Blenny in pipe AB1.jpg',400,287,'Blenny in pipe','Ep Blenny in pipe AB1_thumb.jpg',130, 93,0, 0,'','','','UAE');
photos[43] = new photo(297636,'25902','','gallery','Clownfish and anenome 1.jpg',400,537,'Clownfish and anenomes ','Clownfish and anenome 1_thumb.jpg',130, 175,0, 0,'','','jeff collett','Maldives');
photos[44] = new photo(297641,'25902','','gallery','Clownfish in anenome.jpg',400,275,'Clownfish in protective anenome','Clownfish in anenome_thumb.jpg',130, 89,0, 0,'','','','Maldives');
photos[45] = new photo(297646,'25902','','gallery','Coral reef scene1.jpg',400,535,'Coral reef','Coral reef scene1_thumb.jpg',130, 174,0, 0,'','','','Philippines');
photos[46] = new photo(299230,'25902','','gallery','Moorish Idols.jpg',400,508,'Moorish Idols','Moorish Idols_thumb.jpg',130, 165,0, 0,'Moorish Idols','','','Maldives');
photos[47] = new photo(299280,'25902','','gallery','Seastar and glassfish.jpg',300,538,'Seastar and glassfish','Seastar and glassfish_thumb.jpg',130, 233,0, 0,'Seastar and glassfish','','','Philippines');
photos[48] = new photo(300431,'25902','','gallery','School of Sweetlips.jpg',400,291,'School of sweetlips','School of Sweetlips_thumb.jpg',130, 95,0, 0,'School of sweetlips','','','Maldives');
photos[49] = new photo(300433,'25902','','gallery','Soldier fish.jpg',400,293,'Soldier fish shelter on the reef ','Soldier fish_thumb.jpg',130, 95,0, 0,'Soldier fish','','','MAldives');
photos[50] = new photo(300436,'25902','','gallery','Sweetlips.jpg',400,492,'Schooling sweetlips','Sweetlips_thumb.jpg',130, 160,0, 0,'Schooling sweetlips','','','Maldives');
photos[51] = new photo(300439,'25902','','gallery','Triggerfish.jpg',400,633,'Triggerfish aerating eggs','Triggerfish_thumb.jpg',130, 206,0, 0,'Triggerfish aerating eggs','','','Maldives');
photos[52] = new photo(356539,'25902','','gallery','Moorish Idol.jpg',400,278,'Moorish idol','Moorish Idol_thumb.jpg',130, 90,0, 0,'','','','Maldives');
photos[53] = new photo(357761,'25902','','gallery','Ribbon Eel 2 copy.jpg',400,458,'Ribbon eel','Ribbon Eel 2 copy_thumb.jpg',130, 149,0, 0,'','','','');
photos[54] = new photo(360070,'25902','','gallery','turtle faceAB.jpg',400,283,'Timid turtle ','turtle faceAB_thumb.jpg',130, 92,0, 0,'','','','UAE');
photos[55] = new photo(360072,'25902','','gallery','Triggerfish head on 1AB1.jpg',400,459,'Agressive triggerfish','Triggerfish head on 1AB1_thumb.jpg',130, 149,0, 0,'','','','');
photos[56] = new photo(360081,'25902','','gallery','Ep Harlequin shrimp AB3.jpg',400,284,'Harlequin shrimp','Ep Harlequin shrimp AB3_thumb.jpg',130, 92,0, 0,'','','','');
photos[57] = new photo(360087,'25902','','gallery','Shy Clownfish AB.jpg',400,490,'Shy clownfish','Shy Clownfish AB_thumb.jpg',130, 159,0, 0,'','','','');
photos[58] = new photo(361413,'25902','','gallery','Ep Cuttlefish 1C.jpg',400,275,'Cuttlefish','Ep Cuttlefish 1C_thumb.jpg',130, 89,0, 0,'','','','');
photos[59] = new photo(361414,'25902','','gallery','Needlefish 1 C.jpg',400,259,'Needlefish','Needlefish 1 C_thumb.jpg',130, 84,0, 0,'','','','');
photos[60] = new photo(365840,'25902','','gallery','App0372 D1.jpg',400,600,'Christmas tree worm','App0372 D1_thumb.jpg',130, 195,0, 0,'','','','Philippines');
photos[61] = new photo(365843,'25902','','gallery','Frogfish D.jpg',400,565,'Commerson\'s frogfish','Frogfish D_thumb.jpg',130, 184,0, 0,'','','','Philippines');
photos[62] = new photo(365861,'25902','','gallery','Soldierfish copyD.jpg',400,334,'Soldierfish','Soldierfish copyD_thumb.jpg',130, 109,0, 0,'','','','Maldives');
photos[63] = new photo(365870,'25902','','gallery','Lionfish D1.jpg',400,537,'Lionfish hovers over the reef','Lionfish D1_thumb.jpg',130, 175,0, 0,'','','','Philippines');
photos[64] = new photo(368556,'25902','','gallery','Goby in pipeE2.jpg',400,374,'Blenny at home','Goby in pipeE2_thumb.jpg',130, 122,0, 0,'','','','Maldives');
photos[65] = new photo(376701,'25902','','gallery','Clownfish and anenome F1.jpg',400,428,'Clownfish and anenome','Clownfish and anenome F1_thumb.jpg',130, 139,0, 0,'','','','Maldives');
photos[66] = new photo(376703,'25902','','gallery','Sweetlips 2 F.jpg',400,394,'Sweetlips','Sweetlips 2 F_thumb.jpg',130, 128,0, 0,'','','','Maldives');
photos[67] = new photo(376705,'25902','','gallery','Maldives anenomeF.jpg',400,595,'Anenome and turtle','Maldives anenomeF_thumb.jpg',130, 193,0, 0,'','','','Maldives');
photos[68] = new photo(376708,'25902','','gallery','Hawkfish F2.jpg',400,288,'Longnosed hawkfish','Hawkfish F2_thumb.jpg',130, 94,0, 0,'','','','Maldives');
photos[69] = new photo(376710,'25902','','gallery','Cave & Lionfish F1.jpg',400,600,'Lionfish in search of prey','Cave & Lionfish F1_thumb.jpg',130, 195,0, 0,'','','','Philippines');
photos[70] = new photo(297617,'25904','','gallery','Diver in silouette 2.jpg',400,629,'Underwater photographer','Diver in silouette 2_thumb.jpg',130, 204,0, 0,'Taking photographs','','','Philippines');
photos[71] = new photo(297643,'25904','','gallery','Coral and lionfish in silouette.jpg',400,511,'Lionfish in silhouette','Coral and lionfish in silouette_thumb.jpg',130, 166,0, 0,'','','','Philippines');
photos[72] = new photo(357685,'25904','','gallery','Diver in silouette1.jpg',400,497,'Diver in silouette','Diver in silouette1_thumb.jpg',130, 162,0, 0,'','','','');
photos[73] = new photo(361415,'25904','','gallery','Turtle silhoutte 1C.jpg',400,544,'Turtle silhouette','Turtle silhoutte 1C_thumb.jpg',130, 177,0, 0,'','','','');
photos[74] = new photo(380960,'25904','','gallery','Ep Seahorse silhouetteF.jpg',400,267,'Seahorse silhouette','Ep Seahorse silhouetteF_thumb.jpg',130, 87,0, 0,'','','','UAE');
photos[75] = new photo(300423,'25908','','gallery','Nudibranch 1.jpg',400,244,'Nudibranches (Risbecia pulchella)','Nudibranch 1_thumb.jpg',130, 79,0, 0,'Chromadoris annulata','','','UAE');
photos[76] = new photo(300424,'25908','','gallery','Nudibranch 2.jpg',400,306,'Nudibranch (Hypselodoris bullockii)','Nudibranch 2_thumb.jpg',130, 99,0, 0,'Nudibranch 1','','','Sulawesi');
photos[77] = new photo(300425,'25908','','gallery','Nudibranch 3.jpg',400,300,'Nudibranch(Nembrotha cristata)','Nudibranch 3_thumb.jpg',130, 98,0, 0,'Nudibranch 2','','','Philippines');
photos[78] = new photo(300426,'25908','','gallery','Nudibranch 4.jpg',400,295,'Nudibranch (Chromodoris lochi) ','Nudibranch 4_thumb.jpg',130, 96,0, 0,'Nudibranch 3','','','Maldives');
photos[79] = new photo(300427,'25908','','gallery','Nudibranch 5.jpg',400,248,'Nudibranch(Risbecia sp)','Nudibranch 5_thumb.jpg',130, 81,0, 0,'Nudibranch ','','','UAE');
photos[80] = new photo(300428,'25908','','gallery','Nudibranch 6.jpg',400,256,'Nudibranch(Nembrotha purpureolineata) ','Nudibranch 6_thumb.jpg',130, 83,0, 0,'Nudibranch 5','','','Philippines');
photos[81] = new photo(357635,'25908','','gallery','Ep Nudi1.jpg',400,319,'Nudibranch (Chromodoris lochi)','Ep Nudi1_thumb.jpg',130, 104,0, 0,'','','','Philippines');
photos[82] = new photo(361418,'25908','','gallery','Nudi 2C2.jpg',400,278,'Nudibranch (Chromodoris annulata)','Nudi 2C2_thumb.jpg',130, 90,0, 0,'','','','');
photos[83] = new photo(361419,'25908','','gallery','nudi4C3.jpg',400,258,'Nudibranch(Nembrotha purpureolineata) ','nudi4C3_thumb.jpg',130, 84,0, 0,'','','','Philippines');
photos[84] = new photo(300442,'25905','','gallery','Turtle 1.jpg',400,267,'Green turtle','Turtle 1_thumb.jpg',130, 87,0, 0,'Green turtle','','','Maldives');
photos[85] = new photo(300443,'25905','','gallery','Turtle 2.jpg',400,336,'Green turtle up close (Chelonia mydas)','Turtle 2_thumb.jpg',130, 109,0, 0,'','','','Sipidan');
photos[86] = new photo(300446,'25905','','gallery','Turtle 3.jpg',400,489,'Green turtles (Chelonia mydas)','Turtle 3_thumb.jpg',130, 159,0, 0,'Green turtles','','','Sipidan');
photos[87] = new photo(300447,'25905','','gallery','Turtle 4.jpg',400,273,'Green turtle (Chelonia mydas) under the sun','Turtle 4_thumb.jpg',130, 89,0, 0,'Green turtle ','','','Sipidan');
photos[88] = new photo(300448,'25905','','gallery','Turtle graveyard.jpg',400,258,'Turtle graveyard','Turtle graveyard_thumb.jpg',130, 84,0, 0,'Turtle carapace -turtle graveyard','','','Sipidan');
photos[89] = new photo(365866,'25905','','gallery','Ep Turtle head on D1.jpg',400,323,'Turtle head on','Ep Turtle head on D1_thumb.jpg',130, 105,0, 0,'','','','Sipidan');
photos[90] = new photo(299253,'25906','','gallery','Pygmyseahorse.jpg',400,515,'Pygmy seahorse (Hippocampus bargibanti)','Pygmyseahorse_thumb.jpg',130, 167,0, 0,'Pygmy seahorse','','','Sulewesi');
photos[91] = new photo(299277,'25906','','gallery','Seahorse.jpg',400,628,'Seahorse soft coral(Hippocampus kuda)','Seahorse_thumb.jpg',130, 204,0, 0,'Seahorse in soft coral','','','UAE');
photos[92] = new photo(299278,'25906','','gallery','Seahorse 1.jpg',400,723,'Seahorse(Hippocampus kuda)','Seahorse 1_thumb.jpg',130, 235,0, 0,'Seahorse','','','');
photos[93] = new photo(357473,'25906','','gallery','seahorse in coral 2 .jpg',400,447,'Seahorse in coral(Hippocampus kuda)','seahorse in coral 2 _thumb.jpg',130, 145,0, 0,'','','','');
photos[94] = new photo(365841,'25906','','gallery','App0375 D1.jpg',400,267,'Pair of seahorses','App0375 D1_thumb.jpg',130, 87,0, 0,'','','','Sipidan');
photos[95] = new photo(365848,'25906','','gallery','Pygmyseahorse D.jpg',400,508,'Pygmy seahorse (Hippocampus bargibanti)','Pygmyseahorse D_thumb.jpg',130, 165,0, 0,'','','','Sulawesi');
photos[96] = new photo(365857,'25906','','gallery','Seahorse D.jpg',400,557,'Common seahorse(Hippocampus kuda)','Seahorse D_thumb.jpg',130, 181,0, 0,'','','','Sipidan');
photos[97] = new photo(376702,'25906','','gallery','Pygmyseahorse F1.jpg',400,588,'Pygmy Seahorse (Hippocampus bargibanti)','Pygmyseahorse F1_thumb.jpg',130, 191,0, 0,'','','','Sulewesi Indonesia');
photos[98] = new photo(376704,'25906','','gallery','seahorseF1.jpg',400,603,'Common seahorse (Hippocampus kuda)','seahorseF1_thumb.jpg',130, 196,0, 0,'','','','UAE');
photos[99] = new photo(356537,'25903','','gallery','Abstract 1.jpg',400,267,'Abstract 1','Abstract 1_thumb.jpg',130, 87,0, 0,'','','','');
photos[100] = new photo(356538,'25903','','gallery','Abstract 3.jpg',400,589,'Razor coral','Abstract 3_thumb.jpg',130, 191,0, 0,'','','','');
photos[101] = new photo(356540,'25903','','gallery','Abstract 61.jpg',400,455,'Crown of thorns','Abstract 61_thumb.jpg',130, 148,0, 0,'','','','UAE');
photos[102] = new photo(361407,'25903','','gallery','Abstract 5C2.jpg',400,613,'Nautilus shell','Abstract 5C2_thumb.jpg',130, 199,0, 0,'','','','');
photos[103] = new photo(361417,'25903','','gallery','Ep Goby on coral C1.jpg',400,267,'Goby on coral','Ep Goby on coral C1_thumb.jpg',130, 87,0, 0,'','','','');
photos[104] = new photo(365858,'25903','','gallery','Shrimp on coral D.jpg',400,329,'Shrimp on coral','Shrimp on coral D_thumb.jpg',130, 107,0, 0,'','','','Philippines');
photos[105] = new photo(380969,'25903','','gallery','Daisy coral abstract G2.jpg',400,600,'Daisy coral','Daisy coral abstract G2_thumb.jpg',130, 195,0, 0,'','','','UAE');
photos[106] = new photo(408676,'25903','','gallery','Ep Cigarlise.jpg',400,274,'The alien','Ep Cigarlise_thumb.jpg',130, 89,0, 0,'','','','UAE');
photos[107] = new photo(357459,'29225','','gallery','bw21.jpg',400,311,'Diver and wreck','bw21_thumb.jpg',130, 101,0, 0,'','','','Bonaire');
photos[108] = new photo(360069,'29225','','gallery','bw5AB2.jpg',400,260,'Seahorse head','bw5AB2_thumb.jpg',130, 85,0, 0,'','','','');
photos[109] = new photo(361408,'29225','','gallery','Batfish C1.jpg',400,250,'School of batfish','Batfish C1_thumb.jpg',130, 81,0, 0,'','','','UAE');
photos[110] = new photo(361409,'29225','','gallery','bw 3C2.jpg',400,267,'Batfish','bw 3C2_thumb.jpg',130, 87,0, 0,'','','','UAE');
photos[111] = new photo(361410,'29225','','gallery','bw 4C1.jpg',400,268,'School of trevally','bw 4C1_thumb.jpg',130, 87,0, 0,'','','','');
photos[112] = new photo(365839,'29225','','gallery','bw D.jpg',400,312,'Diver and coral','bw D_thumb.jpg',130, 101,0, 0,'','','','Philippines');
photos[113] = new photo(365842,'29225','','gallery','Clownfish and anenome bw D.jpg',400,381,'Black and white-clownfish ','Clownfish and anenome bw D_thumb.jpg',130, 124,0, 0,'','','','UAE');
photos[114] = new photo(368545,'29225','','gallery','Bw1E1.jpg',400,328,'Head shot of hammour','Bw1E1_thumb.jpg',130, 107,0, 0,'','','','Maldives');
photos[115] = new photo(368553,'29225','','gallery','bw3 E.jpg',400,636,'Snorkler and clam','bw3 E_thumb.jpg',130, 207,0, 0,'','','','Maldives');
photos[116] = new photo(368555,'29225','','gallery','bw Catfish E1.jpg',400,578,'Catfish ','bw Catfish E1_thumb.jpg',130, 188,0, 0,'','','','UAE');
photos[117] = new photo(376699,'29225','','gallery','Lionfish bw F.jpg',400,375,'Lionfish ','Lionfish bw F_thumb.jpg',130, 122,0, 0,'','','','UAE');
photos[118] = new photo(376707,'29225','','gallery','Batfish bw F3.jpg',400,568,'Batfish up close','Batfish bw F3_thumb.jpg',130, 185,0, 0,'','','','UAE');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
galleries = new Array();
galleries[0] = new gallery(25901,'376709,376706,365864,360076,360071,360068,360067,357491,300432,300429','Marine life of the UAE','gallery');
galleries[1] = new gallery(20655,'298209,298208,298196,298192,298188,297632','Wrecks & Divers','gallery');
galleries[2] = new gallery(25900,'360074,300441,300435,299288,299283,299250,299249,299239,299226,298872','Up close and personal','gallery');
galleries[3] = new gallery(25902,'376710,376708,376705,376703,376701,368556,365870,365861,365843,365840','The reef','gallery');
galleries[4] = new gallery(25904,'380960,361415,357685,297643,297617','Silhouettes ','gallery');
galleries[5] = new gallery(25908,'361419,361418,357635,300428,300427,300426,300425,300424,300423','Creature Feature - Nudibranches','gallery');
galleries[6] = new gallery(25905,'365866,300448,300447,300446,300443,300442','Creature Feature - Turtles','gallery');
galleries[7] = new gallery(25906,'376704,376702,365857,365848,365841,357473,299278,299277,299253','Creature Feature - Seahorses','gallery');
galleries[8] = new gallery(25903,'408676,380969,365858,361417,361407,356540,356538,356537','Abstract ','gallery');
galleries[9] = new gallery(29225,'376707,376699,368555,368553,368545,365842,365839,361410,361409,361408','Black & white underwater','gallery');

