window.thumbnails = {};
															thumbnails[6755322] = clik.newPhoto({"id":6755322,"src":"_SBP0222_1_thumb.jpg","galleries_id":356423,"server_id":32,"link":"photo_6755322.html","width":130,"caption":"At Rest","height":86});
															thumbnails[6465437] = clik.newPhoto({"id":6465437,"src":"_SBP9538_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6465437.html","width":130,"caption":"Sibsey Trader Windmill","height":73});
															thumbnails[6508743] = clik.newPhoto({"id":6508743,"src":"DSC_0803_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6508743.html","width":130,"caption":"The Chicken Sheds","height":87});
															thumbnails[6508750] = clik.newPhoto({"id":6508750,"src":"DSC_1760_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6508750.html","width":130,"caption":"The Norfolk Broads","height":86});
															thumbnails[6487752] = clik.newPhoto({"id":6487752,"src":"DSC_0042_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6487752.html","width":130,"caption":"Boston at Dusk","height":87});
															thumbnails[6487753] = clik.newPhoto({"id":6487753,"src":"Skegness-fire-27_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6487753.html","width":130,"caption":"Skegness Fire","height":194});
															thumbnails[6487754] = clik.newPhoto({"id":6487754,"src":"230Rising-Castle_2287_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6487754.html","width":130,"caption":"This image was taken on the way into Norfolk","height":86});
															thumbnails[6437472] = clik.newPhoto({"id":6437472,"src":"a-42_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6437472.html","width":130,"caption":"Sibsey Trader Windmill","height":87});
															thumbnails[6508655] = clik.newPhoto({"id":6508655,"src":"a_22_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6508655.html","width":130,"caption":"A dramatic Sunset Nr Boston","height":87});
															thumbnails[6508676] = clik.newPhoto({"id":6508676,"src":"DSC_0078_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6508676.html","width":130,"caption":"Sunrise over the Cowbridge Drain","height":86});
															thumbnails[6437532] = clik.newPhoto({"id":6437532,"src":"DSC_0050_thumb.jpg","galleries_id":356423,"server_id":32,"link":"photo_6437532.html","width":130,"caption":"Skegness Pier","height":86});
															thumbnails[6508685] = clik.newPhoto({"id":6508685,"src":"DSC_0546_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6508685.html","width":130,"caption":"The Way to boston","height":87});
															thumbnails[6508636] = clik.newPhoto({"id":6508636,"src":"24_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6508636.html","width":130,"caption":"The Wrong Place","height":182});
															thumbnails[6487751] = clik.newPhoto({"id":6487751,"src":"orange_farm_sunset_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6487751.html","width":130,"caption":"Country Farmhouse at sunset","height":86});
															thumbnails[6465442] = clik.newPhoto({"id":6465442,"src":"14_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6465442.html","width":130,"caption":"St Botolph's Church, Boston<br>\r\n( The Boston Stump)","height":86});
															thumbnails[6465396] = clik.newPhoto({"id":6465396,"src":"52_thumb.jpg","galleries_id":356423,"server_id":32,"link":"photo_6465396.html","width":130,"caption":"Lindley Wood Reservoir during the droughts of 2005","height":60});
															thumbnails[6437575] = clik.newPhoto({"id":6437575,"src":"_SBP0663_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6437575.html","width":130,"caption":"Withernsea","height":87});
															thumbnails[6437652] = clik.newPhoto({"id":6437652,"src":"Shane_Bradshaw_01052006_0629_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6437652.html","width":130,"caption":"Skeness Sandbank","height":86});
															thumbnails[6437664] = clik.newPhoto({"id":6437664,"src":"DSC_2484_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6437664.html","width":130,"caption":"Withernsea Sunrise","height":194});
															thumbnails[6437714] = clik.newPhoto({"id":6437714,"src":"_SBP9615_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6437714.html","width":130,"caption":"Sibsey Trader Mill","height":83});
															thumbnails[6437717] = clik.newPhoto({"id":6437717,"src":"DSC_0029_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6437717.html","width":130,"caption":"Boston afterdark","height":87});
															thumbnails[8124038] = clik.newPhoto({"id":8124038,"src":"_SBP4674_2_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_8124038.html","width":160,"caption":"Adriana","height":242});
															thumbnails[8124060] = clik.newPhoto({"id":8124060,"src":"_SBP4614_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_8124060.html","width":160,"caption":"Adriana","height":241});
															thumbnails[8124082] = clik.newPhoto({"id":8124082,"src":"_SBP4667_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_8124082.html","width":160,"caption":"Adriana","height":106});
															thumbnails[7529553] = clik.newPhoto({"id":7529553,"src":"Chan_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_7529553.html","width":160,"caption":"Barb_wire","height":241});
															thumbnails[7346476] = clik.newPhoto({"id":7346476,"src":"_SBP1606_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_7346476.html","width":160,"caption":"Martin","height":241});
															thumbnails[6521370] = clik.newPhoto({"id":6521370,"src":"_SBP8927_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6521370.html","width":130,"caption":"I like my hat","height":93});
															thumbnails[6521377] = clik.newPhoto({"id":6521377,"src":"DSC_3633_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6521377.html","width":130,"caption":"Oohh, pretty ","height":194});
															thumbnails[6508483] = clik.newPhoto({"id":6508483,"src":"Shane-Bradshaw_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_6508483.html","width":130,"caption":"Crystal","height":195});
															thumbnails[6521366] = clik.newPhoto({"id":6521366,"src":"_SBP5472_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6521366.html","width":130,"caption":"George in Spring","height":182});
															thumbnails[6508478] = clik.newPhoto({"id":6508478,"src":"_SBP5468-bw_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6508478.html","width":130,"caption":"George","height":87});
															thumbnails[6521354] = clik.newPhoto({"id":6521354,"src":"_SBP5165_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6521354.html","width":130,"caption":"Raven","height":195});
															thumbnails[6521358] = clik.newPhoto({"id":6521358,"src":"_SBP5200_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6521358.html","width":130,"caption":"Alora","height":195});
															thumbnails[6521359] = clik.newPhoto({"id":6521359,"src":"_SBP5213_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6521359.html","width":130,"caption":"Tallen","height":195});
															thumbnails[6836100] = clik.newPhoto({"id":6836100,"src":"_SBP5123_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6836100.html","width":130,"caption":"Tallen, Allora & Raven ","height":86});
															thumbnails[6508477] = clik.newPhoto({"id":6508477,"src":"_SBP3740_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6508477.html","width":130,"caption":"John & Terry","height":86});
															thumbnails[6508471] = clik.newPhoto({"id":6508471,"src":"_SBP3351_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_6508471.html","width":130,"caption":"Kayleigh","height":182});
															thumbnails[6508480] = clik.newPhoto({"id":6508480,"src":"DSC_3366_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_6508480.html","width":130,"caption":"Arita","height":194});
															thumbnails[6508468] = clik.newPhoto({"id":6508468,"src":"_SBP2563_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6508468.html","width":130,"caption":"Jess","height":212});
															thumbnails[6508466] = clik.newPhoto({"id":6508466,"src":"_SBP2309_1_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6508466.html","width":130,"caption":"Chelsea","height":195});
															thumbnails[6508463] = clik.newPhoto({"id":6508463,"src":"_SBP1649_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6508463.html","width":130,"caption":"Abbie","height":195});
															thumbnails[6508482] = clik.newPhoto({"id":6508482,"src":"DSC_1378_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6508482.html","width":130,"caption":"George","height":194});
															thumbnails[6437647] = clik.newPhoto({"id":6437647,"src":"george-54-1_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6437647.html","width":130,"caption":"Baby George","height":87});
															thumbnails[6465447] = clik.newPhoto({"id":6465447,"src":"Shane_Bradshaw_thumb.jpg","galleries_id":355258,"server_id":32,"link":"photo_6465447.html","width":130,"caption":"A self portrait image of Me just so that people know what I look like","height":87});
															thumbnails[6521719] = clik.newPhoto({"id":6521719,"src":"Watts_147_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521719.html","width":130,"caption":"The Formal Kiss","height":194});
															thumbnails[6461360] = clik.newPhoto({"id":6461360,"src":"lousteve_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6461360.html","width":130,"caption":"The Small Details","height":195});
															thumbnails[6461364] = clik.newPhoto({"id":6461364,"src":"lousteve2_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6461364.html","width":130,"caption":"With the Proud Dad","height":195});
															thumbnails[6521757] = clik.newPhoto({"id":6521757,"src":"_SBP0257_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521757.html","width":130,"caption":"Wow I'm really getting Married","height":182});
															thumbnails[6461308] = clik.newPhoto({"id":6461308,"src":"markdeanne2_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6461308.html","width":130,"caption":"The first picture as Mr & Mrs","height":195});
															thumbnails[6461311] = clik.newPhoto({"id":6461311,"src":"markdeanne3_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6461311.html","width":130,"caption":"The Garden Fete Reception","height":194});
															thumbnails[6461349] = clik.newPhoto({"id":6461349,"src":"markdanne_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6461349.html","width":130,"caption":"A quiet moment alone","height":194});
															thumbnails[6521687] = clik.newPhoto({"id":6521687,"src":"SBP_8449_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521687.html","width":130,"caption":"Deanne & Mark","height":195});
															thumbnails[6521689] = clik.newPhoto({"id":6521689,"src":"SBP_8534_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521689.html","width":130,"caption":"Deanne & Mark","height":195});
															thumbnails[6521700] = clik.newPhoto({"id":6521700,"src":"SBP_8566_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521700.html","width":130,"caption":"The Cake","height":195});
															thumbnails[6461357] = clik.newPhoto({"id":6461357,"src":"kayleighben_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6461357.html","width":130,"caption":"The Bride and Page Boy","height":194});
															thumbnails[6521695] = clik.newPhoto({"id":6521695,"src":"Watts_81_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521695.html","width":130,"caption":"The Proud Daddy","height":182});
															thumbnails[6521705] = clik.newPhoto({"id":6521705,"src":"Watts_98_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521705.html","width":130,"caption":"The Last Moment","height":194});
															thumbnails[6521713] = clik.newPhoto({"id":6521713,"src":"Watts_127_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521713.html","width":130,"caption":"Mrs & Mrs","height":194});
															thumbnails[6521723] = clik.newPhoto({"id":6521723,"src":"Watts_154_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521723.html","width":130,"caption":"A Quiet Moment","height":182});
															thumbnails[6521727] = clik.newPhoto({"id":6521727,"src":"Watts_182_thumb.jpg","galleries_id":356251,"server_id":32,"link":"photo_6521727.html","width":130,"caption":"The Beautiful Bride","height":194});
															thumbnails[6508594] = clik.newPhoto({"id":6508594,"src":"DSC_0018_thumb.jpg","galleries_id":356423,"server_id":32,"link":"photo_6508594.html","width":130,"caption":"Horncastle Floods","height":194});
															thumbnails[6465313] = clik.newPhoto({"id":6465313,"src":"a-20_thumb.jpg","galleries_id":356423,"server_id":32,"link":"photo_6465313.html","width":130,"caption":"The Sibsey Trader Windmill taken during a brief pause in the storms of 2006","height":93});
															thumbnails[6465327] = clik.newPhoto({"id":6465327,"src":"_SBP4709-2_thumb.jpg","galleries_id":356423,"server_id":32,"link":"photo_6465327.html","width":130,"caption":"Skegness Seafront Just before a Rain Shower","height":86});
															thumbnails[6465392] = clik.newPhoto({"id":6465392,"src":"_SBP4887_thumb.jpg","galleries_id":356423,"server_id":32,"link":"photo_6465392.html","width":130,"caption":"Skegness Pier out of season","height":195});
															thumbnails[6836082] = clik.newPhoto({"id":6836082,"src":"_SBP3256_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_6836082.html","width":130,"caption":"Kayleigh","height":195});
															thumbnails[6836095] = clik.newPhoto({"id":6836095,"src":"_SBP2019_thumb.jpg","galleries_id":371239,"server_id":32,"link":"photo_6836095.html","width":130,"caption":"Cirsty","height":195});
															thumbnails[6836459] = clik.newPhoto({"id":6836459,"src":"_SBP3541_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6836459.html","width":130,"caption":"The Sibsey Trader Windmill","height":195});
															thumbnails[6836460] = clik.newPhoto({"id":6836460,"src":"_SBP3547_thumb.jpg","galleries_id":355273,"server_id":32,"link":"photo_6836460.html","width":130,"caption":"Snowy Lane","height":195});
															thumbnails[6836455] = clik.newPhoto({"id":6836455,"src":"_SBP0836_thumb.jpg","galleries_id":371258,"server_id":32,"link":"photo_6836455.html","width":130,"caption":"Magic Circle","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[355273] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Landscape's","link":"gallery_355273.html","maxRecords":0.0,"photoIDs":[6465437.0,6508743.0,6508750.0,6487752.0,6487753.0,6487754.0,6437472.0,6508655.0,6508676.0,6508685.0,6508636.0,6487751.0,6465442.0,6437575.0,6437652.0,6437664.0,6437714.0,6437717.0,6836459.0,6836460.0],"skipIndex":0,"section_code":"gallery","featured_images":"6836460,6836459,6508750,6508743,6508685,6508676,6508655,6508636,6487754,6487753","id":355273,"singleSection":false});				  						galleries[355258] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Portraits","link":"gallery_355258.html","maxRecords":0.0,"photoIDs":[7346476.0,6521370.0,6521377.0,6521366.0,6508478.0,6521354.0,6521358.0,6521359.0,6836100.0,6508477.0,6508468.0,6508466.0,6508463.0,6508482.0,6437647.0,6465447.0],"skipIndex":0,"section_code":"gallery","featured_images":"7346476,6836100,6521377,6521370,6521366,6521359,6521358,6521354,6508482,6508478","id":355258,"singleSection":false});				  						galleries[356251] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Wedding's","link":"gallery_356251.html","maxRecords":0.0,"photoIDs":[6521719.0,6461360.0,6461364.0,6521757.0,6461308.0,6461311.0,6461349.0,6521687.0,6521689.0,6521700.0,6461357.0,6521695.0,6521705.0,6521713.0,6521723.0,6521727.0],"skipIndex":0,"section_code":"gallery","featured_images":6461357.0,"id":356251,"singleSection":false});				  						galleries[356423] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Black & White","link":"gallery_356423.html","maxRecords":0.0,"photoIDs":[6755322.0,6437532.0,6465396.0,6508594.0,6465313.0,6465327.0,6465392.0],"skipIndex":0,"section_code":"gallery","featured_images":"6755322,6508594,6465396,6465392,6465327,6465313,6437532","id":356423,"singleSection":false});				  						galleries[371239] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Beauty","link":"gallery_371239.html","maxRecords":0.0,"photoIDs":[8124038.0,8124060.0,8124082.0,7529553.0,6508483.0,6508471.0,6508480.0,6836082.0,6836095.0],"skipIndex":0,"section_code":"gallery","featured_images":"8124082,8124060,8124038,7529553,6836095,6836082,6508483,6508480,6508471","id":371239,"singleSection":false});				  						galleries[371258] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Random ","link":"gallery_371258.html","maxRecords":0.0,"photoIDs":[6836455.0],"skipIndex":0,"section_code":"gallery","featured_images":6836455.0,"id":371258,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8124082,8124060,8124038,7346476,6836460,6836455,6836082,6755322,6521687,6508636,6508483,6508468,6465392,6461357,6437472';
imageSets[2] = '6461357';
imageSets[3] = '8124082,8124060,8124038,7529553,7346476,6836460,6836459,6836455,6836100,6836095,6836082,6755322,6521757,6521727,6521723,6521719,6521713,6521705,6521700,6521695,6521689,6521687,6521377,6521370,6521366,6521359,6521358,6521354,6508750,6508743,6508685,6508676,6508655,6508636,6508594,6508483,6508482,6508480,6508478,6508477,6508471,6508468,6508466,6508463,6487754,6487753,6487752,6487751,6465447,6465442';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/shane99/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/shane99/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/shane99/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/shane99/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/shane99/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/shane99/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/shane99/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 = 'Shane Bradshaw 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>';
	}
				
				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> AU$' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																		temp += '<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="shane99@talk21.com">';
					temp += '<input type="hidden" name="currency_code" value="AUD">';
					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="shane99@talk21.com">';
				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({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* 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;
	}
}

			

