window.thumbnails = {};
															thumbnails[8530256] = clik.newPhoto({"id":8530256,"src":"Picture3_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Bismillah","height":77});
															thumbnails[8530257] = clik.newPhoto({"id":8530257,"src":"Picture1_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Al-Hamd","height":185});
															thumbnails[8530258] = clik.newPhoto({"id":8530258,"src":"Picture4_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Hu","height":195});
															thumbnails[4544232] = clik.newPhoto({"id":4544232,"src":"najm1_cp1_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Najm Side Table","height":195});
															thumbnails[8530260] = clik.newPhoto({"id":8530260,"src":"Picture2_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Hikmat","height":160});
															thumbnails[4544193] = clik.newPhoto({"id":4544193,"src":"najm_cp_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Najm Side Table","height":146});
															thumbnails[8530261] = clik.newPhoto({"id":8530261,"src":"Picture6_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Dhikr Qalbi","height":168});
															thumbnails[8530259] = clik.newPhoto({"id":8530259,"src":"Picture5_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Hu","height":245});
															thumbnails[7606106] = clik.newPhoto({"id":7606106,"src":"IMAG0296_thumb.jpg","galleries_id":412505,"server_id":18,"link":"photo_7606106.html","width":130,"caption":"Maharaja's Car","height":78});
															thumbnails[7606110] = clik.newPhoto({"id":7606110,"src":"IMAG0359_thumb.jpg","galleries_id":412505,"server_id":18,"link":"photo_7606110.html","width":130,"caption":"Roof Rebuild","height":78});
															thumbnails[7606098] = clik.newPhoto({"id":7606098,"src":"IMAG0349_thumb.jpg","galleries_id":412505,"server_id":18,"link":"photo_7606098.html","width":130,"caption":"VDP Body","height":78});
															thumbnails[7606100] = clik.newPhoto({"id":7606100,"src":"IMAG0344_thumb.jpg","galleries_id":412505,"server_id":18,"link":"photo_7606100.html","width":130,"caption":"VDP Body Detail","height":217});
															thumbnails[7606102] = clik.newPhoto({"id":7606102,"src":"IMAG0347_thumb.jpg","galleries_id":412505,"server_id":18,"link":"photo_7606102.html","width":130,"caption":"VDP Body Restoration","height":78});
															thumbnails[7606390] = clik.newPhoto({"id":7606390,"src":"portfolio_018_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_7606390.html","width":130,"caption":"Burr Elm Side Table","height":184});
															thumbnails[7606387] = clik.newPhoto({"id":7606387,"src":"016_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_7606387.html","width":130,"caption":"Chair 3","height":217});
															thumbnails[6683586] = clik.newPhoto({"id":6683586,"src":"portfolio_024_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_6683586.html","width":130,"caption":"Chair No.3","height":184});
															thumbnails[8681402] = clik.newPhoto({"id":8681402,"src":"154_thumb.jpg","galleries_id":458086,"server_id":18,"link":"photo_8681402.html","width":130,"caption":"","height":217});
															thumbnails[7606077] = clik.newPhoto({"id":7606077,"src":"00001_600_thumb.jpg","galleries_id":458086,"server_id":18,"link":"photo_7606077.html","width":130,"caption":"Games Room Fit-out ","height":93});
															thumbnails[7606079] = clik.newPhoto({"id":7606079,"src":"1a_thumb.jpg","galleries_id":458086,"server_id":18,"link":"photo_7606079.html","width":130,"caption":"Kitchen Island ","height":85});
															thumbnails[7606069] = clik.newPhoto({"id":7606069,"src":"159_thumb.jpg","galleries_id":458086,"server_id":18,"link":"photo_7606069.html","width":130,"caption":"Floating Stairway ","height":78});
															thumbnails[7606072] = clik.newPhoto({"id":7606072,"src":"162_thumb.jpg","galleries_id":458086,"server_id":18,"link":"photo_7606072.html","width":130,"caption":"Kitchen Fit-out","height":78});
															thumbnails[4543594] = clik.newPhoto({"id":4543594,"src":"ikhlas_vase_cp_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_4543594.html","width":130,"caption":"Carved Vase","height":156});
															thumbnails[7606083] = clik.newPhoto({"id":7606083,"src":"4_thumb.jpg","galleries_id":458086,"server_id":18,"link":"photo_7606083.html","width":130,"caption":"Kitchen Fit-out","height":85});
															thumbnails[4543890] = clik.newPhoto({"id":4543890,"src":"22-laburnum_vase_cp_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_4543890.html","width":130,"caption":"Kursi Vase","height":157});
															thumbnails[4543897] = clik.newPhoto({"id":4543897,"src":"noor_ali_cp_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_4543897.html","width":130,"caption":"Laburnam Vase","height":178});
															thumbnails[1183091] = clik.newPhoto({"id":1183091,"src":"readingtable_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1183091.html","width":130,"caption":"Reading Table","height":82});
															thumbnails[1176644] = clik.newPhoto({"id":1176644,"src":"roundtable_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1176644.html","width":130,"caption":"Roundtable","height":83});
															thumbnails[1183071] = clik.newPhoto({"id":1183071,"src":"tallchair_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1183071.html","width":130,"caption":"Tall Chair","height":195});
															thumbnails[1206372] = clik.newPhoto({"id":1206372,"src":"b&wcoffeetable_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1206372.html","width":130,"caption":"Black & White Table","height":79});
															thumbnails[1183076] = clik.newPhoto({"id":1183076,"src":"clifftop_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1183076.html","width":130,"caption":"Clifftop","height":98});
															thumbnails[1206567] = clik.newPhoto({"id":1206567,"src":"stell_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1206567.html","width":130,"caption":"Stell","height":85});
															thumbnails[1176610] = clik.newPhoto({"id":1176610,"src":"burrhalltable_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1176610.html","width":130,"caption":"Burr Table","height":88});
															thumbnails[7606103] = clik.newPhoto({"id":7606103,"src":"syctable1_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_7606103.html","width":130,"caption":"Sycamore Table","height":104});
															thumbnails[1177070] = clik.newPhoto({"id":1177070,"src":"palmhouse_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1177070.html","width":130,"caption":"Palmhouse","height":98});
															thumbnails[1206608] = clik.newPhoto({"id":1206608,"src":"aiken1_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1206608.html","width":130,"caption":"Table & Shelving","height":96});
															thumbnails[1177044] = clik.newPhoto({"id":1177044,"src":"gate_thumb.jpg","galleries_id":84825,"server_id":18,"link":"photo_1177044.html","width":130,"caption":"Gateway","height":87});
															thumbnails[1183066] = clik.newPhoto({"id":1183066,"src":"stmarys6_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1183066.html","width":130,"caption":"St Marys Cathedral","height":228});
															thumbnails[7704922] = clik.newPhoto({"id":7704922,"src":"dumfries_seats_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_7704922.html","width":130,"caption":"Sanctuary Seating","height":98});
															thumbnails[1183092] = clik.newPhoto({"id":1183092,"src":"table&chairs_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1183092.html","width":130,"caption":"Table & Chairs","height":95});
															thumbnails[1176619] = clik.newPhoto({"id":1176619,"src":"halltable12_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1176619.html","width":130,"caption":"Hall Table","height":127});
															thumbnails[1206128] = clik.newPhoto({"id":1206128,"src":"walltryptych_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1206128.html","width":130,"caption":"Ash Tryptych","height":97});
															thumbnails[1206433] = clik.newPhoto({"id":1206433,"src":"talltable_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1206433.html","width":130,"caption":"Tall Table","height":195});
															thumbnails[1177039] = clik.newPhoto({"id":1177039,"src":"membnch_thumb.jpg","galleries_id":84825,"server_id":18,"link":"photo_1177039.html","width":130,"caption":"Memorial Bench","height":90});
															thumbnails[1183070] = clik.newPhoto({"id":1183070,"src":"spaltedchair1_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1183070.html","width":130,"caption":"Spalted Chair","height":163});
															thumbnails[1183067] = clik.newPhoto({"id":1183067,"src":"museumbench_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1183067.html","width":130,"caption":"Museum Bench","height":189});
															thumbnails[1176603] = clik.newPhoto({"id":1176603,"src":"cab1_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1176603.html","width":130,"caption":"Cabinet 1","height":154});
															thumbnails[1206061] = clik.newPhoto({"id":1206061,"src":"walntchlc_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_1206061.html","width":130,"caption":"Chalice","height":94});
															thumbnails[1183073] = clik.newPhoto({"id":1183073,"src":"tristool_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1183073.html","width":130,"caption":"Tri Stool","height":148});
															thumbnails[1206286] = clik.newPhoto({"id":1206286,"src":"bowl6_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_1206286.html","width":130,"caption":"Elm Form","height":91});
															thumbnails[1206381] = clik.newPhoto({"id":1206381,"src":"cloven1_thumb.jpg","galleries_id":84825,"server_id":18,"link":"photo_1206381.html","width":130,"caption":"Cloven Seat","height":214});
															thumbnails[1177052] = clik.newPhoto({"id":1177052,"src":"waveb2_thumb.jpg","galleries_id":84825,"server_id":18,"link":"photo_1177052.html","width":130,"caption":"Wavebench","height":191});
															thumbnails[1206289] = clik.newPhoto({"id":1206289,"src":"grace_thumb.jpg","galleries_id":84825,"server_id":18,"link":"photo_1206289.html","width":130,"caption":"Grace","height":91});
															thumbnails[1183031] = clik.newPhoto({"id":1183031,"src":"bowl2_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_1183031.html","width":130,"caption":"Oak Platter","height":90});
															thumbnails[7606086] = clik.newPhoto({"id":7606086,"src":"elmcarving1_thumb.jpg","galleries_id":84825,"server_id":18,"link":"photo_7606086.html","width":130,"caption":"Elm Carving","height":199});
															thumbnails[1183018] = clik.newPhoto({"id":1183018,"src":"bowl1_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_1183018.html","width":130,"caption":"Ebonised Bowl","height":146});
															thumbnails[1183017] = clik.newPhoto({"id":1183017,"src":"bowl_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_1183017.html","width":130,"caption":"Hollow Form","height":143});
															thumbnails[1206176] = clik.newPhoto({"id":1206176,"src":"bowl4_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_1206176.html","width":130,"caption":"Sycamore Bowl","height":93});
															thumbnails[1206137] = clik.newPhoto({"id":1206137,"src":"turning1_thumb.jpg","galleries_id":84824,"server_id":18,"link":"photo_1206137.html","width":130,"caption":"Turned Vases & Stand","height":194});
															thumbnails[1206364] = clik.newPhoto({"id":1206364,"src":"cabinetdetail_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1206364.html","width":130,"caption":"Cabinet Detail","height":104});
															thumbnails[1206389] = clik.newPhoto({"id":1206389,"src":"nms1_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1206389.html","width":130,"caption":"Museum Bench 2","height":195});
															thumbnails[1206398] = clik.newPhoto({"id":1206398,"src":"palmhouse1_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1206398.html","width":130,"caption":"Palmhouse Reception Desk","height":98});
															thumbnails[1206573] = clik.newPhoto({"id":1206573,"src":"stmarys4_thumb.jpg","galleries_id":84826,"server_id":18,"link":"photo_1206573.html","width":130,"caption":"St Marys Cathedral","height":84});
															thumbnails[1206616] = clik.newPhoto({"id":1206616,"src":"aikendetail_thumb.jpg","galleries_id":84304,"server_id":18,"link":"photo_1206616.html","width":130,"caption":"Shelving Detail","height":176});
															thumbnails[8681460] = clik.newPhoto({"id":8681460,"src":"166_thumb.jpg","galleries_id":458086,"server_id":18,"link":"photo_8681460.html","width":130,"caption":"","height":217});
															thumbnails[8681469] = clik.newPhoto({"id":8681469,"src":"180a_thumb.jpg","galleries_id":458086,"server_id":18,"link":"photo_8681469.html","width":130,"caption":"","height":78});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[458086] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cabinetry","link":"gallery_458086.html","maxRecords":0.0,"photoIDs":[8681402.0,7606077.0,7606079.0,7606069.0,7606072.0,7606083.0,8681460.0,8681469.0],"skipIndex":0,"section_code":"gallery","featured_images":7606072.0,"id":458086,"singleSection":false});				  						galleries[84825] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Outdoor","link":"gallery_84825.html","maxRecords":0.0,"photoIDs":[1177044.0,1177039.0,1206381.0,1177052.0,1206289.0,7606086.0],"skipIndex":0,"section_code":"gallery","featured_images":"7606086,1177039","id":84825,"singleSection":false});				  						galleries[84826] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Public works","link":"gallery_84826.html","maxRecords":0.0,"photoIDs":[1183076.0,1206567.0,1177070.0,1183066.0,7704922.0,1206128.0,1183067.0,1206389.0,1206398.0,1206573.0],"skipIndex":0,"section_code":"gallery","featured_images":1177070.0,"id":84826,"singleSection":false});				  						galleries[84824] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Turning","link":"gallery_84824.html","maxRecords":0.0,"photoIDs":[4543594.0,4543890.0,4543897.0,1206061.0,1206286.0,1183031.0,1183018.0,1183017.0,1206176.0,1206137.0],"skipIndex":0,"section_code":"gallery","featured_images":1183017.0,"id":84824,"singleSection":false});				  						galleries[412505] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Vintage Bentley Coachwork","link":"gallery_412505.html","maxRecords":0.0,"photoIDs":[7606106.0,7606110.0,7606098.0,7606100.0,7606102.0],"skipIndex":0,"section_code":"gallery","featured_images":7606106.0,"id":412505,"singleSection":false});				  						galleries[84304] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Fine Furniture","link":"gallery_84304.html","maxRecords":0.0,"photoIDs":[7606390.0,7606387.0,6683586.0,1183091.0,1176644.0,1183071.0,1206372.0,1176610.0,7606103.0,1206608.0,1183092.0,1176619.0,1206433.0,1183070.0,1176603.0,1183073.0,1206364.0,1206616.0],"skipIndex":0,"section_code":"gallery","featured_images":"7606103,1206364,1176619","id":84304,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7606103,4544232,1206364';
imageSets[2] = '7606106,7606103,7606086,7606072,4544232,1206364,1183017,1177070,1177039,1176619';
imageSets[3] = '7606103,4544232,1206364';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/grantb/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/grantb/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/grantb/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/grantb/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/grantb/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/grantb/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/grantb/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 = 'Art in Wood: ' + 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;
	}
}

			

