/***************************************************************************
* 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, item_price, purchase_instruction) {
	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;
	this.item_price = item_price;
	this.purchase_instruction = purchase_instruction;
}
/***************************************************************************
* 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('777085');
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			if (!basic) {
			img.src = 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 = 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('777085');
	for (j = 0; j < photos.length; j++) {
		if (photos[j].id == imageID) {
			if ('gallery' != '') {
						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="' + photos[j].src + '" width="' + photos[j].width + '" height="' + photos[j].height + '" class="mainhomepageimage" id="mainSample" name="mainSample" alt="' + photos[j].caption  + '" border="0">');
			if ('gallery' != '') {
				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) || (0))) {
		debug('In updateImage');
		debug('setting  img src = ' + photos[nextImg].src);
		
					
			document.getElementById('imagePhoto').innerHTML = '<img class="mainphoto" src="' + photos[nextImg].src + ' " id="mainPic" name="mainPic" width="' + photos[nextImg].width + '" height="' + photos[nextImg].height + '" alt="' + photos[nextImg].caption + '">';
						field.value = photos[nextImg].id;
			document.getElementById('imageTitle').innerHTML = photos[nextImg].caption;
									document.title = 'Michael Langford Photography: ' + photos[nextImg].caption;
										/* apply 'blank' classname to element where */			if ( photos[nextImg].caption == '') {
				document.getElementById('imageTitle').style.className = 'blank';
			}
			else {
				document.getElementById('imageTitle').style.className = 'normal';
			}
						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.display = 'none';
		}
		else {
			document.getElementById('imageDetails').style.display = 'block';
		}
		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('Gallery = ' + 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 = 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(789359,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Arum Lily Frog.jpg',300,203,'Arum lily frog','http://www3.clikpic.com/mikelangford/images/Arum Lily Frog_thumb.jpg',130, 88,0, 0,'','','','','','');
photos[1] = new photo(789360,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Baboon 1.jpg',199,300,'Baboon 1','http://www3.clikpic.com/mikelangford/images/Baboon 1_thumb.jpg',130, 196,0, 0,'','','','','','');
photos[2] = new photo(789362,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Canola field.jpg',350,230,'Canola field','http://www3.clikpic.com/mikelangford/images/Canola field_thumb.jpg',130, 85,0, 0,'','','','','','');
photos[3] = new photo(789363,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Cape minstrel.jpg',267,400,'Cape minstrel','http://www3.clikpic.com/mikelangford/images/Cape minstrel_thumb.jpg',130, 195,0, 0,'','','','','','');
photos[4] = new photo(789367,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Daisy backlit.jpg',201,300,'Daisy','http://www3.clikpic.com/mikelangford/images/Daisy backlit_thumb.jpg',130, 194,0, 0,'','','','','','');
photos[5] = new photo(789369,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Hummingbird hawk moth.jpg',300,192,'Hummingbird hawk moth','http://www3.clikpic.com/mikelangford/images/Hummingbird hawk moth_thumb.jpg',130, 83,0, 0,'','','','','','');
photos[6] = new photo(789371,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/King Protea.jpg',202,300,'King protea','http://www3.clikpic.com/mikelangford/images/King Protea_thumb.jpg',130, 193,0, 0,'','','','','','');
photos[7] = new photo(789374,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Ostrich sunset.jpg',199,300,'Ostrich sunset','http://www3.clikpic.com/mikelangford/images/Ostrich sunset_thumb.jpg',130, 196,0, 0,'','','','','','');
photos[8] = new photo(789375,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Paramotor dusk 6.jpg',300,202,'Paramotor dusk 6','http://www3.clikpic.com/mikelangford/images/Paramotor dusk 6_thumb.jpg',130, 88,0, 0,'','','','','','');
photos[9] = new photo(789376,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Penguin couple.jpg',300,192,'Penguin couple','http://www3.clikpic.com/mikelangford/images/Penguin couple_thumb.jpg',130, 83,0, 0,'','','','','','');
photos[10] = new photo(789378,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Sunset 2.jpg',300,200,'Sunset 2','http://www3.clikpic.com/mikelangford/images/Sunset 2_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[11] = new photo(789379,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Table Mountain from Blouberg 1.jpg',300,197,'Table mountain from Blouberg','http://www3.clikpic.com/mikelangford/images/Table Mountain from Blouberg 1_thumb.jpg',130, 85,0, 0,'','','','','','');
photos[12] = new photo(789380,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Table Mountain from Milnerton, flowers.jpg',300,200,'Table mountain from Milnerton','http://www3.clikpic.com/mikelangford/images/Table Mountain from Milnerton, flowers_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[13] = new photo(789383,'60231','','gallery','http://www3.clikpic.com/mikelangford/images/Whale Breach 5.jpg',300,198,'Whale breach 5','http://www3.clikpic.com/mikelangford/images/Whale Breach 5_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[14] = new photo(789395,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Boat_tour,_Amazon.jpg',400,266,'Boat tour, Amazon','http://www3.clikpic.com/mikelangford/images/Boat_tour,_Amazon_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[15] = new photo(789396,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Boat_trip_to_island.jpg',400,264,'Boat trip to island','http://www3.clikpic.com/mikelangford/images/Boat_trip_to_island_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[16] = new photo(789397,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Downhill_cycling,_Peru.jpg',285,400,'Downhill cycling, Peru','http://www3.clikpic.com/mikelangford/images/Downhill_cycling,_Peru_thumb.jpg',130, 182,0, 0,'','','','','','');
photos[17] = new photo(789398,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Group_at_Tiwanaku.jpg',400,296,'Group at Tiwanaku, Bolivia','http://www3.clikpic.com/mikelangford/images/Group_at_Tiwanaku_thumb.jpg',130, 96,0, 0,'','','','','','');
photos[18] = new photo(789399,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Guide_at_Machu_Picchu.jpg',273,400,'Guide at Machu Picchu','http://www3.clikpic.com/mikelangford/images/Guide_at_Machu_Picchu_thumb.jpg',130, 190,0, 0,'','','','','','');
photos[19] = new photo(789400,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/On_horseback_in_dunes.jpg',266,400,'On horseback in dunes','http://www3.clikpic.com/mikelangford/images/On_horseback_in_dunes_thumb.jpg',130, 195,0, 0,'','','','','','');
photos[20] = new photo(789401,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Tour_bus,_Manu,_Peru.jpg',400,266,'Tour bus, Manu','http://www3.clikpic.com/mikelangford/images/Tour_bus,_Manu,_Peru_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[21] = new photo(789402,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Tour_group_in_boat_2.jpg',400,274,'Tour group in boat','http://www3.clikpic.com/mikelangford/images/Tour_group_in_boat_2_thumb.jpg',130, 89,0, 0,'','','','','','');
photos[22] = new photo(789403,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Touring,_Namaqualand.jpg',300,198,'Touring, Namaqualand','http://www3.clikpic.com/mikelangford/images/Touring,_Namaqualand_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[23] = new photo(789404,'60233','','gallery','http://www3.clikpic.com/mikelangford/images/Tourists_in_rainforest.jpg',400,281,'Tourists in rainforest','http://www3.clikpic.com/mikelangford/images/Tourists_in_rainforest_thumb.jpg',130, 91,0, 0,'','','','','','');
photos[24] = new photo(789406,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Archaeological_reconstruction.jpg',400,261,'Archaeological recontruction','http://www3.clikpic.com/mikelangford/images/Archaeological_reconstruction_thumb.jpg',130, 85,0, 0,'','','','','','');
photos[25] = new photo(789407,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Bird_research.jpg',269,400,'Bird research','http://www3.clikpic.com/mikelangford/images/Bird_research_thumb.jpg',130, 193,0, 0,'','','','','','');
photos[26] = new photo(789408,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Brazil_nut_research.jpg',265,400,'Brazil nut research','http://www3.clikpic.com/mikelangford/images/Brazil_nut_research_thumb.jpg',130, 196,0, 0,'','','','','','');
photos[27] = new photo(789409,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Brazil_nut_research_station.jpg',400,269,'Brazil nut research station','http://www3.clikpic.com/mikelangford/images/Brazil_nut_research_station_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[28] = new photo(789416,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Burning_alien_invaders.jpg',400,271,'Burning alien invasives','http://www3.clikpic.com/mikelangford/images/Burning_alien_invaders_thumb.jpg',130, 88,0, 0,'','','','','','');
photos[29] = new photo(789417,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Clearing_alien_invasive_plants.jpg',400,261,'Clearing alien invasives','http://www3.clikpic.com/mikelangford/images/Clearing_alien_invasive_plants_thumb.jpg',130, 85,0, 0,'','','','','','');
photos[30] = new photo(789418,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Clearing_oil_spill.jpg',270,400,'Clearing oil spill','http://www3.clikpic.com/mikelangford/images/Clearing_oil_spill_thumb.jpg',130, 193,0, 0,'','','','','','');
photos[31] = new photo(789419,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Herpetology_project_1.jpg',300,199,'Herpetology project 1','http://www3.clikpic.com/mikelangford/images/Herpetology_project_1_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[32] = new photo(789420,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Herpetology_project_2.jpg',274,400,'Herpetology project 2','http://www3.clikpic.com/mikelangford/images/Herpetology_project_2_thumb.jpg',130, 190,0, 0,'','','','','','');
photos[33] = new photo(789421,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Lifting_boat_in_shallows.jpg',400,263,'Lifting boat in shallows','http://www3.clikpic.com/mikelangford/images/Lifting_boat_in_shallows_thumb.jpg',130, 85,0, 0,'','','','','','');
photos[34] = new photo(789422,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Mammal_research_1.jpg',264,400,'Mammal research 1','http://www3.clikpic.com/mikelangford/images/Mammal_research_1_thumb.jpg',130, 197,0, 0,'','','','','','');
photos[35] = new photo(789424,'60234','','gallery','http://www3.clikpic.com/mikelangford/images/Rock_art_study.jpg',270,400,'Rock art study','http://www3.clikpic.com/mikelangford/images/Rock_art_study_thumb.jpg',130, 193,0, 0,'','','','','','');
photos[36] = new photo(789692,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Barred_leaf_frog.jpg',267,400,'Barred leaf frog','http://www3.clikpic.com/mikelangford/images/Barred_leaf_frog_thumb.jpg',130, 195,0, 1,'','','','','','');
photos[37] = new photo(789696,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Boat_gold.jpg',400,265,'Boat gold','http://www3.clikpic.com/mikelangford/images/Boat_gold_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[38] = new photo(789697,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Buttress_roots_3.jpg',400,268,'Buttress roots 3','http://www3.clikpic.com/mikelangford/images/Buttress_roots_3_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[39] = new photo(789812,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Colpa_morning.jpg',400,268,'Colpa/clay lick, Tambopata','http://www3.clikpic.com/mikelangford/images/Colpa_morning_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[40] = new photo(789813,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Gold_mining_10.jpg',265,400,'Gold mining, Madre de Dios','http://www3.clikpic.com/mikelangford/images/Gold_mining_10_thumb.jpg',130, 196,0, 0,'','','','','','');
photos[41] = new photo(791252,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Convict_Hairstreaks_mating.jpg',400,271,'Convict hairstreaks mating','http://www3.clikpic.com/mikelangford/images/Convict_Hairstreaks_mating_thumb.jpg',130, 88,0, 0,'','','','','','');
photos[42] = new photo(791262,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Early_morning,_Rio_Patuyacu.jpg',400,270,'Early morning, Patuyacu','http://www3.clikpic.com/mikelangford/images/Early_morning,_Rio_Patuyacu_thumb.jpg',130, 88,0, 0,'','','','','','');
photos[43] = new photo(792857,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Market_Boats.jpg',400,266,'Market boats','http://www3.clikpic.com/mikelangford/images/Market_Boats_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[44] = new photo(792860,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Puerto_Maldonado_View.jpg',266,400,'Puerto Maldonado view','http://www3.clikpic.com/mikelangford/images/Puerto_Maldonado_View_thumb.jpg',130, 195,0, 0,'','','','','','');
photos[45] = new photo(792864,'60232','','gallery','http://www3.clikpic.com/mikelangford/images/Tree_boa.jpg',400,261,'Tree boa','http://www3.clikpic.com/mikelangford/images/Tree_boa_thumb.jpg',130, 85,0, 0,'','','','','','');
photos[46] = new photo(777055,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Alpaca_face.jpg',400,263,'Alpaca face','http://www3.clikpic.com/mikelangford/images/Alpaca_face_thumb.jpg',130, 85,0, 0,'','','','','','');
photos[47] = new photo(777059,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Corpus_Christi.jpg',258,400,'Corpus Christi parade','http://www3.clikpic.com/mikelangford/images/Corpus_Christi_thumb.jpg',130, 202,0, 0,'','','','','','');
photos[48] = new photo(777061,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Cusco_woman.jpg',400,267,'Cusco woman','http://www3.clikpic.com/mikelangford/images/Cusco_woman_thumb.jpg',130, 87,0, 1,'','','','','','');
photos[49] = new photo(777063,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Dance_movement.jpg',400,269,'Dance movement','http://www3.clikpic.com/mikelangford/images/Dance_movement_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[50] = new photo(777069,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Hands_weaving.jpg',400,267,'Hands weaving','http://www3.clikpic.com/mikelangford/images/Hands_weaving_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[51] = new photo(777071,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Inca_at_Inti _Raymi.jpg',264,400,'Inca at Inti Raymi','http://www3.clikpic.com/mikelangford/images/Inca_at_Inti _Raymi_thumb.jpg',130, 197,0, 0,'','','','','','');
photos[52] = new photo(777072,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/La_Plaza_de_Armas.jpg',400,264,'La Plaza de Armas','http://www3.clikpic.com/mikelangford/images/La_Plaza_de_Armas_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[53] = new photo(777075,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Machu_Picchu.jpg',400,268,'Machu Picchu','http://www3.clikpic.com/mikelangford/images/Machu_Picchu_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[54] = new photo(777078,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Procuradores_at_night.jpg',269,400,'Procuradores at night','http://www3.clikpic.com/mikelangford/images/Procuradores_at_night_thumb.jpg',130, 193,0, 0,'','','','','','');
photos[55] = new photo(777080,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Qorikancha_ interior.jpg',266,400,'Qorikancha interior','http://www3.clikpic.com/mikelangford/images/Qorikancha_ interior_thumb.jpg',130, 195,0, 0,'','','','','','');
photos[56] = new photo(777084,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Sacsaywaman_Walls.jpg',400,267,'Sacsaywaman walls','http://www3.clikpic.com/mikelangford/images/Sacsaywaman_Walls_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[57] = new photo(777085,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Spinning_girl.jpg',400,288,'Spinning girl','http://www3.clikpic.com/mikelangford/images/Spinning_girl_thumb.jpg',130, 94,1, 0,'','','','','','');
photos[58] = new photo(777086,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Wall_&_church.jpg',400,265,'Wall and church','http://www3.clikpic.com/mikelangford/images/Wall_&_church_thumb.jpg',130, 86,0, 0,'','','','','','');
photos[59] = new photo(777089,'60221','','gallery','http://www3.clikpic.com/mikelangford/images/Weavers,_alpacas,_llama.jpg',400,267,'Weavers, alpaca, llama','http://www3.clikpic.com/mikelangford/images/Weavers,_alpacas,_llama_thumb.jpg',130, 87,0, 0,'','','','','','');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
galleries = new Array();
galleries[0] = new gallery(60234,'789424,789422,789421,789420,789419,789418,789417,789416,789409,789408','Project photography','gallery');
galleries[1] = new gallery(60232,'789692','Rainforest','gallery');
galleries[2] = new gallery(60233,'789404,789403,789402,789401,789400,789399,789398,789397,789396,789395','Tour Photography','gallery');
galleries[3] = new gallery(60231,'789383,789380,789379,789378,789376,789375,789374,789371,789369,789367','Western Cape','gallery');
galleries[4] = new gallery(60221,'777061','Cusco','gallery');

