window.thumbnails = {};
															thumbnails[4490437] = clik.newPhoto({"id":4490437,"src":"DSC_18311_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490437.html","width":130,"caption":"","height":137});
															thumbnails[4490439] = clik.newPhoto({"id":4490439,"src":"DSC_18351_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490439.html","width":130,"caption":"","height":86});
															thumbnails[4490441] = clik.newPhoto({"id":4490441,"src":"DSC_1895_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490441.html","width":130,"caption":"","height":86});
															thumbnails[4490443] = clik.newPhoto({"id":4490443,"src":"DSC_1901_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490443.html","width":130,"caption":"","height":86});
															thumbnails[4490447] = clik.newPhoto({"id":4490447,"src":"DSC_1900_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490447.html","width":130,"caption":"","height":86});
															thumbnails[4490448] = clik.newPhoto({"id":4490448,"src":"DSC_1905_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490448.html","width":130,"caption":"","height":86});
															thumbnails[4490449] = clik.newPhoto({"id":4490449,"src":"DSC_1908_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490449.html","width":130,"caption":"","height":86});
															thumbnails[4490451] = clik.newPhoto({"id":4490451,"src":"DSC_1914_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490451.html","width":130,"caption":"","height":86});
															thumbnails[4490453] = clik.newPhoto({"id":4490453,"src":"DSC_1939_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490453.html","width":130,"caption":"","height":86});
															thumbnails[4490456] = clik.newPhoto({"id":4490456,"src":"DSC_1887_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490456.html","width":130,"caption":"","height":86});
															thumbnails[4490460] = clik.newPhoto({"id":4490460,"src":"DSC_1816_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490460.html","width":130,"caption":"","height":138});
															thumbnails[4490465] = clik.newPhoto({"id":4490465,"src":"DSC_2071_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490465.html","width":130,"caption":"","height":154});
															thumbnails[4490470] = clik.newPhoto({"id":4490470,"src":"DSC_2095_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490470.html","width":130,"caption":"","height":86});
															thumbnails[4490476] = clik.newPhoto({"id":4490476,"src":"SSL249292_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_4490476.html","width":130,"caption":"","height":173});
															thumbnails[4490483] = clik.newPhoto({"id":4490483,"src":"SSL24916_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_4490483.html","width":130,"caption":"","height":173});
															thumbnails[4490494] = clik.newPhoto({"id":4490494,"src":"DSC_1188_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490494.html","width":130,"caption":"","height":153});
															thumbnails[4490497] = clik.newPhoto({"id":4490497,"src":"DSC_0975_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490497.html","width":130,"caption":"","height":86});
															thumbnails[4490502] = clik.newPhoto({"id":4490502,"src":"DSC_0988_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490502.html","width":130,"caption":"","height":91});
															thumbnails[4490506] = clik.newPhoto({"id":4490506,"src":"DSC_0989_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490506.html","width":130,"caption":"","height":86});
															thumbnails[4490509] = clik.newPhoto({"id":4490509,"src":"DSC_1009_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490509.html","width":130,"caption":"","height":86});
															thumbnails[4490513] = clik.newPhoto({"id":4490513,"src":"DSC_1018_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490513.html","width":130,"caption":"","height":86});
															thumbnails[4490514] = clik.newPhoto({"id":4490514,"src":"DSC_1033_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490514.html","width":130,"caption":"","height":82});
															thumbnails[4490516] = clik.newPhoto({"id":4490516,"src":"DSC_1088_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490516.html","width":130,"caption":"","height":86});
															thumbnails[4490519] = clik.newPhoto({"id":4490519,"src":"DSC_1038_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490519.html","width":130,"caption":"","height":86});
															thumbnails[4490526] = clik.newPhoto({"id":4490526,"src":"DSC_1071_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490526.html","width":130,"caption":"","height":86});
															thumbnails[4490531] = clik.newPhoto({"id":4490531,"src":"DSC_1085_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490531.html","width":130,"caption":"","height":82});
															thumbnails[4490533] = clik.newPhoto({"id":4490533,"src":"DSC_1106_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490533.html","width":130,"caption":"","height":86});
															thumbnails[4490536] = clik.newPhoto({"id":4490536,"src":"DSC_1147-2_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490536.html","width":130,"caption":"","height":86});
															thumbnails[4490540] = clik.newPhoto({"id":4490540,"src":"DSC_1165_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490540.html","width":130,"caption":"","height":86});
															thumbnails[4490544] = clik.newPhoto({"id":4490544,"src":"DSC_1177_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490544.html","width":130,"caption":"","height":105});
															thumbnails[4490550] = clik.newPhoto({"id":4490550,"src":"DSC_1185-2_thumb.jpg","galleries_id":261698,"server_id":18,"link":"photo_4490550.html","width":130,"caption":"","height":86});
															thumbnails[5466576] = clik.newPhoto({"id":5466576,"src":"DSC_2395_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_5466576.html","width":130,"caption":"","height":103});
															thumbnails[6032687] = clik.newPhoto({"id":6032687,"src":"DSC_2357_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032687.html","width":130,"caption":"","height":87});
															thumbnails[6032718] = clik.newPhoto({"id":6032718,"src":"DSC_2346_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032718.html","width":130,"caption":"","height":118});
															thumbnails[6032722] = clik.newPhoto({"id":6032722,"src":"DSC_2696_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032722.html","width":130,"caption":"","height":87});
															thumbnails[6032725] = clik.newPhoto({"id":6032725,"src":"DSC_2766_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032725.html","width":130,"caption":"","height":87});
															thumbnails[6032726] = clik.newPhoto({"id":6032726,"src":"DSC_2777_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032726.html","width":130,"caption":"","height":94});
															thumbnails[6032727] = clik.newPhoto({"id":6032727,"src":"DSC_2775_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032727.html","width":130,"caption":"","height":124});
															thumbnails[6032732] = clik.newPhoto({"id":6032732,"src":"DSC_2767_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032732.html","width":130,"caption":"","height":90});
															thumbnails[6032736] = clik.newPhoto({"id":6032736,"src":"DSC_2794_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032736.html","width":130,"caption":"","height":103});
															thumbnails[6032739] = clik.newPhoto({"id":6032739,"src":"DSC_2789_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032739.html","width":130,"caption":"","height":87});
															thumbnails[6032741] = clik.newPhoto({"id":6032741,"src":"DSC_2797_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032741.html","width":130,"caption":"","height":87});
															thumbnails[6032746] = clik.newPhoto({"id":6032746,"src":"DSC_2802_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032746.html","width":130,"caption":"","height":87});
															thumbnails[6032748] = clik.newPhoto({"id":6032748,"src":"DSC_2807_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032748.html","width":130,"caption":"","height":87});
															thumbnails[8241541] = clik.newPhoto({"id":8241541,"src":"DSC_2934_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8241541.html","width":130,"caption":"","height":165});
															thumbnails[8241779] = clik.newPhoto({"id":8241779,"src":"DSC_2917_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8241779.html","width":130,"caption":"","height":196});
															thumbnails[8241781] = clik.newPhoto({"id":8241781,"src":"DSC_2903_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8241781.html","width":130,"caption":"","height":196});
															thumbnails[8241784] = clik.newPhoto({"id":8241784,"src":"DSC_3073_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8241784.html","width":130,"caption":"","height":87});
															thumbnails[8241786] = clik.newPhoto({"id":8241786,"src":"DSC_3032_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8241786.html","width":130,"caption":"","height":174});
															thumbnails[8241860] = clik.newPhoto({"id":8241860,"src":"DSC_29681_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8241860.html","width":130,"caption":"","height":133});
															thumbnails[8241999] = clik.newPhoto({"id":8241999,"src":"DSC_3773_11_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8241999.html","width":130,"caption":"","height":87});
															thumbnails[8242002] = clik.newPhoto({"id":8242002,"src":"DSC_37781_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242002.html","width":130,"caption":"","height":196});
															thumbnails[8242005] = clik.newPhoto({"id":8242005,"src":"DSC_3726_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242005.html","width":130,"caption":"","height":96});
															thumbnails[8242007] = clik.newPhoto({"id":8242007,"src":"DSC_3724_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242007.html","width":130,"caption":"","height":87});
															thumbnails[8242010] = clik.newPhoto({"id":8242010,"src":"DSC_3635_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242010.html","width":130,"caption":"","height":107});
															thumbnails[8242012] = clik.newPhoto({"id":8242012,"src":"DSC_3559_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242012.html","width":130,"caption":"","height":196});
															thumbnails[8242014] = clik.newPhoto({"id":8242014,"src":"DSC_3556_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242014.html","width":130,"caption":"","height":196});
															thumbnails[8242017] = clik.newPhoto({"id":8242017,"src":"DSC_3513_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242017.html","width":130,"caption":"","height":196});
															thumbnails[8242019] = clik.newPhoto({"id":8242019,"src":"DSC_3504_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242019.html","width":130,"caption":"","height":140});
															thumbnails[8242021] = clik.newPhoto({"id":8242021,"src":"DSC_3147_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242021.html","width":130,"caption":"","height":92});
															thumbnails[8242037] = clik.newPhoto({"id":8242037,"src":"DSC_4388_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242037.html","width":130,"caption":"","height":121});
															thumbnails[8242038] = clik.newPhoto({"id":8242038,"src":"DSC_4260_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242038.html","width":130,"caption":"","height":196});
															thumbnails[8242041] = clik.newPhoto({"id":8242041,"src":"DSC_4250_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242041.html","width":130,"caption":"","height":97});
															thumbnails[8242043] = clik.newPhoto({"id":8242043,"src":"DSC_4165_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242043.html","width":130,"caption":"","height":87});
															thumbnails[8242046] = clik.newPhoto({"id":8242046,"src":"DSC_4151_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242046.html","width":130,"caption":"","height":87});
															thumbnails[8242050] = clik.newPhoto({"id":8242050,"src":"DSC_3565_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242050.html","width":130,"caption":"","height":173});
															thumbnails[8242052] = clik.newPhoto({"id":8242052,"src":"DSC_3089_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242052.html","width":130,"caption":"","height":180});
															thumbnails[8242053] = clik.newPhoto({"id":8242053,"src":"DSC_3085_thumb.jpg","galleries_id":261702,"server_id":18,"link":"photo_8242053.html","width":130,"caption":"","height":87});
															thumbnails[6032730] = clik.newPhoto({"id":6032730,"src":"DSC_2781_thumb.JPG","galleries_id":339168,"server_id":18,"link":"photo_6032730.html","width":130,"caption":"","height":177});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[261698] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Babies","link":"gallery_261698.html","maxRecords":0.0,"photoIDs":[4490437.0,4490439.0,4490441.0,4490443.0,4490447.0,4490448.0,4490449.0,4490451.0,4490453.0,4490456.0,4490460.0,4490465.0,4490470.0,4490494.0,4490497.0,4490502.0,4490506.0,4490509.0,4490513.0,4490514.0,4490516.0,4490519.0,4490526.0,4490531.0,4490533.0,4490536.0,4490540.0,4490544.0,4490550.0],"skipIndex":0,"section_code":"gallery","featured_images":"4490550,4490544,4490540,4490536,4490533,4490531,4490526,4490519,4490516,4490514","id":261698,"singleSection":false});				  						galleries[339168] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cool Kids","link":"gallery_339168.html","maxRecords":0.0,"photoIDs":[5466576.0,6032687.0,6032718.0,6032722.0,6032725.0,6032726.0,6032727.0,6032732.0,6032736.0,6032739.0,6032741.0,6032746.0,6032748.0,6032730.0],"skipIndex":0,"section_code":"gallery","featured_images":"6032748,6032746,6032741,6032739,6032736,6032732,6032730,6032727,6032726,6032725","id":339168,"singleSection":false});				  						galleries[261702] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_261702.html","maxRecords":0.0,"photoIDs":[4490476.0,4490483.0,8241541.0,8241779.0,8241781.0,8241784.0,8241786.0,8241860.0,8241999.0,8242002.0,8242005.0,8242007.0,8242010.0,8242012.0,8242014.0,8242017.0,8242019.0,8242021.0,8242037.0,8242038.0,8242041.0,8242043.0,8242046.0,8242050.0,8242052.0,8242053.0],"skipIndex":0,"section_code":"gallery","featured_images":"8242053,8242052,8242050,8242046,8242043,8242041,8242038,8242037,8242021,8242019,8242017,8242014,8242012,8242010,8242007,8242005,8242002,8241999,8241860,8241786,8241784,8241781,8241779,8241541","id":261702,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8242053,8242052,8242050,8242046,8242043,8242041,8242038,8242037,8242021,8242019,8242017,8242014,8242012,8242010,8242007,8242005,8242002,8241999,8241860,8241786,8241784,8241781,8241779,8241541';
imageSets[2] = '8242053,8242052,8242050,8242046,8242043,8242041,8242038,8242037,8242021,8242019,8242017,8242014,8242012,8242010,8242007,8242005,8242002,8241999,8241860,8241786,8241784,8241781,8241779,8241541';
imageSets[3] = '8242053,8242052,8242050,8242046,8242043,8242041,8242038,8242037,8242021,8242019,8242017,8242014,8242012,8242010,8242007,8242005,8242002,8241999,8241860,8241786,8241784,8241781,8241779,8241541';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/abibeeching/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/abibeeching/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 = 'Abi Beeching Photography : ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
											temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="ABIBEECHING">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

