window.thumbnails = {};
															thumbnails[8470583] = clik.newPhoto({"id":8470583,"src":"BOSS_11_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_8470583.html","width":130,"caption":"","height":87});
															thumbnails[8470489] = clik.newPhoto({"id":8470489,"src":"BOSS_8_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_8470489.html","width":130,"caption":"","height":195});
															thumbnails[8470557] = clik.newPhoto({"id":8470557,"src":"boss_3_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_8470557.html","width":130,"caption":"","height":195});
															thumbnails[8470469] = clik.newPhoto({"id":8470469,"src":"BOSS_2_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_8470469.html","width":130,"caption":"","height":195});
															thumbnails[8470443] = clik.newPhoto({"id":8470443,"src":"IMG_7444aLo_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_8470443.html","width":130,"caption":"","height":195});
															thumbnails[8470427] = clik.newPhoto({"id":8470427,"src":"IMG_7385aLo1_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_8470427.html","width":130,"caption":"","height":195});
															thumbnails[8470356] = clik.newPhoto({"id":8470356,"src":"IMG_7260aLo_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_8470356.html","width":130,"caption":"","height":195});
															thumbnails[8470345] = clik.newPhoto({"id":8470345,"src":"IMG_7293aLo_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_8470345.html","width":130,"caption":"","height":195});
															thumbnails[8330668] = clik.newPhoto({"id":8330668,"src":"VMAG1_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_8330668.html","width":130,"caption":"","height":195});
															thumbnails[8330677] = clik.newPhoto({"id":8330677,"src":"VMAG2_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_8330677.html","width":130,"caption":"","height":195});
															thumbnails[8330680] = clik.newPhoto({"id":8330680,"src":"VMAG3_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_8330680.html","width":130,"caption":"","height":195});
															thumbnails[8330683] = clik.newPhoto({"id":8330683,"src":"VMAG4_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_8330683.html","width":130,"caption":"","height":195});
															thumbnails[8331419] = clik.newPhoto({"id":8331419,"src":"VMAG6_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_8331419.html","width":130,"caption":"","height":195});
															thumbnails[8331421] = clik.newPhoto({"id":8331421,"src":"VMAG7_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_8331421.html","width":130,"caption":"","height":87});
															thumbnails[8331423] = clik.newPhoto({"id":8331423,"src":"VMAG8_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_8331423.html","width":130,"caption":"","height":87});
															thumbnails[7801065] = clik.newPhoto({"id":7801065,"src":"3_WEBSITE_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_7801065.html","width":130,"caption":"","height":195});
															thumbnails[7801112] = clik.newPhoto({"id":7801112,"src":"front_cover_1_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_7801112.html","width":130,"caption":"","height":195});
															thumbnails[7801113] = clik.newPhoto({"id":7801113,"src":"WEB_COLOUR_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_7801113.html","width":130,"caption":"","height":195});
															thumbnails[7801143] = clik.newPhoto({"id":7801143,"src":"front_cover_3_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_7801143.html","width":130,"caption":"","height":195});
															thumbnails[7562773] = clik.newPhoto({"id":7562773,"src":"vicky_2_F08BB848-1E4F-37DC-71A99BA781C3CBA3_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7562773.html","width":130,"caption":"","height":158});
															thumbnails[7562775] = clik.newPhoto({"id":7562775,"src":"VicB-131978_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7562775.html","width":130,"caption":"","height":154});
															thumbnails[7562766] = clik.newPhoto({"id":7562766,"src":"LEWIS_ORIGAMI_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_7562766.html","width":130,"caption":"","height":195});
															thumbnails[7562774] = clik.newPhoto({"id":7562774,"src":"Lew-24_mm_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_7562774.html","width":130,"caption":"","height":195});
															thumbnails[7313607] = clik.newPhoto({"id":7313607,"src":"BEA_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7313607.html","width":130,"caption":"","height":195});
															thumbnails[7313608] = clik.newPhoto({"id":7313608,"src":"bea_2_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7313608.html","width":130,"caption":"","height":195});
															thumbnails[7313610] = clik.newPhoto({"id":7313610,"src":"72eKHiggins-3_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7313610.html","width":130,"caption":"","height":195});
															thumbnails[7313609] = clik.newPhoto({"id":7313609,"src":"72KHiggins-8_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7313609.html","width":130,"caption":"","height":195});
															thumbnails[7301630] = clik.newPhoto({"id":7301630,"src":"katie_4_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7301630.html","width":130,"caption":"","height":195});
															thumbnails[7301628] = clik.newPhoto({"id":7301628,"src":"katie_6_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7301628.html","width":130,"caption":"","height":195});
															thumbnails[7301626] = clik.newPhoto({"id":7301626,"src":"katie_5_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7301626.html","width":130,"caption":"","height":195});
															thumbnails[7301620] = clik.newPhoto({"id":7301620,"src":"katie_1_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7301620.html","width":130,"caption":"","height":195});
															thumbnails[7301645] = clik.newPhoto({"id":7301645,"src":"72TomH-41_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_7301645.html","width":130,"caption":"","height":195});
															thumbnails[6865044] = clik.newPhoto({"id":6865044,"src":"72TomH-19_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_6865044.html","width":130,"caption":"","height":195});
															thumbnails[6865042] = clik.newPhoto({"id":6865042,"src":"72TomH-27_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_6865042.html","width":130,"caption":"","height":195});
															thumbnails[6865041] = clik.newPhoto({"id":6865041,"src":"72TomH-10_thumb.jpg","galleries_id":235549,"server_id":15,"link":"photo_6865041.html","width":130,"caption":"","height":195});
															thumbnails[6828583] = clik.newPhoto({"id":6828583,"src":"MONICA_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6828583.html","width":130,"caption":"","height":87});
															thumbnails[6828585] = clik.newPhoto({"id":6828585,"src":"monica_outfit_6_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6828585.html","width":130,"caption":"","height":87});
															thumbnails[6828580] = clik.newPhoto({"id":6828580,"src":"boating_lake_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6828580.html","width":130,"caption":"","height":89});
															thumbnails[6828568] = clik.newPhoto({"id":6828568,"src":"monica_outfit_5_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6828568.html","width":130,"caption":"","height":87});
															thumbnails[6313840] = clik.newPhoto({"id":6313840,"src":"MONICA_1_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6313840.html","width":130,"caption":"","height":195});
															thumbnails[6313841] = clik.newPhoto({"id":6313841,"src":"monica_3_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6313841.html","width":130,"caption":"","height":195});
															thumbnails[6314187] = clik.newPhoto({"id":6314187,"src":"IMG_1471a_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_6314187.html","width":130,"caption":"","height":195});
															thumbnails[6828596] = clik.newPhoto({"id":6828596,"src":"suticases_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_6828596.html","width":130,"caption":"","height":195});
															thumbnails[6828620] = clik.newPhoto({"id":6828620,"src":"mm_1_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6828620.html","width":130,"caption":"","height":87});
															thumbnails[7316765] = clik.newPhoto({"id":7316765,"src":"New_Image_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_7316765.html","width":130,"caption":"","height":196});
															thumbnails[7316759] = clik.newPhoto({"id":7316759,"src":"bonenecklace_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_7316759.html","width":130,"caption":"","height":196});
															thumbnails[6313736] = clik.newPhoto({"id":6313736,"src":"tony_1_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6313736.html","width":130,"caption":"...prop design ","height":195});
															thumbnails[6313737] = clik.newPhoto({"id":6313737,"src":"tony2_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6313737.html","width":130,"caption":"...prop design ","height":195});
															thumbnails[6314850] = clik.newPhoto({"id":6314850,"src":"vicky_2_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_6314850.html","width":130,"caption":"","height":164});
															thumbnails[5825341] = clik.newPhoto({"id":5825341,"src":"26377_10150131561625193_694180192_11435651_8303175_n_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_5825341.html","width":130,"caption":"","height":164});
															thumbnails[5825176] = clik.newPhoto({"id":5825176,"src":"25267_10150175390420193_694180192_11769514_652876_n_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_5825176.html","width":130,"caption":"","height":87});
															thumbnails[5825197] = clik.newPhoto({"id":5825197,"src":"27251_10150134621330193_694180192_11451062_4304132_n_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_5825197.html","width":130,"caption":"","height":195});
															thumbnails[5825400] = clik.newPhoto({"id":5825400,"src":"5729_278201055192_694180192_8608496_3994708_n_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_5825400.html","width":130,"caption":"","height":87});
															thumbnails[5825411] = clik.newPhoto({"id":5825411,"src":"5729_278201060192_694180192_8608497_7729510_n_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_5825411.html","width":130,"caption":"","height":87});
															thumbnails[4372862] = clik.newPhoto({"id":4372862,"src":"SIOBHAN_1_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_4372862.html","width":130,"caption":"","height":195});
															thumbnails[4182641] = clik.newPhoto({"id":4182641,"src":"Kim_Thurman_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_4182641.html","width":130,"caption":"","height":195});
															thumbnails[4182649] = clik.newPhoto({"id":4182649,"src":"kim8_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_4182649.html","width":130,"caption":"","height":195});
															thumbnails[4182651] = clik.newPhoto({"id":4182651,"src":"kim9_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_4182651.html","width":130,"caption":"","height":195});
															thumbnails[4182657] = clik.newPhoto({"id":4182657,"src":"Kim_5_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_4182657.html","width":130,"caption":"","height":195});
															thumbnails[4002521] = clik.newPhoto({"id":4002521,"src":"11_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_4002521.html","width":130,"caption":"","height":95});
															thumbnails[4002529] = clik.newPhoto({"id":4002529,"src":"9_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_4002529.html","width":130,"caption":"","height":90});
															thumbnails[4002538] = clik.newPhoto({"id":4002538,"src":"2and3_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_4002538.html","width":130,"caption":"","height":101});
															thumbnails[3986217] = clik.newPhoto({"id":3986217,"src":"stump_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_3986217.html","width":130,"caption":"","height":195});
															thumbnails[3952129] = clik.newPhoto({"id":3952129,"src":"1_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_3952129.html","width":130,"caption":"","height":195});
															thumbnails[3952134] = clik.newPhoto({"id":3952134,"src":"2_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_3952134.html","width":130,"caption":"","height":195});
															thumbnails[3986247] = clik.newPhoto({"id":3986247,"src":"kate5_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_3986247.html","width":130,"caption":"","height":195});
															thumbnails[3881455] = clik.newPhoto({"id":3881455,"src":"VICKY_FINAL_EDIT_thumb.JPG","galleries_id":235548,"server_id":15,"link":"photo_3881455.html","width":130,"caption":"","height":100});
															thumbnails[3880867] = clik.newPhoto({"id":3880867,"src":"KAT_8_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_3880867.html","width":130,"caption":"","height":87});
															thumbnails[3881529] = clik.newPhoto({"id":3881529,"src":"72dpi-58_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_3881529.html","width":130,"caption":"","height":194});
															thumbnails[3881521] = clik.newPhoto({"id":3881521,"src":"72dpi-32_thumb.jpg","galleries_id":235548,"server_id":15,"link":"photo_3881521.html","width":130,"caption":"","height":194});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[235548] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"BOOK 1 ","link":"gallery_235548.html","maxRecords":0.0,"photoIDs":[8470443.0,8470427.0,8470356.0,8470345.0,8330668.0,8330677.0,8331419.0,8331421.0,8331423.0,7801065.0,7801112.0,7801113.0,7801143.0,7562773.0,7562775.0,7313607.0,7313608.0,7313610.0,7313609.0,7301630.0,7301628.0,7301626.0,7301620.0,6828583.0,6828585.0,6828580.0,6828568.0,6313840.0,6313841.0,6314187.0,6828596.0,6828620.0,7316765.0,7316759.0,6313736.0,6313737.0,6314850.0,5825341.0,5825176.0,5825197.0,5825400.0,5825411.0,4372862.0,4182641.0,4182649.0,4182651.0,4182657.0,4002521.0,4002529.0,4002538.0,3986217.0,3952129.0,3952134.0,3986247.0,3881455.0,3880867.0,3881529.0,3881521.0],"skipIndex":0,"section_code":"gallery","featured_images":"8331423,7801143,7801113,7801112,7801065,7301630,7301628,7301626,7301620,6828585,6828583,6828568,6314850,6314187,6313841,6313840,6313736,5825341,5825197,5825176","id":235548,"singleSection":false});				  						galleries[235549] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"BOOK 2 ","link":"gallery_235549.html","maxRecords":0.0,"photoIDs":[8470583.0,8470489.0,8470557.0,8470469.0,8330680.0,8330683.0,7562766.0,7562774.0,7301645.0,6865044.0,6865042.0,6865041.0],"skipIndex":0,"section_code":"gallery","featured_images":"8470469,8330683,8330680,7301645,6865044,6865042,6865041","id":235549,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8470469,8331423,8331421,8330683,8330680,8330677,8330668,7801143,7801113,7801112,7801065,7562775,7562773,7301645,7301630,7301628,7301626,7301620,6865044,6865042,6865041,6828620,6828596,6828585,6828583,6828568,6314850,6314187,6313841,6313840,6313736,5825341,5825197,5825176,4372862,4182657,4182651,4182641,4002529,3986217,3952134,3952129,3881521,3881455,3880867';
imageSets[2] = '8470469,8331423,8330683,8330680,7801143,7801113,7801112,7801065,7301645,7301630,7301628,7301626,7301620,6865044,6865042,6865041,6828585,6828583,6828568,6314850,6314187,6313841,6313840,6313736,5825341,5825197,5825176';
imageSets[3] = '7801143,7801112,7801065,7301645,7301630,7301628,7301626,7301620,6865044,6865042,6865041,6314850,6314187,6313841,6313840,6313736,5825341,5825197,5825176,4372862';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/trash/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/trash/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/trash/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/trash/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/trash/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/trash/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/trash/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 = 'NATALIE ARMIN : ' + 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;
	}
}

			

