window.thumbnails = {};
															thumbnails[2805496] = clik.newPhoto({"id":2805496,"src":"station-train-les houches-sml_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Mont Blanc Express leaves Les Houches Station","height":194});
															thumbnails[7537345] = clik.newPhoto({"id":7537345,"src":"APRCAMEOWHITEWEDDING_l2_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Wedding DVD case","height":128});
															thumbnails[7537348] = clik.newPhoto({"id":7537348,"src":"APRCAMEOWHITEWEDDING_l_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":142});
															thumbnails[2805509] = clik.newPhoto({"id":2805509,"src":"mont blanc_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"Cable car reaches the summit of the Aiguille du Midi as seens from Les Houches","height":47});
															thumbnails[2805499] = clik.newPhoto({"id":2805499,"src":"tgv-blasts-past_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"TGV Blasts through Lyon St Exupery Station","height":70});
															thumbnails[2760196] = clik.newPhoto({"id":2760196,"src":"brides-girls-02332_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2760196.html","width":130,"caption":"Happy Day!","height":182});
															thumbnails[5691591] = clik.newPhoto({"id":5691591,"src":"white_vignette_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_5691591.html","width":130,"caption":"","height":182});
															thumbnails[2785393] = clik.newPhoto({"id":2785393,"src":"louise-girls-00511_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2785393.html","width":130,"caption":"Girls just wanna have fun.......","height":90});
															thumbnails[2326509] = clik.newPhoto({"id":2326509,"src":"fire-watchers-5a-entry1_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_2326509.html","width":130,"caption":"The Fire Watchers..... sometimes the audience has something more interesting to say...","height":86});
															thumbnails[7422872] = clik.newPhoto({"id":7422872,"src":"DebbieC3_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_7422872.html","width":130,"caption":"Lighting Up the Room","height":155});
															thumbnails[2804024] = clik.newPhoto({"id":2804024,"src":"michael-mara-sml_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_2804024.html","width":130,"caption":"Michael Marra","height":195});
															thumbnails[2346755] = clik.newPhoto({"id":2346755,"src":"still life-00626_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2346755.html","width":130,"caption":"A tour guide shows visitors round Glenkinchie Distillery, near Edinburgh.","height":87});
															thumbnails[6611685] = clik.newPhoto({"id":6611685,"src":"Kevin-Madia-sml-00892_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_6611685.html","width":130,"caption":"Yay!","height":87});
															thumbnails[3079035] = clik.newPhoto({"id":3079035,"src":"Fiona Rutherford-14-10-03-DSC01075-sml_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_3079035.html","width":130,"caption":"Fiona Rutherford, Clarsach Player.","height":195});
															thumbnails[2804652] = clik.newPhoto({"id":2804652,"src":"boys-crest-02084-sml_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2804652.html","width":130,"caption":"The Boys on Tinto Hill","height":37});
															thumbnails[5329742] = clik.newPhoto({"id":5329742,"src":"wynd1_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_5329742.html","width":130,"caption":"Closer","height":182});
															thumbnails[3184467] = clik.newPhoto({"id":3184467,"src":"morag-phil-12-36-16_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_3184467.html","width":130,"caption":"Morag looks out over the Border Country.....","height":91});
															thumbnails[2784695] = clik.newPhoto({"id":2784695,"src":"lighthouse1_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2784695.html","width":130,"caption":"St. Abbs Head - Lighting the Way","height":87});
															thumbnails[2774094] = clik.newPhoto({"id":2774094,"src":"place-setting1_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2774094.html","width":130,"caption":"The table is set.....","height":104});
															thumbnails[5005933] = clik.newPhoto({"id":5005933,"src":"Davina_McCall_-_Just_Dance_Panel-02173-sml_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_5005933.html","width":130,"caption":"Sky TV's \"Just Dance\" Judges<br>\r\nL-R Andy Garcia, Davina McCall, Kimberley Wyatt and Ashlee","height":196});
															thumbnails[3186491] = clik.newPhoto({"id":3186491,"src":"morag-phil-girls-09846_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_3186491.html","width":130,"caption":"The sun shines at the end of  lovely day.....","height":87});
															thumbnails[2760193] = clik.newPhoto({"id":2760193,"src":"balloon1-00471_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2760193.html","width":130,"caption":"Party Time!","height":195});
															thumbnails[2774059] = clik.newPhoto({"id":2774059,"src":"wheat7-00023_thumb.jpg","galleries_id":192482,"server_id":32,"link":"photo_2774059.html","width":130,"caption":"\"All good gifts around us are sent from Heaven above......\"","height":87});
															thumbnails[2784763] = clik.newPhoto({"id":2784763,"src":"parly-1_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2784763.html","width":130,"caption":"Holyrood Parliament Debting Chamber - a classic view.","height":194});
															thumbnails[2774049] = clik.newPhoto({"id":2774049,"src":"jess portrait2_thumb.jpg","galleries_id":173802,"server_id":32,"link":"photo_2774049.html","width":130,"caption":"Sitting pretty and ready for school!","height":194});
															thumbnails[2804028] = clik.newPhoto({"id":2804028,"src":"parallels- dancers 4-01329-825-sml_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_2804028.html","width":130,"caption":"Dancers working...","height":132});
															thumbnails[2790943] = clik.newPhoto({"id":2790943,"src":"lothian-chambers2-sml_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2790943.html","width":130,"caption":"Lothian Chambers - Edinburgh's superb civil wedding venue.","height":194});
															thumbnails[2804755] = clik.newPhoto({"id":2804755,"src":"kiss2-bw_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2804755.html","width":130,"caption":"Kiss.......","height":140});
															thumbnails[2803921] = clik.newPhoto({"id":2803921,"src":"cd-proj-05973-sml_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2803921.html","width":130,"caption":"Craigmillar Castle","height":87});
															thumbnails[2804021] = clik.newPhoto({"id":2804021,"src":"Parallels - dancers33-01362-sml_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_2804021.html","width":130,"caption":"Reflecting on herself.......","height":195});
															thumbnails[3138743] = clik.newPhoto({"id":3138743,"src":"hot-pink_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_3138743.html","width":130,"caption":"Hot Pink Rocks by Rocca Gutteridge","height":87});
															thumbnails[3106351] = clik.newPhoto({"id":3106351,"src":"sean_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_3106351.html","width":130,"caption":"Sir Sean Connery works the line...","height":173});
															thumbnails[2778567] = clik.newPhoto({"id":2778567,"src":"richard jenkins1-08589_thumb.jpg","galleries_id":173802,"server_id":32,"link":"photo_2778567.html","width":130,"caption":"Richard Jenkins, (Nathan in \"Six Feet Under\")","height":87});
															thumbnails[2778666] = clik.newPhoto({"id":2778666,"src":"kissable-keira-08443_thumb.jpg","galleries_id":173802,"server_id":32,"link":"photo_2778666.html","width":130,"caption":"Keira at the Castle","height":176});
															thumbnails[2804703] = clik.newPhoto({"id":2804703,"src":"steill1-02093-website_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2804703.html","width":130,"caption":"Tinto Hill Summit","height":195});
															thumbnails[2785600] = clik.newPhoto({"id":2785600,"src":"fern4_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2785600.html","width":130,"caption":"Fractal Fern","height":78});
															thumbnails[2785601] = clik.newPhoto({"id":2785601,"src":"bassrock_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2785601.html","width":130,"caption":"Dunbar and Bass Rock","height":52});
															thumbnails[2785387] = clik.newPhoto({"id":2785387,"src":"bridal rock_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2785387.html","width":130,"caption":"The Sea's Veil.....","height":87});
															thumbnails[2785602] = clik.newPhoto({"id":2785602,"src":"begonia_thumb.jpg","galleries_id":192482,"server_id":32,"link":"photo_2785602.html","width":130,"caption":"Begonia","height":116});
															thumbnails[7422962] = clik.newPhoto({"id":7422962,"src":"lisab_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_7422962.html","width":130,"caption":"The Wedding Party!","height":93});
															thumbnails[2785389] = clik.newPhoto({"id":2785389,"src":"princes-street3_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2785389.html","width":130,"caption":"Princes Street, Edinburgh","height":194});
															thumbnails[2790973] = clik.newPhoto({"id":2790973,"src":"caitlyn_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2790973.html","width":130,"caption":"Bridesmaid waits.....","height":103});
															thumbnails[7422960] = clik.newPhoto({"id":7422960,"src":"couple-chambers_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_7422960.html","width":130,"caption":"Just Married","height":182});
															thumbnails[2790961] = clik.newPhoto({"id":2790961,"src":"chambers2_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2790961.html","width":130,"caption":"Lothian Chambers, Edinburgh's year round  Civic Wedding Venue","height":87});
															thumbnails[2790017] = clik.newPhoto({"id":2790017,"src":"rainbow2-08382_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2790017.html","width":130,"caption":"Smearbow - a phenomenon regularly seen in the Eastern Forth of Forth.","height":119});
															thumbnails[7422963] = clik.newPhoto({"id":7422963,"src":"4742518513_10a57e0409_o_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_7422963.html","width":130,"caption":"The Rings of Marriage","height":195});
															thumbnails[2790984] = clik.newPhoto({"id":2790984,"src":"rodo_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2790984.html","width":130,"caption":"Rodo Handbags","height":77});
															thumbnails[7422494] = clik.newPhoto({"id":7422494,"src":"Tess-Lying-01787_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_7422494.html","width":130,"caption":"Just married..","height":195});
															thumbnails[3138759] = clik.newPhoto({"id":3138759,"src":"hover flies_thumb.jpg","galleries_id":192482,"server_id":32,"link":"photo_3138759.html","width":130,"caption":"Hoverflies on poppy","height":119});
															thumbnails[3161764] = clik.newPhoto({"id":3161764,"src":"lulu-handbag_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_3161764.html","width":130,"caption":"Lulu Guinness Hanbag, shot for www.sublimehandbaghire.com","height":151});
															thumbnails[2326633] = clik.newPhoto({"id":2326633,"src":"craigellachie bridge-8333-guardian_thumb.jpg","galleries_id":152942,"server_id":32,"link":"photo_2326633.html","width":130,"caption":"Craigellachie Bridge at Midnight","height":87});
															thumbnails[3138744] = clik.newPhoto({"id":3138744,"src":"rocca1-01085-sml_thumb.jpg","galleries_id":173802,"server_id":32,"link":"photo_3138744.html","width":130,"caption":"Rocca Gutteridge in her studio at Edinburgh Sculpture Workshop.","height":87});
															thumbnails[5326605] = clik.newPhoto({"id":5326605,"src":"poppies_thumb.jpg","galleries_id":192482,"server_id":32,"link":"photo_5326605.html","width":130,"caption":"Poppies.....","height":93});
															thumbnails[5121413] = clik.newPhoto({"id":5121413,"src":"Davina_McCall_-_Just_Dance_Panel-02173_thumb.jpg","galleries_id":151779,"server_id":32,"link":"photo_5121413.html","width":130,"caption":"Andy Garcia, Davina McCall, Kimberley Wyatt and Ashlee Banjo, the Just Dance Judging Panel. ","height":196});
															thumbnails[2760203] = clik.newPhoto({"id":2760203,"src":"bride-flowers1-07692_thumb.jpg","galleries_id":152945,"server_id":32,"link":"photo_2760203.html","width":130,"caption":"Bouquet.......","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[322401] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Private","link":"gallery_322401.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":322401,"singleSection":false});				  						galleries[152942] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Scotland","link":"gallery_152942.html","maxRecords":0.0,"photoIDs":[2346755.0,2804652.0,2784695.0,2784763.0,2803921.0,2804703.0,2785600.0,2785601.0,2785387.0,2785389.0,2790017.0,2326633.0],"skipIndex":0,"section_code":"gallery","featured_images":"2804703,2804652,2803921,2790017,2785600,2785389,2785387,2784763,2326633","id":152942,"singleSection":false});				  						galleries[152945] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings and.....","link":"gallery_152945.html","maxRecords":0.0,"photoIDs":[2760196.0,5691591.0,2785393.0,7422872.0,6611685.0,5329742.0,3184467.0,2774094.0,3186491.0,2760193.0,2790943.0,2804755.0,7422962.0,2790973.0,7422960.0,2790961.0,7422963.0,2790984.0,7422494.0,2760203.0],"skipIndex":0,"section_code":"gallery","featured_images":"7422963,7422962,7422960,7422872,7422494,6611685,5691591,5329742,3186491,3184467,2790984,2790973,2790943,2760203","id":152945,"singleSection":false});				  						galleries[192482] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nature","link":"gallery_192482.html","maxRecords":0.0,"photoIDs":[2774059.0,2785602.0,3138759.0,5326605.0],"skipIndex":0,"section_code":"gallery","featured_images":"3138759,2774059","id":192482,"singleSection":false});				  						galleries[173802] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_173802.html","maxRecords":0.0,"photoIDs":[2774049.0,2778567.0,2778666.0,3138744.0],"skipIndex":0,"section_code":"gallery","featured_images":"3138744,2778567,2774049","id":173802,"singleSection":false});				  						galleries[151779] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Arts","link":"gallery_151779.html","maxRecords":0.0,"photoIDs":[2326509.0,2804024.0,3079035.0,5005933.0,2804028.0,2804021.0,3138743.0,3106351.0,3161764.0,5121413.0],"skipIndex":0,"section_code":"gallery","featured_images":"5121413,5005933,3161764,3138743,3106351,3079035,2804028,2804024,2804021","id":151779,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7422963,7422962,7422960,7422872,7422494,6611685,5329742,5326605,5121413,5005933,3186491,3184467,3138744,3138743,3106351,3079035,2804755,2804028,2804024,2804021,2803921,2790973,2785602,2785387,2784695,2778666,2774094,2774059,2774049,2760203,2326633';
imageSets[2] = '7422963,7422962,7422960,7422872,7422494,6611685,5691591,5329742,5121413,5005933,3186491,3184467,3161764,3138759,3138744,3138743,3106351,3079035,2805509,2805499,2805496,2804703,2804652,2804028,2804024,2804021,2803921,2790984,2790973,2790943,2790017,2785600,2785389,2785387,2784763,2778567,2774059,2774049,2760203,2326633';
imageSets[3] = '5691591';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/maxblinkhorn/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/maxblinkhorn/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 && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.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 && 'gallery' != '') {
					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 = 'GetShot!Photography: ' + 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.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			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({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* 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;
	}
}

			

