window.thumbnails = {};
															thumbnails[3935807] = clik.newPhoto({"id":3935807,"src":"adplayweb_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Adventure playground 100x120cm","height":86});
															thumbnails[3935811] = clik.newPhoto({"id":3935811,"src":"portrait_devilweb_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"portrait devil 40x40cm","height":133});
															thumbnails[3935830] = clik.newPhoto({"id":3935830,"src":"clearing_nowweb_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"clearing now","height":171});
															thumbnails[3935833] = clik.newPhoto({"id":3935833,"src":"battersea_syrupweb_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"battersea syrup 100x100cm","height":130});
															thumbnails[3935836] = clik.newPhoto({"id":3935836,"src":"wizards_and_faries_in_windowweb_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"wizards and faries in window","height":66});
															thumbnails[3935879] = clik.newPhoto({"id":3935879,"src":"drop_everything_WEB_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"drop everything 40x40cm","height":128});
															thumbnails[3936076] = clik.newPhoto({"id":3936076,"src":"art_show_4lr_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Jayson Lilley","height":196});
															thumbnails[3982386] = clik.newPhoto({"id":3982386,"src":"britart_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"londart","height":87});
															thumbnails[4080550] = clik.newPhoto({"id":4080550,"src":"forever_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"every cleaver picture tells a cleaver story","height":175});
															thumbnails[7746088] = clik.newPhoto({"id":7746088,"src":"20111_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":92});
															thumbnails[7746965] = clik.newPhoto({"id":7746965,"src":"quality_union_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":87});
															thumbnails[3935818] = clik.newPhoto({"id":3935818,"src":"sometimesweb_thumb.jpg","galleries_id":238720,"server_id":15,"link":"photo_3935818.html","width":130,"caption":"sometimes 60x80cm","height":192});
															thumbnails[3962373] = clik.newPhoto({"id":3962373,"src":"portu1_thumb.jpg","galleries_id":238720,"server_id":15,"link":"photo_3962373.html","width":130,"caption":"","height":85});
															thumbnails[3962377] = clik.newPhoto({"id":3962377,"src":"kiss_my_art_thumb.jpg","galleries_id":238720,"server_id":15,"link":"photo_3962377.html","width":130,"caption":"lippy art","height":173});
															thumbnails[4103849] = clik.newPhoto({"id":4103849,"src":"scooby_thumb.jpg","galleries_id":238720,"server_id":15,"link":"photo_4103849.html","width":130,"caption":"","height":245});
															thumbnails[7204110] = clik.newPhoto({"id":7204110,"src":"love_is_a_nasty_habbit12_thumb.jpg","galleries_id":238720,"server_id":15,"link":"photo_7204110.html","width":130,"caption":"love is a nasty habbit","height":160});
															thumbnails[7204128] = clik.newPhoto({"id":7204128,"src":"do_you_thumb.jpg","galleries_id":238720,"server_id":15,"link":"photo_7204128.html","width":130,"caption":"do you?","height":231});
															thumbnails[7204129] = clik.newPhoto({"id":7204129,"src":"it_depends_thumb.jpg","galleries_id":238720,"server_id":15,"link":"photo_7204129.html","width":130,"caption":"it depends","height":193});
															thumbnails[7743445] = clik.newPhoto({"id":7743445,"src":"never_give_up_B7F9EE09-1EC9-D45B-1C1F8080B4747FCE_thumb.jpg","galleries_id":238720,"server_id":15,"link":"photo_7743445.html","width":130,"caption":"","height":98});
															thumbnails[3935869] = clik.newPhoto({"id":3935869,"src":"cake_posterweb_thumb.jpg","galleries_id":238718,"server_id":15,"link":"photo_3935869.html","width":130,"caption":"cake poster 200x300cm","height":81});
															thumbnails[3935876] = clik.newPhoto({"id":3935876,"src":"original_madweb_thumb.jpg","galleries_id":238718,"server_id":15,"link":"photo_3935876.html","width":130,"caption":"original mad 30x60cm","height":193});
															thumbnails[3935885] = clik.newPhoto({"id":3935885,"src":"lucky_star_WEB_thumb.jpg","galleries_id":238718,"server_id":15,"link":"photo_3935885.html","width":130,"caption":"lucky star","height":86});
															thumbnails[3935888] = clik.newPhoto({"id":3935888,"src":"lollies_have_sticksWEB_thumb.jpg","galleries_id":238718,"server_id":15,"link":"photo_3935888.html","width":130,"caption":"lollies have sticks","height":84});
															thumbnails[3968309] = clik.newPhoto({"id":3968309,"src":"lets_print_sketch_thumb.jpg","galleries_id":238718,"server_id":15,"link":"photo_3968309.html","width":130,"caption":"sketch book","height":231});
															thumbnails[4006613] = clik.newPhoto({"id":4006613,"src":"past_and_present_thumb.jpg","galleries_id":238718,"server_id":15,"link":"photo_4006613.html","width":130,"caption":"","height":85});
															thumbnails[4078284] = clik.newPhoto({"id":4078284,"src":"good_ice_cream_charlie_brown_thumb.jpg","galleries_id":238718,"server_id":15,"link":"photo_4078284.html","width":130,"caption":"Good ice cream charlie brown","height":129});
															thumbnails[4080621] = clik.newPhoto({"id":4080621,"src":"production_thumb.jpg","galleries_id":238718,"server_id":15,"link":"photo_4080621.html","width":130,"caption":"production line","height":132});
															thumbnails[3935821] = clik.newPhoto({"id":3935821,"src":"youll_live_foreverweb_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_3935821.html","width":130,"caption":"you'll live forever 120x150cm","height":189});
															thumbnails[3962371] = clik.newPhoto({"id":3962371,"src":"yellow_bubble_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_3962371.html","width":130,"caption":"me and my big yellow bubble 200x160cm","height":158});
															thumbnails[3967840] = clik.newPhoto({"id":3967840,"src":"are_u_lovely_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_3967840.html","width":130,"caption":"Are U lovely 70x100cm","height":190});
															thumbnails[3967851] = clik.newPhoto({"id":3967851,"src":"never_give_up_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_3967851.html","width":130,"caption":"Never give up 70x100cm","height":191});
															thumbnails[3967861] = clik.newPhoto({"id":3967861,"src":"loyal_star_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_3967861.html","width":130,"caption":"Loyal Star","height":189});
															thumbnails[3968382] = clik.newPhoto({"id":3968382,"src":"bigger_yellow_bubblebefore_stretch_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_3968382.html","width":130,"caption":"Me and My bigger yellow bubble 200x160cm","height":185});
															thumbnails[3968656] = clik.newPhoto({"id":3968656,"src":"good_evil_me_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_3968656.html","width":130,"caption":"Good Evil Me 100x100cm","height":132});
															thumbnails[3969326] = clik.newPhoto({"id":3969326,"src":"part_of_fish_and_chips_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_3969326.html","width":130,"caption":"part of a bigger picture...","height":194});
															thumbnails[7204089] = clik.newPhoto({"id":7204089,"src":"distant_stars1_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_7204089.html","width":130,"caption":"","height":107});
															thumbnails[7204115] = clik.newPhoto({"id":7204115,"src":"i_love_you_so_muh_these_days_thumb.jpg","galleries_id":238719,"server_id":15,"link":"photo_7204115.html","width":130,"caption":"love you so much these days","height":173});
															thumbnails[7204085] = clik.newPhoto({"id":7204085,"src":"with_a_little_help_from_mr_stonehouse_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7204085.html","width":130,"caption":"","height":73});
															thumbnails[7206985] = clik.newPhoto({"id":7206985,"src":"londart_print_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7206985.html","width":130,"caption":"","height":98});
															thumbnails[7206986] = clik.newPhoto({"id":7206986,"src":"i_love_my_boots_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7206986.html","width":130,"caption":"","height":231});
															thumbnails[7206988] = clik.newPhoto({"id":7206988,"src":"print_room_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7206988.html","width":130,"caption":"","height":231});
															thumbnails[7743410] = clik.newPhoto({"id":7743410,"src":"open_studio_mobile_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7743410.html","width":130,"caption":"","height":73});
															thumbnails[7743439] = clik.newPhoto({"id":7743439,"src":"hershey_money_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7743439.html","width":130,"caption":"","height":89});
															thumbnails[7743442] = clik.newPhoto({"id":7743442,"src":"mickey_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7743442.html","width":130,"caption":"","height":177});
															thumbnails[7750961] = clik.newPhoto({"id":7750961,"src":"love_love_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7750961.html","width":130,"caption":"","height":215});
															thumbnails[7750971] = clik.newPhoto({"id":7750971,"src":"search_of_purpose_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7750971.html","width":130,"caption":"","height":207});
															thumbnails[7751019] = clik.newPhoto({"id":7751019,"src":"londart_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7751019.html","width":130,"caption":"","height":87});
															thumbnails[7751260] = clik.newPhoto({"id":7751260,"src":"just_because_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7751260.html","width":130,"caption":"","height":205});
															thumbnails[7751270] = clik.newPhoto({"id":7751270,"src":"watercolour_screenprint_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7751270.html","width":130,"caption":"","height":86});
															thumbnails[8619910] = clik.newPhoto({"id":8619910,"src":"my_brush_thumb.jpg","galleries_id":245961,"server_id":38,"link":"photo_8619910.html","width":130,"caption":"","height":173});
															thumbnails[8620352] = clik.newPhoto({"id":8620352,"src":"piggy_bank__thumb.jpg","galleries_id":245961,"server_id":38,"link":"photo_8620352.html","width":130,"caption":"","height":98});
															thumbnails[4106440] = clik.newPhoto({"id":4106440,"src":"because_were_butterflies_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_4106440.html","width":130,"caption":"because we're butterflies","height":183});
															thumbnails[7204130] = clik.newPhoto({"id":7204130,"src":"we_all_go_thumb.jpg","galleries_id":245961,"server_id":15,"link":"photo_7204130.html","width":130,"caption":"","height":182});
															thumbnails[8293624] = clik.newPhoto({"id":8293624,"src":"menisci_series__17_thumb.jpg","galleries_id":441305,"server_id":35,"link":"photo_8293624.html","width":130,"caption":"","height":173});
															thumbnails[8293627] = clik.newPhoto({"id":8293627,"src":"menisci_in_situ_thumb.jpg","galleries_id":441305,"server_id":35,"link":"photo_8293627.html","width":130,"caption":"","height":98});
															thumbnails[8293629] = clik.newPhoto({"id":8293629,"src":"layered_flowers_thumb.jpg","galleries_id":441305,"server_id":35,"link":"photo_8293629.html","width":130,"caption":"","height":98});
															thumbnails[8293631] = clik.newPhoto({"id":8293631,"src":"theatre_thumb.jpg","galleries_id":441305,"server_id":35,"link":"photo_8293631.html","width":130,"caption":"","height":62});
															thumbnails[8295003] = clik.newPhoto({"id":8295003,"src":"photo_libr_1_thumb.jpg","galleries_id":441305,"server_id":35,"link":"photo_8295003.html","width":130,"caption":"","height":87});
															thumbnails[8295005] = clik.newPhoto({"id":8295005,"src":"some_cracks_thumb.jpg","galleries_id":441305,"server_id":35,"link":"photo_8295005.html","width":130,"caption":"","height":73});
															thumbnails[8295006] = clik.newPhoto({"id":8295006,"src":"south_bank_skelter_thumb.jpg","galleries_id":441305,"server_id":35,"link":"photo_8295006.html","width":130,"caption":"","height":140});
															thumbnails[8295009] = clik.newPhoto({"id":8295009,"src":"school_bus_thumb.jpg","galleries_id":441305,"server_id":35,"link":"photo_8295009.html","width":130,"caption":"","height":86});
															thumbnails[8297755] = clik.newPhoto({"id":8297755,"src":"safety_sign_thumb.jpg","galleries_id":441305,"server_id":37,"link":"photo_8297755.html","width":130,"caption":"","height":232});
															thumbnails[4104386] = clik.newPhoto({"id":4104386,"src":"hand_coloured_lovalley_thumb.jpg","galleries_id":245966,"server_id":15,"link":"photo_4104386.html","width":130,"caption":"","height":178});
															thumbnails[4107898] = clik.newPhoto({"id":4107898,"src":"good_1_thumb.jpg","galleries_id":245966,"server_id":15,"link":"photo_4107898.html","width":130,"caption":"","height":148});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[441305] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"photography","link":"section530593.html","maxRecords":0.0,"photoIDs":[8293624.0,8293627.0,8293629.0,8293631.0,8295003.0,8295005.0,8295006.0,8295009.0,8297755.0],"skipIndex":0,"section_code":"section530593","featured_images":"8297755,8295009,8295006,8295005,8295003,8293631,8293629,8293627,8293624","id":441305,"singleSection":true});				  						galleries[238720] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"paintings","link":"section290704.html","maxRecords":0.0,"photoIDs":[3935818.0,3962373.0,3962377.0,4103849.0,7204110.0,7204128.0,7204129.0,7743445.0],"skipIndex":0,"section_code":"section290704","featured_images":"7743445,7204129,7204128,7204110,4103849,3962377,3962373,3935818","id":238720,"singleSection":true});				  						galleries[238718] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"paper paintings","link":"section290702.html","maxRecords":0.0,"photoIDs":[3935869.0,3935876.0,3935885.0,3935888.0,3968309.0,4006613.0,4078284.0,4080621.0],"skipIndex":0,"section_code":"section290702","featured_images":"4080621,4078284,4006613,3968309,3935888,3935885,3935876,3935869","id":238718,"singleSection":true});				  						galleries[238719] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"large pieces","link":"section290703.html","maxRecords":0.0,"photoIDs":[3935821.0,3962371.0,3967840.0,3967851.0,3967861.0,3968382.0,3968656.0,3969326.0,7204089.0,7204115.0],"skipIndex":0,"section_code":"section290703","featured_images":"7204115,7204089,3969326,3968656,3968382,3967861,3967851,3967840,3962371,3935821","id":238719,"singleSection":true});				  						galleries[245966] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"etchings","link":"section298415.html","maxRecords":0.0,"photoIDs":[4104386.0,4107898.0],"skipIndex":0,"section_code":"section298415","featured_images":"4107898,4104386","id":245966,"singleSection":true});				  						galleries[245961] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"screen prints","link":"section298414.html","maxRecords":0.0,"photoIDs":[7204085.0,7206985.0,7206986.0,7206988.0,7743410.0,7743439.0,7743442.0,7750961.0,7750971.0,7751019.0,7751260.0,7751270.0,8619910.0,8620352.0,4106440.0,7204130.0],"skipIndex":0,"section_code":"section298414","featured_images":"8620352,8619910,7751270,7751260,7751019,7750971,7750961,7743442,7743439,7743410","id":245961,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7746965,7746088,7743445,4078284,3982386,7204130';
imageSets[3] = '7746088,7743445,7743442,7743439,7743410,7206988,7206986,7206985,7204129,7204128,7204115,7204110,7204089,7204085,4107898,4104386,4103849,4080621,4080550,4078284,4006613,3982386,3969326,3968656,3968382,3968309,3967861,3967851,3967840,3962377,3962373,3962371,3936076,3935888,3935885,3935879,3935876,3935869,8620352,4106440,7204130';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/gurley/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/gurley/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/gurley/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/gurley/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/gurley/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/gurley/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/gurley/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 += 'section290704.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 && 'section290704' != '') {
					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 = 'Gurley: ' + 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({					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;
	}
}

			

