/***************************************************************************
* 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('3148476');
	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('3148476');
	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 = 'Bam 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(3148390,'101491','landscapes_1','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_111.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_111_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[1] = new photo(3148392,'101491','landscapes_2','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_210.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_210_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[2] = new photo(3148393,'101491','landscapes_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_32.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_32_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[3] = new photo(3148395,'101491','landscapes_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_42.jpg',283,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_42_thumb.jpg',92, 130,0, 0,'','','','','','');
photos[4] = new photo(3148456,'101491','landscapes_4','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_51.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_51_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[5] = new photo(3148459,'101491','landscapes_6','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_61.jpg',600,381,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_61_thumb.jpg',130, 83,0, 0,'','','','','','');
photos[6] = new photo(3148460,'101491','landscapes_7','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_71.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_71_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[7] = new photo(3148461,'101491','landscapes_8','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_81.jpg',401,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_81_thumb.jpg',130, 130,0, 0,'','','','','','');
photos[8] = new photo(3148462,'101491','landscapes_9','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_91.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_91_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[9] = new photo(3148463,'101491','landscapes_10','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_101.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_101_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[10] = new photo(3148464,'101491','landscapes_11','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_112.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_112_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[11] = new photo(3148465,'101491','landscapes_12','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_121.jpg',319,399,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_121_thumb.jpg',104, 130,0, 0,'','','','','','');
photos[12] = new photo(3148466,'101491','landscapes_13','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_131.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_131_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[13] = new photo(3148469,'101491','landscapes_14','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_141.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_141_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[14] = new photo(3148471,'101491','landscapes_15','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_151.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_151_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[15] = new photo(3148473,'101491','landscapes_16','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_161.jpg',283,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_161_thumb.jpg',92, 130,0, 0,'','','','','','');
photos[16] = new photo(3148475,'101491','landscapes_17','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_171.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_171_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[17] = new photo(3148476,'101491','landscapes_18','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_181.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_181_thumb.jpg',130, 87,1, 0,'','','','','','');
photos[18] = new photo(3148477,'101491','landscapes_19','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_191.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_191_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[19] = new photo(3148478,'101491','landscapes_20','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_201.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_201_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[20] = new photo(3148481,'101491','landscapes_21','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_211.jpg',283,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_211_thumb.jpg',92, 130,0, 0,'','','','','','');
photos[21] = new photo(3148484,'101491','landscapes_22','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_221.jpg',283,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_221_thumb.jpg',92, 130,0, 0,'','','','','','');
photos[22] = new photo(3148485,'101491','landscapes_23','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_231.jpg',283,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_231_thumb.jpg',92, 130,0, 0,'','','','','','');
photos[23] = new photo(3148487,'101491','landscapes_24','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_241.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_241_thumb.jpg',130, 87,0, 1,'','','','','','');
photos[24] = new photo(3148488,'101491','landscapes_25','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_251.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_251_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[25] = new photo(3148491,'101491','landscapes_26','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_261.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_261_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[26] = new photo(3148494,'101491','landscapes_28','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_271.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_271_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[27] = new photo(3148496,'101491','landscapes_28','gallery','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_281.jpg',600,306,'','http://www1.clikpic.com/bamphotography/images/gallery_1_landscape_281_thumb.jpg',130, 66,0, 0,'','','','','','');
photos[28] = new photo(3148635,'101498','portraits_1','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_1.jpg',399,399,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_1_thumb.jpg',130, 130,0, 0,'','','','','','');
photos[29] = new photo(3148636,'101498','portraits_2','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_2.jpg',325,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_2_thumb.jpg',106, 130,0, 0,'','','','','','');
photos[30] = new photo(3148637,'101498','portraits_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_3.jpg',268,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_3_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[31] = new photo(3148639,'101498','portraits_4','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_4.jpg',267,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_4_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[32] = new photo(3148640,'101498','portraits_5','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_5.jpg',566,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_5_thumb.jpg',130, 92,0, 0,'','','','','','');
photos[33] = new photo(3148641,'101498','portraits_6','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_6.jpg',320,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_6_thumb.jpg',104, 130,0, 0,'','','','','','');
photos[34] = new photo(3148642,'101498','portraits_7','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_7.jpg',382,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_7_thumb.jpg',124, 130,0, 1,'','','','','','');
photos[35] = new photo(3148643,'101498','portraits_8','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_8.jpg',516,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_8_thumb.jpg',130, 101,0, 0,'','','','','','');
photos[36] = new photo(3148644,'101498','portraits_9','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_9.jpg',285,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_9_thumb.jpg',93, 130,0, 0,'','','','','','');
photos[37] = new photo(3148645,'101498','portraits_10','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_10.jpg',334,399,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_10_thumb.jpg',109, 130,0, 0,'','','','','','');
photos[38] = new photo(3148647,'101498','portraits_11','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_11.jpg',267,400,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_11_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[39] = new photo(3148648,'101498','portraits_12','gallery','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_12.jpg',266,399,'','http://www1.clikpic.com/bamphotography/images/gallery_2_portrait_12_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[40] = new photo(3149215,'193054','maternity_1','gallery','http://www1.clikpic.com/bamphotography/images/gallery_5_maternity_1.jpg',508,400,'','http://www1.clikpic.com/bamphotography/images/gallery_5_maternity_1_thumb.jpg',130, 102,0, 1,'','','','','','');
photos[41] = new photo(3149222,'193054','maternity_4','gallery','http://www1.clikpic.com/bamphotography/images/gallery_5_maternity_4.jpg',269,400,'','http://www1.clikpic.com/bamphotography/images/gallery_5_maternity_4_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[42] = new photo(3149217,'193054','maternity_2','gallery','http://www1.clikpic.com/bamphotography/images/gallery_5_maternity_2.jpg',500,400,'','http://www1.clikpic.com/bamphotography/images/gallery_5_maternity_2_thumb.jpg',130, 104,0, 0,'','','','','','');
photos[43] = new photo(3149220,'193054','maternity_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_5_maternity_3.jpg',321,400,'','http://www1.clikpic.com/bamphotography/images/gallery_5_maternity_3_thumb.jpg',104, 130,0, 0,'','','','','','');
photos[44] = new photo(3148839,'193032','eclectic_mix_1','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_1.jpg',282,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_1_thumb.jpg',92, 130,0, 0,'','','','','','');
photos[45] = new photo(3148842,'193032','eclectic_mix_2','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_2.jpg',267,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_2_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[46] = new photo(3148843,'193032','eclectic_mix_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_3.jpg',566,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_3_thumb.jpg',130, 92,0, 0,'','','','','','');
photos[47] = new photo(3148844,'193032','eclectic_mix_4','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_4.jpg',267,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_4_thumb.jpg',87, 130,0, 1,'','','','','','');
photos[48] = new photo(3148846,'193032','eclectic_mix_5','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_5.jpg',560,399,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_5_thumb.jpg',130, 93,0, 0,'','','','','','');
photos[49] = new photo(3148847,'193032','eclectic_mix_6','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_6.jpg',566,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_6_thumb.jpg',130, 92,0, 0,'','','','','','');
photos[50] = new photo(3148848,'193032','eclectic_mix_7','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_7.jpg',288,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_7_thumb.jpg',94, 130,0, 0,'','','','','','');
photos[51] = new photo(3148852,'193032','eclectic_mix_8','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_8.jpg',266,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_8_thumb.jpg',86, 130,0, 0,'','','','','','');
photos[52] = new photo(3148854,'193032','eclectic_mix_9','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_9.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_9_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[53] = new photo(3148855,'193032','eclectic_mix_10','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_10.jpg',514,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_10_thumb.jpg',130, 101,0, 0,'','','','','','');
photos[54] = new photo(3148858,'193032','eclectic_mix_12','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_121.jpg',445,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_121_thumb.jpg',130, 117,0, 0,'','','','','','');
photos[55] = new photo(3148861,'193032','eclectic_mix_11','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_111.jpg',566,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_111_thumb.jpg',130, 92,0, 0,'','','','','','');
photos[56] = new photo(3148917,'193032','eclectic_mix_13','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_13.jpg',317,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_13_thumb.jpg',103, 130,0, 0,'','','','','','');
photos[57] = new photo(3148919,'193032','eclectic_mix_14','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_14.jpg',462,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_14_thumb.jpg',130, 113,0, 0,'','','','','','');
photos[58] = new photo(3148921,'193032','eclectic_mix_15','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_15.jpg',234,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_15_thumb.jpg',76, 130,0, 0,'','','','','','');
photos[59] = new photo(3148926,'193032','eclectic_mix_16','gallery','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_16.jpg',566,400,'','http://www1.clikpic.com/bamphotography/images/gallery_3_eclectic_mix_16_thumb.jpg',130, 92,0, 0,'','','','','','');
photos[60] = new photo(3149016,'193043','flowers_1','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_1.jpg',526,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_1_thumb.jpg',130, 99,0, 0,'','','','','','');
photos[61] = new photo(3149018,'193043','flowers_2','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_2.jpg',539,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_2_thumb.jpg',130, 96,0, 0,'','','','','','');
photos[62] = new photo(3149021,'193043','flower_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_3.jpg',400,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_3_thumb.jpg',130, 130,0, 0,'','','','','','');
photos[63] = new photo(3149024,'193043','flowers_4','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_4.jpg',371,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_4_thumb.jpg',121, 130,0, 0,'','','','','','');
photos[64] = new photo(3149026,'193043','flowers_5','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_5.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_5_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[65] = new photo(3149029,'193043','flowers_6','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_6.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_6_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[66] = new photo(3149068,'193043','flowers_7','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_7.jpg',543,399,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_7_thumb.jpg',130, 96,0, 0,'','','','','','');
photos[67] = new photo(3149124,'193043','flowers_8','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_8.jpg',532,399,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_8_thumb.jpg',130, 98,0, 0,'','','','','','');
photos[68] = new photo(3149133,'193043','flowers_9','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_9.jpg',255,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_9_thumb.jpg',83, 130,0, 0,'','','','','','');
photos[69] = new photo(3149135,'193043','flowers_10','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_10.jpg',533,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_10_thumb.jpg',130, 98,0, 1,'','','','','','');
photos[70] = new photo(3149137,'193043','flowers_11','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_11.jpg',451,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_11_thumb.jpg',130, 115,0, 0,'','','','','','');
photos[71] = new photo(3149139,'193043','flowers_12','gallery','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_12.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_4_flowers_12_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[72] = new photo(3149503,'193068','Interiors_1','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_1.jpg',247,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_1_thumb.jpg',80, 130,0, 0,'','','','','','');
photos[73] = new photo(3149504,'193068','Interiors_2','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_2.jpg',322,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_2_thumb.jpg',105, 130,0, 0,'','','','','','');
photos[74] = new photo(3149506,'193068','Interiors_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_3.jpg',589,323,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_3_thumb.jpg',130, 71,0, 0,'','','','','','');
photos[75] = new photo(3149508,'193068','Interiors_4','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_4.jpg',573,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_4_thumb.jpg',130, 91,0, 0,'','','','','','');
photos[76] = new photo(3149509,'193068','Interiors_5','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_5.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_5_thumb.jpg',130, 87,0, 1,'','','','','','');
photos[77] = new photo(3149510,'193068','Interiors_6','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_6.jpg',190,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_6_thumb.jpg',62, 130,0, 0,'','','','','','');
photos[78] = new photo(3149512,'193068','Interiors_7','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_7.jpg',478,397,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_7_thumb.jpg',130, 108,0, 0,'','','','','','');
photos[79] = new photo(3149513,'193068','Interiors_8','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_8.jpg',358,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_8_thumb.jpg',116, 130,0, 0,'','','','','','');
photos[80] = new photo(3149516,'193068','Interiors_9','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_9.jpg',509,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_9_thumb.jpg',130, 102,0, 0,'','','','','','');
photos[81] = new photo(3149518,'193068','Interiors_10','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_10.jpg',506,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_10_thumb.jpg',130, 103,0, 0,'','','','','','');
photos[82] = new photo(3149522,'193068','Interiors_11','gallery','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_11.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_7_interiors_11_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[83] = new photo(3149298,'193058','weddings_2','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_2.jpg',599,399,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_2_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[84] = new photo(3149300,'193058','weddings_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_3.jpg',393,399,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_3_thumb.jpg',128, 130,0, 0,'','','','','','');
photos[85] = new photo(3149304,'193058','weddings_4','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_4.jpg',570,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_4_thumb.jpg',130, 91,0, 1,'','','','','','');
photos[86] = new photo(3149310,'193058','weddings_6','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_6.jpg',262,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_6_thumb.jpg',85, 130,0, 0,'','','','','','');
photos[87] = new photo(3149314,'193058','weddings_5','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_5.jpg',266,399,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_5_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[88] = new photo(3149318,'193058','weddings_7','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_7.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_7_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[89] = new photo(3149322,'193058','weddings_8','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_8.jpg',266,399,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_8_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[90] = new photo(3149324,'193058','weddings_9','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_9.jpg',267,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_9_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[91] = new photo(3149335,'193058','weddings_10','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_10.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_10_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[92] = new photo(3149338,'193058','weddings_11','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_11.jpg',447,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_11_thumb.jpg',130, 116,0, 0,'','','','','','');
photos[93] = new photo(3149340,'193058','weddings_12','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_12.jpg',267,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_12_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[94] = new photo(3149343,'193058','weddings_13','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_13.jpg',400,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_13_thumb.jpg',130, 130,0, 0,'','','','','','');
photos[95] = new photo(3149345,'193058','weddings_14','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_14.jpg',465,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_14_thumb.jpg',130, 112,0, 0,'','','','','','');
photos[96] = new photo(3149347,'193058','weddings_15','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_15.jpg',399,399,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_15_thumb.jpg',130, 130,0, 0,'','','','','','');
photos[97] = new photo(3149350,'193058','weddings_16','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_16.jpg',336,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_16_thumb.jpg',109, 130,0, 0,'','','','','','');
photos[98] = new photo(3149353,'193058','weddings_17','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_17.jpg',300,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_17_thumb.jpg',98, 130,0, 0,'','','','','','');
photos[99] = new photo(3149355,'193058','weddings_18','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_18.jpg',582,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_18_thumb.jpg',130, 89,0, 0,'','','','','','');
photos[100] = new photo(3149356,'193058','weddings_19','gallery','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_19.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_6_weddings_19_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[101] = new photo(3149626,'193076','glass_1','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_1.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_1_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[102] = new photo(3149628,'193076','glass_2','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_2.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_2_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[103] = new photo(3149631,'193076','glass_3','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_3.jpg',344,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_3_thumb.jpg',112, 130,0, 0,'','','','','','');
photos[104] = new photo(3149632,'193076','glass_4','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_4.jpg',504,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_4_thumb.jpg',130, 103,0, 0,'','','','','','');
photos[105] = new photo(3149634,'193076','glass_5','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_5.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_5_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[106] = new photo(3149660,'193076','glass_6','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_6.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_6_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[107] = new photo(3149662,'193076','glass_7','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_7.jpg',268,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_7_thumb.jpg',87, 130,0, 0,'','','','','','');
photos[108] = new photo(3149665,'193076','glass_8','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_8.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_8_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[109] = new photo(3149673,'193076','glass_9','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_9.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_9_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[110] = new photo(3149675,'193076','glass_10','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_10.jpg',263,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_10_thumb.jpg',85, 130,0, 0,'','','','','','');
photos[111] = new photo(3149676,'193076','glass_11','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_11.jpg',600,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_11_thumb.jpg',130, 87,0, 0,'','','','','','');
photos[112] = new photo(3149679,'193076','glass_12','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_12.jpg',401,400,'Speaking Stones by Louise Tait','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_12_thumb.jpg',130, 130,0, 1,'Speaking Stones by Louise Tait','','Bam Hyslop','','','');
photos[113] = new photo(3149683,'193076','glass_13','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_13.jpg',235,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_13_thumb.jpg',76, 130,0, 0,'','','','','','');
photos[114] = new photo(3149684,'193076','glass_14','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_14.jpg',148,399,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_14_thumb.jpg',48, 130,0, 0,'','','','','','');
photos[115] = new photo(3149703,'193076','glass_15','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_15.jpg',400,400,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_15_thumb.jpg',130, 130,0, 0,'','','','','','');
photos[116] = new photo(3149704,'193076','glass_16','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_16.jpg',499,399,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_16_thumb.jpg',130, 104,0, 0,'','','','','','');
photos[117] = new photo(3149722,'193076','glass_17','gallery','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_17.jpg',600,286,'','http://www1.clikpic.com/bamphotography/images/gallery_8_glass_17_thumb.jpg',130, 62,0, 0,'','','','','','');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
galleries = new Array();
galleries[0] = new gallery(101491,'3148487','Landscapes','gallery');
galleries[1] = new gallery(101498,'3148642','Portraiture','gallery');
galleries[2] = new gallery(193054,'3149215','Maternity','gallery');
galleries[3] = new gallery(193032,'3148844','Eclectic Mix','gallery');
galleries[4] = new gallery(193043,'3149135','flowers','gallery');
galleries[5] = new gallery(193068,'3149509','Interiors','gallery');
galleries[6] = new gallery(193058,'3149304','Weddings','gallery');
galleries[7] = new gallery(193076,'3149679','Glass','gallery');

