window.thumbnails = {};
															thumbnails[3589155] = clik.newPhoto({"id":3589155,"src":"P6200755_thumb.jpg","galleries_id":219310,"server_id":32,"link":"photo_3589155.html","width":130,"caption":"","height":173});
															thumbnails[9031560] = clik.newPhoto({"id":9031560,"src":"IMG_1364wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9031560.html","width":260,"caption":"","height":88});
															thumbnails[9031909] = clik.newPhoto({"id":9031909,"src":"015wtmk_thumb.JPG","galleries_id":219310,"server_id":32,"link":"photo_9031909.html","width":260,"caption":"","height":347});
															thumbnails[9031911] = clik.newPhoto({"id":9031911,"src":"bbwtmk_thumb.jpg","galleries_id":219310,"server_id":32,"link":"photo_9031911.html","width":260,"caption":"","height":195});
															thumbnails[9031913] = clik.newPhoto({"id":9031913,"src":"fmnwtmk_thumb.jpg","galleries_id":219310,"server_id":32,"link":"photo_9031913.html","width":260,"caption":"","height":195});
															thumbnails[9031915] = clik.newPhoto({"id":9031915,"src":"P6272850wtmk_thumb.jpg","galleries_id":219310,"server_id":32,"link":"photo_9031915.html","width":260,"caption":"","height":195});
															thumbnails[9031917] = clik.newPhoto({"id":9031917,"src":"P9013175wtmk_thumb.jpg","galleries_id":219310,"server_id":32,"link":"photo_9031917.html","width":260,"caption":"","height":347});
															thumbnails[9031928] = clik.newPhoto({"id":9031928,"src":"FRBRwtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031928.html","width":260,"caption":"","height":195});
															thumbnails[9031932] = clik.newPhoto({"id":9031932,"src":"braemarwtmk1_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031932.html","width":260,"caption":"","height":184});
															thumbnails[9031935] = clik.newPhoto({"id":9031935,"src":"CGSwtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031935.html","width":260,"caption":"","height":195});
															thumbnails[9031936] = clik.newPhoto({"id":9031936,"src":"Chatsworth1wtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031936.html","width":260,"caption":"","height":192});
															thumbnails[9031938] = clik.newPhoto({"id":9031938,"src":"Jeremywtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031938.html","width":260,"caption":"","height":224});
															thumbnails[9031939] = clik.newPhoto({"id":9031939,"src":"LDwtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031939.html","width":260,"caption":"","height":195});
															thumbnails[9031941] = clik.newPhoto({"id":9031941,"src":"nine_ladieswtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031941.html","width":260,"caption":"","height":195});
															thumbnails[9031943] = clik.newPhoto({"id":9031943,"src":"P5111604wtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031943.html","width":260,"caption":"","height":195});
															thumbnails[9031945] = clik.newPhoto({"id":9031945,"src":"P5261737wtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031945.html","width":260,"caption":"","height":195});
															thumbnails[9031946] = clik.newPhoto({"id":9031946,"src":"P6111958wtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031946.html","width":260,"caption":"","height":195});
															thumbnails[9031955] = clik.newPhoto({"id":9031955,"src":"P7022859wtmk_thumb.JPG","galleries_id":142481,"server_id":32,"link":"photo_9031955.html","width":260,"caption":"","height":195});
															thumbnails[9031958] = clik.newPhoto({"id":9031958,"src":"P7070769wtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031958.html","width":260,"caption":"","height":195});
															thumbnails[9031960] = clik.newPhoto({"id":9031960,"src":"PC013248wtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031960.html","width":260,"caption":"","height":347});
															thumbnails[9031962] = clik.newPhoto({"id":9031962,"src":"PC033297wtmk_thumb.JPG","galleries_id":142481,"server_id":32,"link":"photo_9031962.html","width":260,"caption":"","height":195});
															thumbnails[9031963] = clik.newPhoto({"id":9031963,"src":"PC033305wtmk_thumb.JPG","galleries_id":142481,"server_id":32,"link":"photo_9031963.html","width":260,"caption":"","height":195});
															thumbnails[9031965] = clik.newPhoto({"id":9031965,"src":"SVwtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031965.html","width":260,"caption":"","height":195});
															thumbnails[9031966] = clik.newPhoto({"id":9031966,"src":"WSRwtmk_thumb.jpg","galleries_id":142481,"server_id":32,"link":"photo_9031966.html","width":260,"caption":"","height":195});
															thumbnails[9032152] = clik.newPhoto({"id":9032152,"src":"HMS_Belfastwtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9032152.html","width":260,"caption":"","height":150});
															thumbnails[9032153] = clik.newPhoto({"id":9032153,"src":"Parliamentwtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9032153.html","width":260,"caption":"","height":160});
															thumbnails[9032154] = clik.newPhoto({"id":9032154,"src":"St_Paulswtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9032154.html","width":260,"caption":"","height":355});
															thumbnails[9032155] = clik.newPhoto({"id":9032155,"src":"Tower_Bridgewtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9032155.html","width":260,"caption":"","height":195});
															thumbnails[9032157] = clik.newPhoto({"id":9032157,"src":"Over_Haddon_2_HDRwtmk_thumb.jpg","galleries_id":472063,"server_id":32,"link":"photo_9032157.html","width":260,"caption":"","height":195});
															thumbnails[9032158] = clik.newPhoto({"id":9032158,"src":"Over_Haddon_HDRwtmk_thumb.jpg","galleries_id":472063,"server_id":32,"link":"photo_9032158.html","width":260,"caption":"","height":195});
															thumbnails[9032162] = clik.newPhoto({"id":9032162,"src":"Raiper_Bridge_HDRwtmk_thumb.jpg","galleries_id":472063,"server_id":32,"link":"photo_9032162.html","width":260,"caption":"","height":183});
															thumbnails[9032680] = clik.newPhoto({"id":9032680,"src":"IMG_0876wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9032680.html","width":260,"caption":"","height":348});
															thumbnails[9032682] = clik.newPhoto({"id":9032682,"src":"IMG_0905wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9032682.html","width":260,"caption":"","height":386});
															thumbnails[9032686] = clik.newPhoto({"id":9032686,"src":"IMG_0946wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9032686.html","width":260,"caption":"","height":348});
															thumbnails[9032696] = clik.newPhoto({"id":9032696,"src":"IMG_1005wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9032696.html","width":260,"caption":"","height":298});
															thumbnails[9032707] = clik.newPhoto({"id":9032707,"src":"IMG_1069wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9032707.html","width":260,"caption":"","height":258});
															thumbnails[9032737] = clik.newPhoto({"id":9032737,"src":"IMG_1099wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9032737.html","width":260,"caption":"","height":367});
															thumbnails[9032746] = clik.newPhoto({"id":9032746,"src":"P1104922_3_4_tonemapped_Snapseedwtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9032746.html","width":260,"caption":"","height":347});
															thumbnails[9034181] = clik.newPhoto({"id":9034181,"src":"IMG_1093wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9034181.html","width":260,"caption":"","height":454});
															thumbnails[9034186] = clik.newPhoto({"id":9034186,"src":"IMG_1357wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9034186.html","width":260,"caption":"","height":340});
															thumbnails[9034189] = clik.newPhoto({"id":9034189,"src":"P4033703wtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9034189.html","width":260,"caption":"","height":347});
															thumbnails[9034191] = clik.newPhoto({"id":9034191,"src":"P5242701wtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9034191.html","width":260,"caption":"","height":347});
															thumbnails[9034194] = clik.newPhoto({"id":9034194,"src":"P4103836wtmk_thumb.JPG","galleries_id":142481,"server_id":32,"link":"photo_9034194.html","width":260,"caption":"","height":190});
															thumbnails[9034196] = clik.newPhoto({"id":9034196,"src":"PC033281wtmk_thumb.JPG","galleries_id":142481,"server_id":32,"link":"photo_9034196.html","width":260,"caption":"","height":195});
															thumbnails[9034256] = clik.newPhoto({"id":9034256,"src":"IMG_0790wtmk_thumb.jpg","galleries_id":219338,"server_id":32,"link":"photo_9034256.html","width":260,"caption":"","height":195});
															thumbnails[9034308] = clik.newPhoto({"id":9034308,"src":"P3193657wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9034308.html","width":260,"caption":"","height":195});
															thumbnails[9036740] = clik.newPhoto({"id":9036740,"src":"P6122756_tonemappedwtmk_thumb.jpg","galleries_id":472063,"server_id":32,"link":"photo_9036740.html","width":260,"caption":"","height":195});
															thumbnails[9036741] = clik.newPhoto({"id":9036741,"src":"PB283209_tonemappedwtmk_thumb.jpg","galleries_id":472063,"server_id":32,"link":"photo_9036741.html","width":260,"caption":"","height":195});
															thumbnails[9036852] = clik.newPhoto({"id":9036852,"src":"P3143599_Snapseedwtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9036852.html","width":260,"caption":"","height":195});
															thumbnails[9036952] = clik.newPhoto({"id":9036952,"src":"P5282728_Snapseedwtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9036952.html","width":260,"caption":"","height":195});
															thumbnails[9037794] = clik.newPhoto({"id":9037794,"src":"Battersea_reach_tonemappedwtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9037794.html","width":260,"caption":"","height":195});
															thumbnails[9039471] = clik.newPhoto({"id":9039471,"src":"P4303944_Snapseedwtmk_thumb.jpg","galleries_id":219338,"server_id":32,"link":"photo_9039471.html","width":260,"caption":"","height":195});
															thumbnails[9039620] = clik.newPhoto({"id":9039620,"src":"P1043403_Snapseedwtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9039620.html","width":260,"caption":"","height":186});
															thumbnails[9040005] = clik.newPhoto({"id":9040005,"src":"PC033283_tonemappedwtmk_thumb.jpg","galleries_id":472063,"server_id":32,"link":"photo_9040005.html","width":260,"caption":"","height":195});
															thumbnails[9040053] = clik.newPhoto({"id":9040053,"src":"Brian_Smithwtmk_thumb.jpg","galleries_id":219338,"server_id":32,"link":"photo_9040053.html","width":260,"caption":"","height":195});
															thumbnails[9062441] = clik.newPhoto({"id":9062441,"src":"P5294120wtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9062441.html","width":260,"caption":"","height":169});
															thumbnails[9068113] = clik.newPhoto({"id":9068113,"src":"P1284951_3wtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9068113.html","width":260,"caption":"","height":195});
															thumbnails[9069903] = clik.newPhoto({"id":9069903,"src":"P1284951-1wtmk_thumb.jpg","galleries_id":450958,"server_id":32,"link":"photo_9069903.html","width":260,"caption":"","height":195});
															thumbnails[9031712] = clik.newPhoto({"id":9031712,"src":"IMG_0885wtmk_thumb.JPG","galleries_id":450958,"server_id":32,"link":"photo_9031712.html","width":260,"caption":"","height":56});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[142481] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The Peak District","link":"gallery_142481.html","maxRecords":0.0,"photoIDs":[9031928.0,9031932.0,9031935.0,9031936.0,9031938.0,9031939.0,9031941.0,9031943.0,9031945.0,9031946.0,9031955.0,9031958.0,9031960.0,9031962.0,9031963.0,9031965.0,9031966.0,9034194.0,9034196.0],"skipIndex":0,"section_code":"gallery","featured_images":"9031966,9031958,9031941,9031936,9031935,9031928","id":142481,"singleSection":false});				  						galleries[219310] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Flora and Fauna","link":"gallery_219310.html","maxRecords":0.0,"photoIDs":[3589155.0,9031909.0,9031911.0,9031913.0,9031915.0,9031917.0],"skipIndex":0,"section_code":"gallery","featured_images":"9031913,9031909","id":219310,"singleSection":false});				  						galleries[219338] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_219338.html","maxRecords":0.0,"photoIDs":[9034256.0,9039471.0,9040053.0],"skipIndex":0,"section_code":"gallery","featured_images":9034256.0,"id":219338,"singleSection":false});				  						galleries[450958] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The London Project","link":"gallery_450958.html","maxRecords":0.0,"photoIDs":[9031560.0,9032152.0,9032153.0,9032154.0,9032155.0,9032680.0,9032682.0,9032686.0,9032696.0,9032707.0,9032737.0,9032746.0,9034181.0,9034186.0,9034189.0,9034191.0,9034308.0,9036852.0,9036952.0,9037794.0,9039620.0,9062441.0,9068113.0,9069903.0,9031712.0],"skipIndex":0,"section_code":"gallery","featured_images":"9036952,9034191,9032737,9032696,9032682,9032154,9032153,9032152,9031560","id":450958,"singleSection":false});				  						galleries[472063] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"HDR Project","link":"gallery_472063.html","maxRecords":0.0,"photoIDs":[9032157.0,9032158.0,9032162.0,9036740.0,9036741.0,9040005.0],"skipIndex":0,"section_code":"gallery","featured_images":"9040005,9036741,9036740,9032158,9032157","id":472063,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9031966,9031958,9031941,9031936,9031935,9031928';
imageSets[2] = '9040005,9036952,9036741,9036740,9034256,9034191,9032737,9032696,9032682,9032158,9032157,9032154,9032153,9032152,9031966,9031958,9031941,9031936,9031935,9031928,9031913,9031909,9031560';
imageSets[3] = '9032737,9032696,9031958,9031909';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rwilson/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rwilson/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rwilson/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rwilson/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/rwilson/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/rwilson/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rwilson/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/rwilson/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 += '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 = 'Peakscapes: ' + 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</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.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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="RWILSON">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

