window.thumbnails = {};
															thumbnails[8176603] = clik.newPhoto({"id":8176603,"src":"shottonweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_8176603.html","width":1,"caption":"","height":1});
															thumbnails[9003205] = clik.newPhoto({"id":9003205,"src":"ian1_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_9003205.html","width":1,"caption":"","height":1});
															thumbnails[5130483] = clik.newPhoto({"id":5130483,"src":"adeleweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130483.html","width":1,"caption":"","height":1});
															thumbnails[5446661] = clik.newPhoto({"id":5446661,"src":"kimcattrallweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5446661.html","width":1,"caption":"","height":1});
															thumbnails[6237885] = clik.newPhoto({"id":6237885,"src":"ezraweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_6237885.html","width":1,"caption":"","height":1});
															thumbnails[7420109] = clik.newPhoto({"id":7420109,"src":"pascal_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_7420109.html","width":1,"caption":"","height":1});
															thumbnails[9059639] = clik.newPhoto({"id":9059639,"src":"harryweb2_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_9059639.html","width":1,"caption":"","height":1});
															thumbnails[7956377] = clik.newPhoto({"id":7956377,"src":"gavinweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_7956377.html","width":1,"caption":"","height":1});
															thumbnails[7956399] = clik.newPhoto({"id":7956399,"src":"davidweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_7956399.html","width":1,"caption":"","height":1});
															thumbnails[8347663] = clik.newPhoto({"id":8347663,"src":"urbanweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_8347663.html","width":1,"caption":"","height":1});
															thumbnails[5394880] = clik.newPhoto({"id":5394880,"src":"andersweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5394880.html","width":1,"caption":"","height":1});
															thumbnails[6928654] = clik.newPhoto({"id":6928654,"src":"detmarweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_6928654.html","width":1,"caption":"","height":1});
															thumbnails[5130528] = clik.newPhoto({"id":5130528,"src":"smithweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130528.html","width":1,"caption":"","height":1});
															thumbnails[7956337] = clik.newPhoto({"id":7956337,"src":"natweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_7956337.html","width":1,"caption":"","height":1});
															thumbnails[9059640] = clik.newPhoto({"id":9059640,"src":"samweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_9059640.html","width":1,"caption":"","height":1});
															thumbnails[9059641] = clik.newPhoto({"id":9059641,"src":"kateweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_9059641.html","width":1,"caption":"","height":1});
															thumbnails[5130486] = clik.newPhoto({"id":5130486,"src":"mattweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130486.html","width":1,"caption":"","height":1});
															thumbnails[5130541] = clik.newPhoto({"id":5130541,"src":"flu_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130541.html","width":1,"caption":"","height":1});
															thumbnails[5130534] = clik.newPhoto({"id":5130534,"src":"gageweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130534.html","width":1,"caption":"","height":1});
															thumbnails[6731432] = clik.newPhoto({"id":6731432,"src":"aidenweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_6731432.html","width":1,"caption":"","height":1});
															thumbnails[7956341] = clik.newPhoto({"id":7956341,"src":"anweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_7956341.html","width":1,"caption":"","height":1});
															thumbnails[5130495] = clik.newPhoto({"id":5130495,"src":"hellerweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130495.html","width":1,"caption":"","height":1});
															thumbnails[8350474] = clik.newPhoto({"id":8350474,"src":"04_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_8350474.html","width":1,"caption":"","height":1});
															thumbnails[5130556] = clik.newPhoto({"id":5130556,"src":"monkweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130556.html","width":1,"caption":"","height":1});
															thumbnails[5448748] = clik.newPhoto({"id":5448748,"src":"howieweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5448748.html","width":1,"caption":"","height":1});
															thumbnails[7211983] = clik.newPhoto({"id":7211983,"src":"oonaghweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_7211983.html","width":1,"caption":"","height":1});
															thumbnails[5130490] = clik.newPhoto({"id":5130490,"src":"kentonweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130490.html","width":1,"caption":"","height":1});
															thumbnails[5130513] = clik.newPhoto({"id":5130513,"src":"niallweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130513.html","width":1,"caption":"","height":1});
															thumbnails[5130514] = clik.newPhoto({"id":5130514,"src":"prostweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130514.html","width":1,"caption":"","height":1});
															thumbnails[5319324] = clik.newPhoto({"id":5319324,"src":"burstonweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5319324.html","width":1,"caption":"","height":1});
															thumbnails[5130504] = clik.newPhoto({"id":5130504,"src":"danbowweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130504.html","width":1,"caption":"","height":1});
															thumbnails[8220294] = clik.newPhoto({"id":8220294,"src":"lauraweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_8220294.html","width":1,"caption":"","height":1});
															thumbnails[5130507] = clik.newPhoto({"id":5130507,"src":"danweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130507.html","width":1,"caption":"","height":1});
															thumbnails[7211967] = clik.newPhoto({"id":7211967,"src":"danielweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_7211967.html","width":1,"caption":"","height":1});
															thumbnails[6221680] = clik.newPhoto({"id":6221680,"src":"lajohnweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_6221680.html","width":1,"caption":"","height":1});
															thumbnails[5490286] = clik.newPhoto({"id":5490286,"src":"catherineweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5490286.html","width":1,"caption":"","height":1});
															thumbnails[8347662] = clik.newPhoto({"id":8347662,"src":"sharmadeanweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_8347662.html","width":1,"caption":"","height":1});
															thumbnails[5659650] = clik.newPhoto({"id":5659650,"src":"scarlettweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5659650.html","width":1,"caption":"","height":1});
															thumbnails[5421768] = clik.newPhoto({"id":5421768,"src":"harrisweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5421768.html","width":1,"caption":" ","height":1});
															thumbnails[5130532] = clik.newPhoto({"id":5130532,"src":"luneweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130532.html","width":1,"caption":"","height":1});
															thumbnails[5130496] = clik.newPhoto({"id":5130496,"src":"mofweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130496.html","width":1,"caption":"","height":1});
															thumbnails[5130491] = clik.newPhoto({"id":5130491,"src":"loganweb_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_5130491.html","width":1,"caption":"","height":1});
															thumbnails[7420049] = clik.newPhoto({"id":7420049,"src":"ghweb4_thumb.jpg","galleries_id":434331,"server_id":1,"link":"photo_7420049.html","width":1,"caption":"","height":1});
															thumbnails[8350421] = clik.newPhoto({"id":8350421,"src":"001_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350421.html","width":1,"caption":"","height":1});
															thumbnails[8350453] = clik.newPhoto({"id":8350453,"src":"05_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350453.html","width":1,"caption":"","height":1});
															thumbnails[8350454] = clik.newPhoto({"id":8350454,"src":"01_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350454.html","width":1,"caption":"","height":1});
															thumbnails[8350455] = clik.newPhoto({"id":8350455,"src":"06_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350455.html","width":1,"caption":"","height":1});
															thumbnails[8350456] = clik.newPhoto({"id":8350456,"src":"07_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350456.html","width":1,"caption":"","height":1});
															thumbnails[8350457] = clik.newPhoto({"id":8350457,"src":"33_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350457.html","width":1,"caption":"","height":1});
															thumbnails[8350459] = clik.newPhoto({"id":8350459,"src":"19_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350459.html","width":1,"caption":"","height":1});
															thumbnails[8350627] = clik.newPhoto({"id":8350627,"src":"40_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350627.html","width":1,"caption":"","height":1});
															thumbnails[8350462] = clik.newPhoto({"id":8350462,"src":"34_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350462.html","width":1,"caption":"","height":1});
															thumbnails[8350490] = clik.newPhoto({"id":8350490,"src":"15_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350490.html","width":1,"caption":"","height":1});
															thumbnails[8350461] = clik.newPhoto({"id":8350461,"src":"17_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350461.html","width":1,"caption":"","height":1});
															thumbnails[8350465] = clik.newPhoto({"id":8350465,"src":"14_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350465.html","width":1,"caption":"","height":1});
															thumbnails[8350479] = clik.newPhoto({"id":8350479,"src":"03_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350479.html","width":1,"caption":"","height":1});
															thumbnails[8350476] = clik.newPhoto({"id":8350476,"src":"12_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350476.html","width":1,"caption":"","height":1});
															thumbnails[8350591] = clik.newPhoto({"id":8350591,"src":"39_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350591.html","width":1,"caption":"","height":1});
															thumbnails[8350483] = clik.newPhoto({"id":8350483,"src":"10_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350483.html","width":1,"caption":"","height":1});
															thumbnails[8350486] = clik.newPhoto({"id":8350486,"src":"bum_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350486.html","width":1,"caption":"","height":1});
															thumbnails[8350488] = clik.newPhoto({"id":8350488,"src":"13_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350488.html","width":1,"caption":"","height":1});
															thumbnails[8357833] = clik.newPhoto({"id":8357833,"src":"nadiaweb1_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8357833.html","width":1,"caption":"","height":1});
															thumbnails[8350481] = clik.newPhoto({"id":8350481,"src":"11_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350481.html","width":1,"caption":"","height":1});
															thumbnails[8350492] = clik.newPhoto({"id":8350492,"src":"16_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350492.html","width":1,"caption":"","height":1});
															thumbnails[8357834] = clik.newPhoto({"id":8357834,"src":"homeweb_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8357834.html","width":1,"caption":"","height":1});
															thumbnails[8357910] = clik.newPhoto({"id":8357910,"src":"35_06982350-1E4F-37DC-7105424223DC919B_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8357910.html","width":1,"caption":"","height":1});
															thumbnails[8350493] = clik.newPhoto({"id":8350493,"src":"18_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350493.html","width":1,"caption":"","height":1});
															thumbnails[8350500] = clik.newPhoto({"id":8350500,"src":"21_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350500.html","width":1,"caption":"","height":1});
															thumbnails[8350496] = clik.newPhoto({"id":8350496,"src":"24_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350496.html","width":1,"caption":"","height":1});
															thumbnails[8350498] = clik.newPhoto({"id":8350498,"src":"23_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350498.html","width":1,"caption":"","height":1});
															thumbnails[8350480] = clik.newPhoto({"id":8350480,"src":"35_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350480.html","width":1,"caption":"","height":1});
															thumbnails[8350501] = clik.newPhoto({"id":8350501,"src":"22_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350501.html","width":1,"caption":"","height":1});
															thumbnails[8350502] = clik.newPhoto({"id":8350502,"src":"25_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350502.html","width":1,"caption":"","height":1});
															thumbnails[8350506] = clik.newPhoto({"id":8350506,"src":"29_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350506.html","width":1,"caption":"","height":1});
															thumbnails[8350504] = clik.newPhoto({"id":8350504,"src":"27_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350504.html","width":1,"caption":"","height":1});
															thumbnails[8350505] = clik.newPhoto({"id":8350505,"src":"30_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8350505.html","width":1,"caption":"","height":1});
															thumbnails[8357854] = clik.newPhoto({"id":8357854,"src":"interior1_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8357854.html","width":1,"caption":"","height":1});
															thumbnails[8357856] = clik.newPhoto({"id":8357856,"src":"inteiors4_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8357856.html","width":1,"caption":"","height":1});
															thumbnails[8357857] = clik.newPhoto({"id":8357857,"src":"interiors3_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8357857.html","width":1,"caption":"","height":1});
															thumbnails[8351046] = clik.newPhoto({"id":8351046,"src":"alexweb_thumb.jpg","galleries_id":443695,"server_id":1,"link":"photo_8351046.html","width":1,"caption":"","height":1});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  							galleries[443695] = clik.newGallery({"parentGallery":"","usePopups":true,"title":".","link":"section533387.html#galleries_id=443695","maxRecords":0.0,"photoIDs":[8350421.0,8350453.0,8350454.0,8350455.0,8350456.0,8350457.0,8350459.0,8350627.0,8350462.0,8350490.0,8350461.0,8350465.0,8350479.0,8350476.0,8350591.0,8350483.0,8350486.0,8350488.0,8357833.0,8350481.0,8350492.0,8357834.0,8357910.0,8350493.0,8350500.0,8350496.0,8350498.0,8350480.0,8350501.0,8350502.0,8350506.0,8350504.0,8350505.0,8357854.0,8357856.0,8357857.0,8351046.0],"skipIndex":true,"section_code":"section533387","featured_images":"8357910,8357857,8357856,8357854,8357834,8357833,8351046,8350627,8350591,8350506","id":443695,"singleSection":true});				  							galleries[434331] = clik.newGallery({"parentGallery":"","usePopups":true,"title":".","link":"section521832.html#galleries_id=434331","maxRecords":0.0,"photoIDs":[8176603.0,9003205.0,5130483.0,5446661.0,6237885.0,7420109.0,9059639.0,7956377.0,7956399.0,8347663.0,5394880.0,6928654.0,5130528.0,7956337.0,9059640.0,9059641.0,5130486.0,5130541.0,5130534.0,6731432.0,7956341.0,5130495.0,8350474.0,5130556.0,5448748.0,7211983.0,5130490.0,5130513.0,5130514.0,5319324.0,5130504.0,8220294.0,5130507.0,7211967.0,6221680.0,5490286.0,8347662.0,5659650.0,5421768.0,5130532.0,5130496.0,5130491.0,7420049.0],"skipIndex":true,"section_code":"section521832","featured_images":"9059641,9059640,9059639,9003205,8350474,8347663,8347662,8220294,8176603,7956399","id":434331,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8350421,8176603,8350454,8350453,8350455,7420109,8350456,7956377,8350457,8347663,7956399,8350459,8350627,8350490,8350462,7956337,8350461,8350465,8350479,8350476,8350591,8350474,8350483,8350486,8350488,8350481,8350492,8350493,8350500,8350498,8350496,8350480,8350501,8350502,8350506,8350505,8350504';
imageSets[3] = '5130513';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/bobbles1/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/bobbles1/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 += 'section521832.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 && 'section521832' != '') {
					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 = 'www.adrianlourie.co.uk: ' + 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:</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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="info@adrianlourie.co.uk">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="info@adrianlourie.co.uk">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

