window.thumbnails = {};
															thumbnails[8688578] = clik.newPhoto({"id":8688578,"src":"JamesMoore_Gannets_BassRock_2_thumb.jpg","galleries_id":441328,"server_id":15,"link":"photo_8688578.html","width":107,"caption":"Bonding Gannets","height":160});
															thumbnails[8688715] = clik.newPhoto({"id":8688715,"src":"Bass-Rock-Gannets-A3_thumb.jpg","galleries_id":441328,"server_id":15,"link":"photo_8688715.html","width":107,"caption":"Bass Rock Gannets. ","height":160});
															thumbnails[8752264] = clik.newPhoto({"id":8752264,"src":"Borneo-056_thumb.jpg","galleries_id":458503,"server_id":15,"link":"photo_8752264.html","width":107,"caption":"Long-tailed macaque. Sepilok, Borneo. ","height":160});
															thumbnails[8948011] = clik.newPhoto({"id":8948011,"src":"Orang-Utan_thumb.jpg","galleries_id":458503,"server_id":15,"link":"photo_8948011.html","width":107,"caption":"Orangutan","height":160});
															thumbnails[8948028] = clik.newPhoto({"id":8948028,"src":"HELLLLOOOOOOOOO_thumb.jpg","galleries_id":458503,"server_id":15,"link":"photo_8948028.html","width":160,"caption":"Northern Elephant seals","height":113});
															thumbnails[8948037] = clik.newPhoto({"id":8948037,"src":"Fin-whale_thumb.gif","galleries_id":458503,"server_id":15,"link":"photo_8948037.html","width":160,"caption":"Fin whale","height":106});
															thumbnails[8266533] = clik.newPhoto({"id":8266533,"src":"Pine-Marten-martes-martes.-20_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266533.html","width":150,"caption":"Pine marten. (Martes martes)","height":100});
															thumbnails[8266318] = clik.newPhoto({"id":8266318,"src":"Pine-Marten-martes-martes1.-2_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266318.html","width":150,"caption":"Pine marten. (martes martes)","height":100});
															thumbnails[8266366] = clik.newPhoto({"id":8266366,"src":"Pine-Marten-martes-martes.-3_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266366.html","width":150,"caption":"Pine marten. (Martes martes)","height":100});
															thumbnails[8266372] = clik.newPhoto({"id":8266372,"src":"Pine-Marten-martes-martes.-22_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266372.html","width":150,"caption":"Pine marten. (martes martes)","height":100});
															thumbnails[8266422] = clik.newPhoto({"id":8266422,"src":"Pine-Marten-martes-martes.-21_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266422.html","width":150,"caption":"Pine marten. (Martes martes)","height":100});
															thumbnails[8266649] = clik.newPhoto({"id":8266649,"src":"Pine-Marten-martes-martes.-4_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266649.html","width":150,"caption":"Pine marten (martes martes).","height":100});
															thumbnails[8266656] = clik.newPhoto({"id":8266656,"src":"Pine-Marten-martes-martes.-5_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266656.html","width":150,"caption":"Pine marten. (martes martes)","height":100});
															thumbnails[8266653] = clik.newPhoto({"id":8266653,"src":"Pine-Marten-martes-martes.-1_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266653.html","width":150,"caption":"Pine marten (martes martes)","height":100});
															thumbnails[8266660] = clik.newPhoto({"id":8266660,"src":"Pine-Marten-martes-martes.-7_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266660.html","width":150,"caption":"Pine marten (martes martes).","height":100});
															thumbnails[8266755] = clik.newPhoto({"id":8266755,"src":"Pine-Marten-martes-martes.-6_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266755.html","width":150,"caption":"Pine marten (martes martes). ","height":100});
															thumbnails[8266762] = clik.newPhoto({"id":8266762,"src":"Pine-Marten-martes-martes.-8_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266762.html","width":150,"caption":"Pine marten (martes martes)","height":100});
															thumbnails[8266766] = clik.newPhoto({"id":8266766,"src":"Pine-Marten-martes-martes.-15_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266766.html","width":150,"caption":"Pine marten (martes martes)","height":100});
															thumbnails[8266402] = clik.newPhoto({"id":8266402,"src":"Pine-Marten-martes-martes.-40_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266402.html","width":113,"caption":"Pine marten. (Martes martes)","height":150});
															thumbnails[8266615] = clik.newPhoto({"id":8266615,"src":"Pine-Marten-martes-martes.-42_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266615.html","width":113,"caption":"Pine Marten. (martes martes)","height":150});
															thumbnails[8266644] = clik.newPhoto({"id":8266644,"src":"Pine-Marten-martes-martes.-34_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266644.html","width":100,"caption":"Pine martens. (martes martes)","height":150});
															thumbnails[8266634] = clik.newPhoto({"id":8266634,"src":"Pine-Marten-martes-martes.-32_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266634.html","width":113,"caption":"Pine marten. (martes martes)","height":150});
															thumbnails[8266610] = clik.newPhoto({"id":8266610,"src":"Pine-Marten-martes-martes.-30_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266610.html","width":100,"caption":"Pine marten, (martes martes)","height":150});
															thumbnails[8266604] = clik.newPhoto({"id":8266604,"src":"Pine-Marten-martes-martes.-27_thumb.jpg","galleries_id":440184,"server_id":15,"link":"photo_8266604.html","width":100,"caption":"Pine marten, (martes martes)","height":150});
															thumbnails[8457841] = clik.newPhoto({"id":8457841,"src":"The-Black-Isle-009edit_thumb.jpg","galleries_id":447541,"server_id":15,"link":"photo_8457841.html","width":120,"caption":"","height":160});
															thumbnails[8457856] = clik.newPhoto({"id":8457856,"src":"Red-squirrel-Sciurus-vulgaris-Black-Isle-Scotland_thumb.jpg","galleries_id":447541,"server_id":15,"link":"photo_8457856.html","width":160,"caption":"","height":107});
															thumbnails[8457859] = clik.newPhoto({"id":8457859,"src":"Red-Squirrel-073_thumb.jpg","galleries_id":447541,"server_id":15,"link":"photo_8457859.html","width":160,"caption":"","height":107});
															thumbnails[8516033] = clik.newPhoto({"id":8516033,"src":"Red-Squirrel_thumb.jpg","galleries_id":447541,"server_id":15,"link":"photo_8516033.html","width":160,"caption":"Red Squirrel.","height":107});
															thumbnails[8457888] = clik.newPhoto({"id":8457888,"src":"camera-trap-013_thumb.jpg","galleries_id":447541,"server_id":15,"link":"photo_8457888.html","width":160,"caption":"","height":107});
															thumbnails[8688574] = clik.newPhoto({"id":8688574,"src":"Red-Squirrel-074_thumb.jpg","galleries_id":447541,"server_id":15,"link":"photo_8688574.html","width":160,"caption":"Red Squirrel","height":107});
															thumbnails[8688570] = clik.newPhoto({"id":8688570,"src":"Red-Squirrel-021edit_thumb.jpg","galleries_id":447541,"server_id":15,"link":"photo_8688570.html","width":120,"caption":"Red Squirrel","height":160});
															thumbnails[8752151] = clik.newPhoto({"id":8752151,"src":"The-Black-Isle-056edit_thumb.jpg","galleries_id":447541,"server_id":15,"link":"photo_8752151.html","width":107,"caption":"Red Squirrel","height":160});
															thumbnails[8266557] = clik.newPhoto({"id":8266557,"src":"The-Black-Isle-033edit2_thumb.jpg","galleries_id":440228,"server_id":15,"link":"photo_8266557.html","width":150,"caption":"Bottlenose Dolphin Calf","height":100});
															thumbnails[8266787] = clik.newPhoto({"id":8266787,"src":"The-Black-Isle-034edit_thumb.jpg","galleries_id":440228,"server_id":15,"link":"photo_8266787.html","width":150,"caption":"Bottlenose Dolphin calf. ","height":100});
															thumbnails[8266795] = clik.newPhoto({"id":8266795,"src":"The-Black-Isle-013edit_thumb.jpg","galleries_id":440228,"server_id":15,"link":"photo_8266795.html","width":150,"caption":"Bottlenose Dolphins. ","height":100});
															thumbnails[8266797] = clik.newPhoto({"id":8266797,"src":"breaching-breeze_thumb.jpg","galleries_id":440228,"server_id":15,"link":"photo_8266797.html","width":150,"caption":"Bottlenose Dolphin calf. ","height":100});
															thumbnails[8280266] = clik.newPhoto({"id":8280266,"src":"Bottlenose-dolphin.-Tursiops-truncatus.-Chanonry-Point-069edit_thumb.jpg","galleries_id":440228,"server_id":15,"link":"photo_8280266.html","width":160,"caption":"Bottlenose Dolphin.","height":106});
															thumbnails[8293807] = clik.newPhoto({"id":8293807,"src":"Bottlenose-dolphins-Chanonry-Point-217edit_thumb.jpg","galleries_id":440228,"server_id":15,"link":"photo_8293807.html","width":160,"caption":"Bottlenose Dolphin","height":107});
															thumbnails[8293813] = clik.newPhoto({"id":8293813,"src":"Bottlenose-dolphins-Chanonry-Point-218edit_thumb.jpg","galleries_id":440228,"server_id":15,"link":"photo_8293813.html","width":160,"caption":"Bottlenose Dolphin","height":106});
															thumbnails[8293814] = clik.newPhoto({"id":8293814,"src":"Bottlenose-dolphin-Tursiops-truncatus-Chanonry-Point-041edit_thumb.jpg","galleries_id":440228,"server_id":15,"link":"photo_8293814.html","width":160,"caption":"Bottlenose Dolphin calf","height":106});
															thumbnails[8752152] = clik.newPhoto({"id":8752152,"src":"Red-Deer-028a4_thumb.jpg","galleries_id":461051,"server_id":15,"link":"photo_8752152.html","width":160,"caption":"Red deer stags in velvet","height":106});
															thumbnails[8752157] = clik.newPhoto({"id":8752157,"src":"Red-Deer-card_thumb.jpg","galleries_id":461051,"server_id":15,"link":"photo_8752157.html","width":160,"caption":"Red Deer hinds","height":111});
															thumbnails[8752162] = clik.newPhoto({"id":8752162,"src":"A4-Roe-deer-edit_thumb.jpg","galleries_id":461051,"server_id":15,"link":"photo_8752162.html","width":120,"caption":"Roe Deer","height":160});
															thumbnails[8752191] = clik.newPhoto({"id":8752191,"src":"Red-Deer-Glen-Strathfarrar-042a4_thumb.jpg","galleries_id":461051,"server_id":15,"link":"photo_8752191.html","width":160,"caption":"Red deer stag","height":106});
															thumbnails[8752187] = clik.newPhoto({"id":8752187,"src":"Glen-Straffarrar-017edit_thumb.jpg","galleries_id":461051,"server_id":15,"link":"photo_8752187.html","width":160,"caption":"Red deer stag","height":106});
															thumbnails[8752171] = clik.newPhoto({"id":8752171,"src":"Fox-card_thumb.jpg","galleries_id":461051,"server_id":15,"link":"photo_8752171.html","width":121,"caption":"Red Fox","height":160});
															thumbnails[8752198] = clik.newPhoto({"id":8752198,"src":"Lord-of-the-ring_thumb.jpg","galleries_id":461051,"server_id":15,"link":"photo_8752198.html","width":160,"caption":"Red Deer stags","height":110});
															thumbnails[8688722] = clik.newPhoto({"id":8688722,"src":"small-bw-trial_thumb.jpg","galleries_id":458503,"server_id":15,"link":"photo_8688722.html","width":160,"caption":"Orangutan.","height":106});
															thumbnails[8293826] = clik.newPhoto({"id":8293826,"src":"Bass-Rock-1D-027_thumb.jpg","galleries_id":441328,"server_id":15,"link":"photo_8293826.html","width":107,"caption":"","height":160});
															thumbnails[8293821] = clik.newPhoto({"id":8293821,"src":"Bass-Rock-1D-097edit_thumb.jpg","galleries_id":441328,"server_id":15,"link":"photo_8293821.html","width":106,"caption":"Bass Rock Gannet. ","height":160});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[440184] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Pine marten. ","link":"section529033_440184.html","maxRecords":0.0,"photoIDs":[8266533.0,8266318.0,8266366.0,8266372.0,8266422.0,8266649.0,8266656.0,8266653.0,8266660.0,8266755.0,8266762.0,8266766.0,8266402.0,8266615.0,8266644.0,8266634.0,8266610.0,8266604.0],"skipIndex":0,"section_code":"section529033","featured_images":8266402.0,"id":440184,"singleSection":false});				  						galleries[440228] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Bottlenose dolphins. ","link":"section529033_440228.html","maxRecords":0.0,"photoIDs":[8266557.0,8266787.0,8266795.0,8266797.0,8280266.0,8293807.0,8293813.0,8293814.0],"skipIndex":0,"section_code":"section529033","featured_images":8266787.0,"id":440228,"singleSection":false});				  						galleries[441328] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"The Bass Rock","link":"section529033_441328.html","maxRecords":0.0,"photoIDs":[8688578.0,8688715.0,8293826.0,8293821.0],"skipIndex":0,"section_code":"section529033","featured_images":"8688578,8293826","id":441328,"singleSection":false});				  						galleries[447541] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Red Squirrel","link":"section529033_447541.html","maxRecords":0.0,"photoIDs":[8457841.0,8457856.0,8457859.0,8516033.0,8457888.0,8688574.0,8688570.0,8752151.0],"skipIndex":0,"section_code":"section529033","featured_images":8457841.0,"id":447541,"singleSection":false});				  						galleries[461051] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Highland wildlife","link":"section529033_461051.html","maxRecords":0.0,"photoIDs":[8752152.0,8752157.0,8752162.0,8752191.0,8752187.0,8752171.0,8752198.0],"skipIndex":0,"section_code":"section529033","featured_images":8752162.0,"id":461051,"singleSection":false});				  						galleries[458503] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Travel","link":"section529033_458503.html","maxRecords":0.0,"photoIDs":[8752264.0,8948011.0,8948028.0,8948037.0,8688722.0],"skipIndex":0,"section_code":"section529033","featured_images":8948011.0,"id":458503,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8266557,8688722';
imageSets[2] = '8948011,8688578,8266402,8457841,8266787,8752162,8293826';
imageSets[3] = '8948037,8948028,8948011,8752264,8752198,8752191,8752187,8752171,8752162,8752157,8752152,8752151,8688722,8688715,8688578,8688574,8688570,8516033,8457888,8457859,8457856,8457841,8293826,8293821,8293814,8293813,8293807,8280266,8266797,8266795,8266787,8266766,8266762,8266755,8266660,8266656,8266653,8266649,8266644,8266634,8266615,8266610,8266604,8266557,8266533,8266422,8266402,8266372,8266366,8266318';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/jamesmoore67/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/jamesmoore67/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'section529033.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'section529033' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'James Alan Moore: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* 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, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

