window.thumbnails = {};
															thumbnails[7236828] = clik.newPhoto({"id":7236828,"src":"chteam_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Team church photos","height":163});
															thumbnails[1871018] = clik.newPhoto({"id":1871018,"src":"Baptism3_thumb.jpg","galleries_id":88063,"server_id":15,"link":"photo_1871018.html","width":130,"caption":"","height":98});
															thumbnails[1871033] = clik.newPhoto({"id":1871033,"src":"Wedding4_thumb.jpg","galleries_id":88064,"server_id":15,"link":"photo_1871033.html","width":130,"caption":"","height":98});
															thumbnails[1871026] = clik.newPhoto({"id":1871026,"src":"Funeral4_thumb.jpg","galleries_id":88065,"server_id":15,"link":"photo_1871026.html","width":130,"caption":"","height":98});
															thumbnails[1871035] = clik.newPhoto({"id":1871035,"src":"Sunday4_thumb.jpg","galleries_id":88066,"server_id":15,"link":"photo_1871035.html","width":130,"caption":"","height":98});
															thumbnails[1871028] = clik.newPhoto({"id":1871028,"src":"News9_thumb.jpg","galleries_id":88067,"server_id":15,"link":"photo_1871028.html","width":130,"caption":"","height":98});
															thumbnails[1871023] = clik.newPhoto({"id":1871023,"src":"Contact4_thumb.jpg","galleries_id":88068,"server_id":15,"link":"photo_1871023.html","width":130,"caption":"","height":98});
															thumbnails[1955335] = clik.newPhoto({"id":1955335,"src":"Baptism4_thumb.jpg","galleries_id":86673,"server_id":15,"link":"photo_1955335.html","width":130,"caption":"","height":98});
															thumbnails[1231519] = clik.newPhoto({"id":1231519,"src":"Wedding5_thumb.jpg","galleries_id":86668,"server_id":15,"link":"photo_1231519.html","width":130,"caption":"","height":98});
															thumbnails[1231516] = clik.newPhoto({"id":1231516,"src":"Funeral5_thumb.jpg","galleries_id":86675,"server_id":15,"link":"photo_1231516.html","width":130,"caption":"<br>\r\n","height":98});
															thumbnails[1231518] = clik.newPhoto({"id":1231518,"src":"Sunday5_thumb.jpg","galleries_id":86670,"server_id":15,"link":"photo_1231518.html","width":130,"caption":"","height":98});
															thumbnails[1231517] = clik.newPhoto({"id":1231517,"src":"News5_thumb.jpg","galleries_id":86676,"server_id":15,"link":"photo_1231517.html","width":130,"caption":"","height":98});
															thumbnails[1231515] = clik.newPhoto({"id":1231515,"src":"Contact5_thumb.jpg","galleries_id":86677,"server_id":15,"link":"photo_1231515.html","width":130,"caption":"","height":98});
															thumbnails[1955337] = clik.newPhoto({"id":1955337,"src":"Baptism5_thumb.jpg","galleries_id":88044,"server_id":15,"link":"photo_1955337.html","width":130,"caption":"<br>\r\n","height":98});
															thumbnails[1955353] = clik.newPhoto({"id":1955353,"src":"Wedding6_thumb.jpg","galleries_id":88045,"server_id":15,"link":"photo_1955353.html","width":130,"caption":"","height":98});
															thumbnails[1955372] = clik.newPhoto({"id":1955372,"src":"Funeral8_thumb.jpg","galleries_id":86672,"server_id":15,"link":"photo_1955372.html","width":130,"caption":"","height":98});
															thumbnails[1955377] = clik.newPhoto({"id":1955377,"src":"Sunday6_thumb.jpg","galleries_id":88046,"server_id":15,"link":"photo_1955377.html","width":130,"caption":"","height":98});
															thumbnails[1955387] = clik.newPhoto({"id":1955387,"src":"News6_thumb.jpg","galleries_id":88047,"server_id":15,"link":"photo_1955387.html","width":130,"caption":"","height":98});
															thumbnails[1956977] = clik.newPhoto({"id":1956977,"src":"Contact6_thumb.jpg","galleries_id":88048,"server_id":15,"link":"photo_1956977.html","width":130,"caption":"","height":98});
															thumbnails[1955340] = clik.newPhoto({"id":1955340,"src":"Baptism6_thumb.jpg","galleries_id":88187,"server_id":15,"link":"photo_1955340.html","width":130,"caption":"","height":98});
															thumbnails[1955355] = clik.newPhoto({"id":1955355,"src":"Wedding7_thumb.jpg","galleries_id":88188,"server_id":15,"link":"photo_1955355.html","width":130,"caption":"","height":98});
															thumbnails[1955367] = clik.newPhoto({"id":1955367,"src":"Funeral6_thumb.jpg","galleries_id":88189,"server_id":15,"link":"photo_1955367.html","width":130,"caption":"","height":98});
															thumbnails[1955379] = clik.newPhoto({"id":1955379,"src":"Sunday7_thumb.jpg","galleries_id":88190,"server_id":15,"link":"photo_1955379.html","width":130,"caption":"","height":98});
															thumbnails[1955388] = clik.newPhoto({"id":1955388,"src":"News7_thumb.jpg","galleries_id":88191,"server_id":15,"link":"photo_1955388.html","width":130,"caption":"","height":98});
															thumbnails[1956978] = clik.newPhoto({"id":1956978,"src":"Contact7_thumb.jpg","galleries_id":88192,"server_id":15,"link":"photo_1956978.html","width":130,"caption":"","height":98});
															thumbnails[1955375] = clik.newPhoto({"id":1955375,"src":"Baptism7_thumb.jpg","galleries_id":131337,"server_id":15,"link":"photo_1955375.html","width":130,"caption":"","height":98});
															thumbnails[1955357] = clik.newPhoto({"id":1955357,"src":"Wedding8_thumb.jpg","galleries_id":131338,"server_id":15,"link":"photo_1955357.html","width":130,"caption":"","height":98});
															thumbnails[1955368] = clik.newPhoto({"id":1955368,"src":"Funeral7_thumb.jpg","galleries_id":131339,"server_id":15,"link":"photo_1955368.html","width":130,"caption":"","height":98});
															thumbnails[1955382] = clik.newPhoto({"id":1955382,"src":"Sunday8_thumb.jpg","galleries_id":131340,"server_id":15,"link":"photo_1955382.html","width":130,"caption":"","height":98});
															thumbnails[1955389] = clik.newPhoto({"id":1955389,"src":"News8_thumb.jpg","galleries_id":131341,"server_id":15,"link":"photo_1955389.html","width":130,"caption":"","height":98});
															thumbnails[1956979] = clik.newPhoto({"id":1956979,"src":"Contact8_thumb.jpg","galleries_id":131342,"server_id":15,"link":"photo_1956979.html","width":130,"caption":"","height":98});
															thumbnails[1958425] = clik.newPhoto({"id":1958425,"src":"homesplash_thumb.jpg","galleries_id":137175,"server_id":15,"link":"photo_1958425.html","width":130,"caption":"","height":95});
															thumbnails[2172667] = clik.newPhoto({"id":2172667,"src":"001_Entrance_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172667.html","width":130,"caption":"","height":95});
															thumbnails[2172689] = clik.newPhoto({"id":2172689,"src":"016_Sweets_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172689.html","width":130,"caption":"","height":98});
															thumbnails[2172700] = clik.newPhoto({"id":2172700,"src":"044_BouncyCastle_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172700.html","width":130,"caption":"","height":96});
															thumbnails[2172694] = clik.newPhoto({"id":2172694,"src":"022_CakeStall_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172694.html","width":130,"caption":"","height":173});
															thumbnails[2172701] = clik.newPhoto({"id":2172701,"src":"053_PopCorn_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172701.html","width":130,"caption":"","height":173});
															thumbnails[2172682] = clik.newPhoto({"id":2172682,"src":"006_BookStall_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172682.html","width":130,"caption":"","height":98});
															thumbnails[2172703] = clik.newPhoto({"id":2172703,"src":"057_BeatTheGoalie_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172703.html","width":130,"caption":"","height":95});
															thumbnails[2172686] = clik.newPhoto({"id":2172686,"src":"012__CuddlyToys_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172686.html","width":130,"caption":"","height":98});
															thumbnails[2172679] = clik.newPhoto({"id":2172679,"src":"002_PlantSale_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172679.html","width":130,"caption":"","height":98});
															thumbnails[2172692] = clik.newPhoto({"id":2172692,"src":"018_Booze_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172692.html","width":130,"caption":"","height":98});
															thumbnails[2172697] = clik.newPhoto({"id":2172697,"src":"027_Cafe_thumb.jpg","galleries_id":143954,"server_id":15,"link":"photo_2172697.html","width":130,"caption":"","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[88063] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Baptisms","link":"section120487_88063.html","maxRecords":0.0,"photoIDs":[1871018.0],"skipIndex":0,"section_code":"section120487","featured_images":1871018.0,"id":88063,"singleSection":false});				  						galleries[86673] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Baptisms","link":"section119026_86673.html","maxRecords":0.0,"photoIDs":[1955335.0],"skipIndex":0,"section_code":"section119026","featured_images":1955335.0,"id":86673,"singleSection":false});				  						galleries[88044] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Baptisms","link":"section119036_88044.html","maxRecords":0.0,"photoIDs":[1955337.0],"skipIndex":0,"section_code":"section119036","featured_images":1955337.0,"id":88044,"singleSection":false});				  						galleries[88187] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Baptisms","link":"section120484_88187.html","maxRecords":0.0,"photoIDs":[1955340.0],"skipIndex":0,"section_code":"section120484","featured_images":1955340.0,"id":88187,"singleSection":false});				  						galleries[131337] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Baptisms","link":"section120486_131337.html","maxRecords":0.0,"photoIDs":[1955375.0],"skipIndex":0,"section_code":"section120486","featured_images":1955375.0,"id":131337,"singleSection":false});				  						galleries[88064] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"section120487_88064.html","maxRecords":0.0,"photoIDs":[1871033.0],"skipIndex":0,"section_code":"section120487","featured_images":1871033.0,"id":88064,"singleSection":false});				  						galleries[86668] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"section119026_86668.html","maxRecords":0.0,"photoIDs":[1231519.0],"skipIndex":0,"section_code":"section119026","featured_images":1231519.0,"id":86668,"singleSection":false});				  						galleries[88045] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"section119036_88045.html","maxRecords":0.0,"photoIDs":[1955353.0],"skipIndex":0,"section_code":"section119036","featured_images":1955353.0,"id":88045,"singleSection":false});				  						galleries[88188] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"section120484_88188.html","maxRecords":0.0,"photoIDs":[1955355.0],"skipIndex":0,"section_code":"section120484","featured_images":1955355.0,"id":88188,"singleSection":false});				  						galleries[131338] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"section120486_131338.html","maxRecords":0.0,"photoIDs":[1955357.0],"skipIndex":0,"section_code":"section120486","featured_images":1955357.0,"id":131338,"singleSection":false});				  						galleries[88065] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Funerals","link":"section120487_88065.html","maxRecords":0.0,"photoIDs":[1871026.0],"skipIndex":0,"section_code":"section120487","featured_images":1871026.0,"id":88065,"singleSection":false});				  						galleries[86675] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Funerals","link":"section119026_86675.html","maxRecords":0.0,"photoIDs":[1231516.0],"skipIndex":0,"section_code":"section119026","featured_images":1231516.0,"id":86675,"singleSection":false});				  						galleries[86672] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Funerals","link":"section119036_86672.html","maxRecords":0.0,"photoIDs":[1955372.0],"skipIndex":0,"section_code":"section119036","featured_images":1955372.0,"id":86672,"singleSection":false});				  						galleries[88189] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Funerals","link":"section120484_88189.html","maxRecords":0.0,"photoIDs":[1955367.0],"skipIndex":0,"section_code":"section120484","featured_images":1955367.0,"id":88189,"singleSection":false});				  						galleries[131339] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Funerals","link":"section120486_131339.html","maxRecords":0.0,"photoIDs":[1955368.0],"skipIndex":0,"section_code":"section120486","featured_images":1955368.0,"id":131339,"singleSection":false});				  						galleries[88066] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sundays","link":"section120487_88066.html","maxRecords":0.0,"photoIDs":[1871035.0],"skipIndex":0,"section_code":"section120487","featured_images":1871035.0,"id":88066,"singleSection":false});				  						galleries[86670] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sundays","link":"section119026_86670.html","maxRecords":0.0,"photoIDs":[1231518.0],"skipIndex":0,"section_code":"section119026","featured_images":1231518.0,"id":86670,"singleSection":false});				  						galleries[88046] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sundays","link":"section119036_88046.html","maxRecords":0.0,"photoIDs":[1955377.0],"skipIndex":0,"section_code":"section119036","featured_images":1955377.0,"id":88046,"singleSection":false});				  						galleries[88190] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sundays","link":"section120484_88190.html","maxRecords":0.0,"photoIDs":[1955379.0],"skipIndex":0,"section_code":"section120484","featured_images":1955379.0,"id":88190,"singleSection":false});				  						galleries[131340] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sundays","link":"section120486_131340.html","maxRecords":0.0,"photoIDs":[1955382.0],"skipIndex":0,"section_code":"section120486","featured_images":1955382.0,"id":131340,"singleSection":false});				  						galleries[88067] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Events","link":"section120487_88067.html","maxRecords":0.0,"photoIDs":[1871028.0],"skipIndex":0,"section_code":"section120487","featured_images":1871028.0,"id":88067,"singleSection":false});				  						galleries[86676] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Events","link":"section119026_86676.html","maxRecords":0.0,"photoIDs":[1231517.0],"skipIndex":0,"section_code":"section119026","featured_images":1231517.0,"id":86676,"singleSection":false});				  						galleries[88047] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Events","link":"section119036_88047.html","maxRecords":0.0,"photoIDs":[1955387.0],"skipIndex":0,"section_code":"section119036","featured_images":1955387.0,"id":88047,"singleSection":false});				  						galleries[88191] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Events","link":"section120484_88191.html","maxRecords":0.0,"photoIDs":[1955388.0],"skipIndex":0,"section_code":"section120484","featured_images":1955388.0,"id":88191,"singleSection":false});				  						galleries[131341] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Events","link":"section120486_131341.html","maxRecords":0.0,"photoIDs":[1955389.0],"skipIndex":0,"section_code":"section120486","featured_images":1955389.0,"id":131341,"singleSection":false});				  						galleries[88068] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Contacts","link":"section120487_88068.html","maxRecords":0.0,"photoIDs":[1871023.0],"skipIndex":0,"section_code":"section120487","featured_images":1871023.0,"id":88068,"singleSection":false});				  						galleries[86677] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Contacts","link":"section119026_86677.html","maxRecords":0.0,"photoIDs":[1231515.0],"skipIndex":0,"section_code":"section119026","featured_images":1231515.0,"id":86677,"singleSection":false});				  						galleries[88048] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Contacts","link":"section119036_88048.html","maxRecords":0.0,"photoIDs":[1956977.0],"skipIndex":0,"section_code":"section119036","featured_images":1956977.0,"id":88048,"singleSection":false});				  						galleries[88192] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Contacts","link":"section120484_88192.html","maxRecords":0.0,"photoIDs":[1956978.0],"skipIndex":0,"section_code":"section120484","featured_images":1956978.0,"id":88192,"singleSection":false});				  						galleries[131342] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Contacts","link":"section120486_131342.html","maxRecords":0.0,"photoIDs":[1956979.0],"skipIndex":0,"section_code":"section120486","featured_images":1956979.0,"id":131342,"singleSection":false});				  						galleries[137175] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Team Events","link":"section177441.html","maxRecords":0.0,"photoIDs":[1958425.0],"skipIndex":0,"section_code":"section177441","featured_images":1958425.0,"id":137175,"singleSection":true});				  						galleries[143954] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"May Fayre 2008","link":"section185199.html","maxRecords":0.0,"photoIDs":[2172667.0,2172689.0,2172700.0,2172694.0,2172701.0,2172682.0,2172703.0,2172686.0,2172679.0,2172692.0,2172697.0],"skipIndex":0,"section_code":"section185199","featured_images":"2172703,2172701,2172700,2172697,2172694,2172692,2172689,2172686,2172682,2172679","id":143954,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7236828';
imageSets[2] = '1231519,1231516,1231518,1231515';
imageSets[3] = '7236828,2172703,2172701,2172700,2172697,2172694,2172692,2172689,2172686,2172682,2172679,2172667,1958425,1956979,1956978,1956977,1955389,1955388,1955387,1955382,1955379,1955377,1955375,1955372,1955368,1955367,1955357,1955355,1955353,1955340,1955337,1955335,1871035,1871033,1871028,1871026,1871023,1871018,1231519,1231518,1231517,1231516,1231515';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/caterham/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/caterham/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/caterham/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/caterham/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/caterham/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/caterham/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/caterham/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/caterham/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 += 'section120487.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 && 'section120487' != '') {
					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 = 'Caterham Team Ministry: ' + 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.item_price !== '') {
			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;
	}
}

			

