window.thumbnails = {};
															thumbnails[7934930] = clik.newPhoto({"id":7934930,"src":"Fibonacci_Fern_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_7934930.html","width":130,"caption":"","height":130});
															thumbnails[4080842] = clik.newPhoto({"id":4080842,"src":"fibonacci_9_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_4080842.html","width":130,"caption":"Fibonacci 9","height":130});
															thumbnails[4080845] = clik.newPhoto({"id":4080845,"src":"Black_and_White_Spiral_by_Red_Camera_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_4080845.html","width":130,"caption":"Spiral 2","height":124});
															thumbnails[4080846] = clik.newPhoto({"id":4080846,"src":"White_Spiral_by_Red_Camera_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_4080846.html","width":130,"caption":"Spiral 3","height":106});
															thumbnails[4080848] = clik.newPhoto({"id":4080848,"src":"Star_Fish_1_by_Red_Camera_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_4080848.html","width":130,"caption":"Star Fish 1","height":128});
															thumbnails[4080851] = clik.newPhoto({"id":4080851,"src":"Fossil_Spiral_by_Red_Camera_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_4080851.html","width":130,"caption":"Spiral 4","height":117});
															thumbnails[7935029] = clik.newPhoto({"id":7935029,"src":"Fibonacci_Veg_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_7935029.html","width":130,"caption":"","height":119});
															thumbnails[8383073] = clik.newPhoto({"id":8383073,"src":"Shell72_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_8383073.html","width":130,"caption":"","height":130});
															thumbnails[8383076] = clik.newPhoto({"id":8383076,"src":"N72_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_8383076.html","width":130,"caption":"","height":130});
															thumbnails[8383086] = clik.newPhoto({"id":8383086,"src":"ShellBasicColour72n_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_8383086.html","width":130,"caption":"","height":130});
															thumbnails[8383090] = clik.newPhoto({"id":8383090,"src":"ShellBasicColour72_thumb.jpg","galleries_id":444684,"server_id":15,"link":"photo_8383090.html","width":130,"caption":"","height":130});
															thumbnails[7930291] = clik.newPhoto({"id":7930291,"src":"DSC_0042-Edit_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930291.html","width":130,"caption":"","height":190});
															thumbnails[7930408] = clik.newPhoto({"id":7930408,"src":"DSC_0001-3_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930408.html","width":129,"caption":"","height":195});
															thumbnails[7930410] = clik.newPhoto({"id":7930410,"src":"DSC_0038-4_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930410.html","width":130,"caption":"","height":183});
															thumbnails[7930418] = clik.newPhoto({"id":7930418,"src":"DSC_0066-2_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930418.html","width":130,"caption":"","height":127});
															thumbnails[7930420] = clik.newPhoto({"id":7930420,"src":"DSC_0061-3_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930420.html","width":130,"caption":"","height":119});
															thumbnails[7930423] = clik.newPhoto({"id":7930423,"src":"DSC_0069-4_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930423.html","width":130,"caption":"","height":118});
															thumbnails[7930412] = clik.newPhoto({"id":7930412,"src":"DSC_0040-4_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930412.html","width":130,"caption":"","height":168});
															thumbnails[7930427] = clik.newPhoto({"id":7930427,"src":"DSC_0102-3_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930427.html","width":130,"caption":"","height":188});
															thumbnails[7930415] = clik.newPhoto({"id":7930415,"src":"DSC_0060-4_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930415.html","width":130,"caption":"","height":183});
															thumbnails[7930434] = clik.newPhoto({"id":7930434,"src":"P1010542_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930434.html","width":130,"caption":"","height":67});
															thumbnails[7930432] = clik.newPhoto({"id":7930432,"src":"DSC_0125_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930432.html","width":130,"caption":"","height":101});
															thumbnails[7930428] = clik.newPhoto({"id":7930428,"src":"DSC_0104-2_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930428.html","width":130,"caption":"","height":81});
															thumbnails[7930425] = clik.newPhoto({"id":7930425,"src":"DSC_0089-2_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930425.html","width":130,"caption":"","height":143});
															thumbnails[7930437] = clik.newPhoto({"id":7930437,"src":"P1010558_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930437.html","width":93,"caption":"","height":195});
															thumbnails[7930414] = clik.newPhoto({"id":7930414,"src":"DSC_0044-2_thumb.jpg","galleries_id":427357,"server_id":15,"link":"photo_7930414.html","width":129,"caption":"","height":195});
															thumbnails[9101365] = clik.newPhoto({"id":9101365,"src":"zen_and_the_art_web_2_thumb.jpg","galleries_id":480297,"server_id":35,"link":"photo_9101365.html","width":130,"caption":"","height":195});
															thumbnails[3528738] = clik.newPhoto({"id":3528738,"src":"Absrtaction_in__Landscape_10_by_Red_Camera_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_3528738.html","width":130,"caption":"Monolith 1","height":193});
															thumbnails[3528743] = clik.newPhoto({"id":3528743,"src":"Absrtaction_in_the_Landscape_5_by_Red_Camera_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_3528743.html","width":125,"caption":"Monolith 2","height":195});
															thumbnails[3528792] = clik.newPhoto({"id":3528792,"src":"Return_to_the_Stones_5_by_Red_Camera_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_3528792.html","width":129,"caption":"Stone Circle 1","height":195});
															thumbnails[3528788] = clik.newPhoto({"id":3528788,"src":"Absrtaction_in_the_Landscape_3_by_Red_Camera1_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_3528788.html","width":130,"caption":"Monolith 3","height":88});
															thumbnails[3528795] = clik.newPhoto({"id":3528795,"src":"Absrtaction_in_the_Landscape_4_by_Red_Camera_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_3528795.html","width":130,"caption":"Stone Circle 2","height":86});
															thumbnails[3528742] = clik.newPhoto({"id":3528742,"src":"Absrtaction_in_the_Landscape_1_by_Red_Camera_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_3528742.html","width":130,"caption":"Stone Circle 3","height":86});
															thumbnails[4463029] = clik.newPhoto({"id":4463029,"src":"stones_1_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_4463029.html","width":130,"caption":"Stones 7","height":93});
															thumbnails[4463030] = clik.newPhoto({"id":4463030,"src":"stonese2solblack_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_4463030.html","width":130,"caption":"Stones 8","height":86});
															thumbnails[4463031] = clik.newPhoto({"id":4463031,"src":"p1010396_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_4463031.html","width":130,"caption":"Stones 9","height":95});
															thumbnails[4463033] = clik.newPhoto({"id":4463033,"src":"stoned_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_4463033.html","width":130,"caption":"Stones 10","height":173});
															thumbnails[3528796] = clik.newPhoto({"id":3528796,"src":"Return_to_the_Stones_9_by_Red_Camera_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_3528796.html","width":130,"caption":"Stone Circle 4","height":95});
															thumbnails[3528790] = clik.newPhoto({"id":3528790,"src":"Return_to_the_Stones_2_by_Red_Camera_thumb.jpg","galleries_id":444685,"server_id":15,"link":"photo_3528790.html","width":130,"caption":"Human Circle 1","height":88});
															thumbnails[3527977] = clik.newPhoto({"id":3527977,"src":"Deco_B_by_Red_Camera_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_3527977.html","width":130,"caption":"Deco 1","height":146});
															thumbnails[3527983] = clik.newPhoto({"id":3527983,"src":"Photo_Modernity_1_by_Red_Camera_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_3527983.html","width":130,"caption":"Deco 4","height":101});
															thumbnails[3527978] = clik.newPhoto({"id":3527978,"src":"Deco_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_3527978.html","width":130,"caption":"Deco 2","height":111});
															thumbnails[4463112] = clik.newPhoto({"id":4463112,"src":"cr2008flat_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_4463112.html","width":81,"caption":"Mod 11","height":195});
															thumbnails[4463041] = clik.newPhoto({"id":4463041,"src":"Modernity_3_New_23cm_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_4463041.html","width":130,"caption":"Mod 1","height":195});
															thumbnails[3527981] = clik.newPhoto({"id":3527981,"src":"RIMG0071_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_3527981.html","width":130,"caption":"Deco 3","height":173});
															thumbnails[4463114] = clik.newPhoto({"id":4463114,"src":"crys2007flat_copy_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_4463114.html","width":78,"caption":"Mod 12","height":195});
															thumbnails[4463116] = clik.newPhoto({"id":4463116,"src":"manhatten_copy_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_4463116.html","width":130,"caption":"Mod 13","height":186});
															thumbnails[3527991] = clik.newPhoto({"id":3527991,"src":"Bellagio_14_by_Red_Camera_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_3527991.html","width":130,"caption":"Deco 7","height":167});
															thumbnails[3527985] = clik.newPhoto({"id":3527985,"src":"Aerodrome_by_Red_Camera_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_3527985.html","width":130,"caption":"Deco 5","height":86});
															thumbnails[3527989] = clik.newPhoto({"id":3527989,"src":"Stella_by_Red_Camera_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_3527989.html","width":130,"caption":"Deco 6","height":96});
															thumbnails[4463052] = clik.newPhoto({"id":4463052,"src":"Modernity_6_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_4463052.html","width":130,"caption":"Mod 4","height":88});
															thumbnails[3528007] = clik.newPhoto({"id":3528007,"src":"Universal_by_Red_Camera_thumb.jpg","galleries_id":444689,"server_id":15,"link":"photo_3528007.html","width":130,"caption":"Deco 9","height":173});
															thumbnails[3527122] = clik.newPhoto({"id":3527122,"src":"Piano_Bar_5_by_Red_Camera_thumb.jpg","galleries_id":444688,"server_id":15,"link":"photo_3527122.html","width":130,"caption":"Piano Bar 5","height":195});
															thumbnails[4080765] = clik.newPhoto({"id":4080765,"src":"Moments_in_Time_1_by_Red_Camera_thumb.jpg","galleries_id":444688,"server_id":15,"link":"photo_4080765.html","width":130,"caption":"Moments in Time 1","height":162});
															thumbnails[3527157] = clik.newPhoto({"id":3527157,"src":"Winchester_1_by_Red_Camera_thumb.jpg","galleries_id":444688,"server_id":15,"link":"photo_3527157.html","width":130,"caption":"Winchester Cathedral 1","height":195});
															thumbnails[4080828] = clik.newPhoto({"id":4080828,"src":"Moments_in_Time_5_by_Red_Camera_thumb.jpg","galleries_id":444688,"server_id":15,"link":"photo_4080828.html","width":130,"caption":"Moments in Time 5","height":195});
															thumbnails[4080774] = clik.newPhoto({"id":4080774,"src":"Moments_in_Time_3_by_Red_Camera_thumb.jpg","galleries_id":444688,"server_id":15,"link":"photo_4080774.html","width":130,"caption":"Moments in Time 3","height":91});
															thumbnails[4080778] = clik.newPhoto({"id":4080778,"src":"Walking_Back_by_Red_Camera_thumb.jpg","galleries_id":444688,"server_id":15,"link":"photo_4080778.html","width":130,"caption":"Moments in Time 4","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[444689] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Art Deco","link":"section534543.html","maxRecords":0.0,"photoIDs":[3527977.0,3527983.0,3527978.0,4463112.0,4463041.0,3527981.0,4463114.0,4463116.0,3527991.0,3527985.0,3527989.0,4463052.0,3528007.0],"skipIndex":0,"section_code":"section534543","featured_images":"4463041,3527978","id":444689,"singleSection":true});				  						galleries[427357] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"i-weddings","link":"section513208.html","maxRecords":0.0,"photoIDs":[7930291.0,7930408.0,7930410.0,7930418.0,7930420.0,7930423.0,7930412.0,7930427.0,7930415.0,7930434.0,7930432.0,7930428.0,7930425.0,7930437.0,7930414.0],"skipIndex":0,"section_code":"section513208","featured_images":"7930437,7930434,7930432,7930428,7930427,7930425,7930423,7930420,7930418,7930415","id":427357,"singleSection":true});				  						galleries[444688] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Moments in Time and Space","link":"section534544.html","maxRecords":0.0,"photoIDs":[3527122.0,4080765.0,3527157.0,4080828.0,4080774.0,4080778.0],"skipIndex":0,"section_code":"section534544","featured_images":4080765.0,"id":444688,"singleSection":true});				  						galleries[444685] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Neolithic Whisky Run","link":"section534530.html","maxRecords":0.0,"photoIDs":[3528738.0,3528743.0,3528792.0,3528788.0,3528795.0,3528742.0,4463029.0,4463030.0,4463031.0,4463033.0,3528796.0,3528790.0],"skipIndex":0,"section_code":"section534530","featured_images":3528742.0,"id":444685,"singleSection":true});				  						galleries[444684] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The Code","link":"section534528.html","maxRecords":0.0,"photoIDs":[7934930.0,4080842.0,4080845.0,4080846.0,4080848.0,4080851.0,7935029.0,8383073.0,8383076.0,8383086.0,8383090.0],"skipIndex":0,"section_code":"section534528","featured_images":"8383090,8383086,8383076,8383073,7935029,7934930,4080851,4080848,4080846,4080845","id":444684,"singleSection":true});				  						galleries[480297] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Zen and The Art of Digital Photography","link":"section585283.html","maxRecords":0.0,"photoIDs":[9101365.0],"skipIndex":0,"section_code":"section585283","featured_images":9101365.0,"id":480297,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8383090';
imageSets[2] = '9101365,4080765,3527978,4463041,3528742';
imageSets[3] = '9101365,8383090,8383086,8383076,8383073,7935029,7934930,7930437,7930434,7930432,7930428,7930427,7930425,7930423,7930420,7930418,7930415,7930414,7930412,7930410,7930408,7930291,4463116,4463114,4463112,4463052,4463041,4463033,4463031,4463030,4463029,4080851,4080848,4080846,4080845,4080842,4080828,4080778,4080774,4080765,3528796,3528795,3528792,3528790,3528788,3528743,3528742,3528738,3528007,3527991';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/markwrig/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/markwrig/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/markwrig/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/markwrig/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/markwrig/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/markwrig/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/markwrig/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/markwrig/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 += 'section534528.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 && 'section534528' != '') {
					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 = 'Lazy-Photon: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="Red.Camera@hotmail.co.uk">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="Red.Camera@hotmail.co.uk">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

