window.thumbnails = {};
															thumbnails[8468132] = clik.newPhoto({"id":8468132,"src":"Two_bridges_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_8468132.html","width":130,"caption":"Two bridges","height":92});
															thumbnails[9003926] = clik.newPhoto({"id":9003926,"src":"146_Rose_arch_10x8_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_9003926.html","width":130,"caption":"Rose Arch","height":163});
															thumbnails[9003896] = clik.newPhoto({"id":9003896,"src":"143_Poppy_field_ASz_6594F7C8-24E8-5EC4-4F2032048C902C9D_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_9003896.html","width":130,"caption":"Poppy field","height":92});
															thumbnails[7637356] = clik.newPhoto({"id":7637356,"src":"108_Where_have_you_been_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7637356.html","width":130,"caption":"Where have you been?","height":104});
															thumbnails[7637295] = clik.newPhoto({"id":7637295,"src":"106_Water_falling_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7637295.html","width":130,"caption":"Water falling","height":104});
															thumbnails[7637288] = clik.newPhoto({"id":7637288,"src":"104_Woodland_sunset_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7637288.html","width":130,"caption":"Woodland sunset","height":196});
															thumbnails[9003891] = clik.newPhoto({"id":9003891,"src":"105_Mossy_vein_6755F74C-1EC9-D45B-1CC982757134F626_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_9003891.html","width":130,"caption":"Mossy vein","height":92});
															thumbnails[9003883] = clik.newPhoto({"id":9003883,"src":"103_Dome_68C0DF14-1EC9-D45B-1CDA705984B4BCA9_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_9003883.html","width":130,"caption":"Dome","height":104});
															thumbnails[7628822] = clik.newPhoto({"id":7628822,"src":"098_High_Force_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628822.html","width":130,"caption":"High Force","height":163});
															thumbnails[7628824] = clik.newPhoto({"id":7628824,"src":"100_Hilltop_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628824.html","width":130,"caption":"Hilltop","height":86});
															thumbnails[7628835] = clik.newPhoto({"id":7628835,"src":"097_Post_here_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628835.html","width":130,"caption":"Post here","height":196});
															thumbnails[7628811] = clik.newPhoto({"id":7628811,"src":"102_Flash_of_yellow_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628811.html","width":130,"caption":"Flash of yellow","height":86});
															thumbnails[7628840] = clik.newPhoto({"id":7628840,"src":"101_Starlets_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628840.html","width":130,"caption":"Starlets","height":86});
															thumbnails[7628845] = clik.newPhoto({"id":7628845,"src":"073_Through_and_beyond_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628845.html","width":130,"caption":"Through and beyond","height":196});
															thumbnails[7628827] = clik.newPhoto({"id":7628827,"src":"026_London_night_sky_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628827.html","width":130,"caption":"London night sky","height":86});
															thumbnails[7277687] = clik.newPhoto({"id":7277687,"src":"152_Bulbs_ASz_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7277687.html","width":130,"caption":"Bulbs","height":92});
															thumbnails[7277691] = clik.newPhoto({"id":7277691,"src":"004_Action_heroes_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7277691.html","width":130,"caption":"Action heroes","height":86});
															thumbnails[7277693] = clik.newPhoto({"id":7277693,"src":"011_An_old_couple_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7277693.html","width":130,"caption":"An old couple","height":86});
															thumbnails[7277695] = clik.newPhoto({"id":7277695,"src":"153_From_the_rubble_ASz_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7277695.html","width":130,"caption":"From the rubble...","height":184});
															thumbnails[7277696] = clik.newPhoto({"id":7277696,"src":"010_Palette_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7277696.html","width":130,"caption":"Palette","height":196});
															thumbnails[7628810] = clik.newPhoto({"id":7628810,"src":"008_Fingers_in_the_sky_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628810.html","width":130,"caption":"Fingers in the sky","height":196});
															thumbnails[7628826] = clik.newPhoto({"id":7628826,"src":"018_Labyrinth_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628826.html","width":130,"caption":"Labyrinth","height":86});
															thumbnails[7215885] = clik.newPhoto({"id":7215885,"src":"Nature-1-2_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7215885.html","width":130,"caption":"Snowy boulevard","height":195});
															thumbnails[7215894] = clik.newPhoto({"id":7215894,"src":"Archi-1_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7215894.html","width":130,"caption":"Battersea Power Station","height":86});
															thumbnails[7215796] = clik.newPhoto({"id":7215796,"src":"142_Prism_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7215796.html","width":130,"caption":"Prism","height":92});
															thumbnails[7215743] = clik.newPhoto({"id":7215743,"src":"City-1-4_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7215743.html","width":130,"caption":"Horseguard","height":86});
															thumbnails[7277141] = clik.newPhoto({"id":7277141,"src":"002_Lines_and_curves_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7277141.html","width":130,"caption":"Lines and curves","height":196});
															thumbnails[7114347] = clik.newPhoto({"id":7114347,"src":"052_Two_towers_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7114347.html","width":130,"caption":"Two Towers","height":196});
															thumbnails[7111264] = clik.newPhoto({"id":7111264,"src":"041_Old_and_new_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7111264.html","width":130,"caption":"Old and new","height":130});
															thumbnails[7277140] = clik.newPhoto({"id":7277140,"src":"001_White_spire_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7277140.html","width":130,"caption":"White spire","height":196});
															thumbnails[7107134] = clik.newPhoto({"id":7107134,"src":"046_Peace_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7107134.html","width":130,"caption":"Peace","height":86});
															thumbnails[7628843] = clik.newPhoto({"id":7628843,"src":"084_Supper_at_sunset_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628843.html","width":130,"caption":"Supper at sunset","height":86});
															thumbnails[7628847] = clik.newPhoto({"id":7628847,"src":"048_Whither_ASz_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628847.html","width":130,"caption":"Whither","height":183});
															thumbnails[7628838] = clik.newPhoto({"id":7628838,"src":"039_Skywards_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628838.html","width":130,"caption":"Skywards","height":86});
															thumbnails[7628803] = clik.newPhoto({"id":7628803,"src":"090_Crane_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628803.html","width":130,"caption":"Crane","height":86});
															thumbnails[7634303] = clik.newPhoto({"id":7634303,"src":"Jamie1_6CE1E185-24E8-5EC4-4FA0D9AF8A607072_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7634303.html","width":130,"caption":"JG","height":130});
															thumbnails[7628830] = clik.newPhoto({"id":7628830,"src":"087_Magnolia_blossom_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628830.html","width":130,"caption":"Magnolia Blossom","height":86});
															thumbnails[5932777] = clik.newPhoto({"id":5932777,"src":"086_Sentinels_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5932777.html","width":130,"caption":"Sentinels","height":56});
															thumbnails[9003848] = clik.newPhoto({"id":9003848,"src":"031_Sea_dog_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_9003848.html","width":130,"caption":"Sea Dog","height":86});
															thumbnails[9003875] = clik.newPhoto({"id":9003875,"src":"085_Shimmering_tree_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_9003875.html","width":130,"caption":"Shimmering Tree","height":195});
															thumbnails[7628833] = clik.newPhoto({"id":7628833,"src":"033_Meditation_at_sea_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_7628833.html","width":130,"caption":"Meditation at sea","height":86});
															thumbnails[5896774] = clik.newPhoto({"id":5896774,"src":"154_Old_to_new_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5896774.html","width":130,"caption":"Old to new","height":92});
															thumbnails[5896785] = clik.newPhoto({"id":5896785,"src":"155_Dark_Night_ASz_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5896785.html","width":130,"caption":"Dark night","height":184});
															thumbnails[5896863] = clik.newPhoto({"id":5896863,"src":"094_Web_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5896863.html","width":130,"caption":"Web","height":130});
															thumbnails[5896867] = clik.newPhoto({"id":5896867,"src":"091_Escape_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5896867.html","width":130,"caption":"Escape","height":195});
															thumbnails[5898359] = clik.newPhoto({"id":5898359,"src":"David_Rhys-0184_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5898359.html","width":130,"caption":"DR","height":196});
															thumbnails[5898378] = clik.newPhoto({"id":5898378,"src":"Soldier_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5898378.html","width":130,"caption":"Soldier","height":130});
															thumbnails[5898383] = clik.newPhoto({"id":5898383,"src":"DSC_0063_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5898383.html","width":130,"caption":"MT","height":196});
															thumbnails[5898386] = clik.newPhoto({"id":5898386,"src":"Ben_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5898386.html","width":130,"caption":"BS","height":130});
															thumbnails[5898390] = clik.newPhoto({"id":5898390,"src":"Stuart_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5898390.html","width":130,"caption":"SB","height":86});
															thumbnails[5898403] = clik.newPhoto({"id":5898403,"src":"Puppy_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5898403.html","width":130,"caption":"Puppy","height":86});
															thumbnails[5898416] = clik.newPhoto({"id":5898416,"src":"Gareth__Sam-0103_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5898416.html","width":130,"caption":"Sleepy dog","height":86});
															thumbnails[5898421] = clik.newPhoto({"id":5898421,"src":"Prague-0156_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5898421.html","width":130,"caption":"Musician","height":196});
															thumbnails[5932792] = clik.newPhoto({"id":5932792,"src":"DSC_0204_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5932792.html","width":130,"caption":"Don't mess with me","height":130});
															thumbnails[5932855] = clik.newPhoto({"id":5932855,"src":"093_Spirals_thumb.jpg","galleries_id":413722,"server_id":5,"link":"photo_5932855.html","width":130,"caption":"Spirals","height":86});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[413722] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery","link":"section495152.html","maxRecords":0.0,"photoIDs":[8468132.0,9003926.0,9003896.0,7637356.0,7637295.0,7637288.0,9003891.0,9003883.0,7628822.0,7628824.0,7628835.0,7628811.0,7628840.0,7628845.0,7628827.0,7277687.0,7277691.0,7277693.0,7277695.0,7277696.0,7628810.0,7628826.0,7215885.0,7215894.0,7215796.0,7215743.0,7277141.0,7114347.0,7111264.0,7277140.0,7107134.0,7628843.0,7628847.0,7628838.0,7628803.0,7634303.0,7628830.0,5932777.0,9003848.0,9003875.0,7628833.0,5896774.0,5896785.0,5896863.0,5896867.0,5898359.0,5898378.0,5898383.0,5898386.0,5898390.0,5898403.0,5898416.0,5898421.0,5932792.0,5932855.0],"skipIndex":0,"section_code":"section495152","featured_images":7277687.0,"id":413722,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[241249] = '9003926,9003896,9003891,9003875,7637356,7637295,7637288,7628847,7628843,7628840,7628833,7628830,7628824,7628822,7628811,7277696,7215885,7215796,7107134,5932792,5932777';
imageSets[241247] = '9003848,7634303,5898421,5898416,5898403,5898390,5898386,5898383,5898378,5898359';
imageSets[241248] = '9003883,8468132,7628845,7628838,7628835,7628827,7628826,7628810,7628803,7277695,7277691,7277141,7277140,7215894,7114347,7111264,5932855,5896867,5896863,5896785,5896774';
imageSets[1] = '9003926,9003896,9003891,9003883,9003875,9003848,8468132,7637295,7628847,7628838,7628835,7628830,7628827,7628824,7628810,7628803,7277696,7277695,7277693,7277141,7277140,7215894,7215885,7215796,7215743,7114347,7111264,7107134,5932855,5932777,5898421,5896867,5896774';
imageSets[2] = '7277687';
imageSets[3] = '7277687,7215894,7215885,7215743,7114347,5932792,5898421,5898416,5898383,5898359';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/simongregorphoto/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/simongregorphoto/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 += 'section495152.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 && 'section495152' != '') {
					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 = 'simongregorphoto.com: ' + 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> &pound;' + (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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="simon@littlewidbury.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="simon@littlewidbury.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

