window.thumbnails = {};
															thumbnails[8961941] = clik.newPhoto({"id":8961941,"src":"Dafodil_thumb_3A5C8285-24E8-5EC4-4F77B610EEF27DBC.jpg","galleries_id":"","server_id":5,"link":"#","width":260,"caption":"","height":260});
															thumbnails[8990944] = clik.newPhoto({"id":8990944,"src":"Roses_framed_thumb_A6D13BD2-1EC9-D45B-1CF94E7F84A918E5.jpg","galleries_id":"","server_id":5,"link":"#","width":248,"caption":"","height":248});
															thumbnails[8943546] = clik.newPhoto({"id":8943546,"src":"Standoff1_thumb_3A12735F-24E8-5EC4-4F279CE480E38C15.jpg","galleries_id":303841,"server_id":5,"link":"photo_8943546.html","width":260,"caption":"","height":155});
															thumbnails[8943593] = clik.newPhoto({"id":8943593,"src":"Standoff2_thumb_3C319A4E-24E8-5EC4-4F17181998BC9430.jpg","galleries_id":303841,"server_id":5,"link":"photo_8943593.html","width":107,"caption":"","height":107});
															thumbnails[8943597] = clik.newPhoto({"id":8943597,"src":"Standoff3_thumb_3A215EFD-24E8-5EC4-4F594C240059C2EC.jpg","galleries_id":303841,"server_id":5,"link":"photo_8943597.html","width":260,"caption":"","height":260});
															thumbnails[8943600] = clik.newPhoto({"id":8943600,"src":"Standoff4_thumb_3A250F75-24E8-5EC4-4FA67A5D1F923F2A.jpg","galleries_id":303841,"server_id":5,"link":"photo_8943600.html","width":260,"caption":"","height":155});
															thumbnails[8943605] = clik.newPhoto({"id":8943605,"src":"Standoff5_thumb_3C39CFB1-24E8-5EC4-4F4CE516D1B9D3B2.jpg","galleries_id":303841,"server_id":5,"link":"photo_8943605.html","width":128,"caption":"","height":128});
															thumbnails[8944137] = clik.newPhoto({"id":8944137,"src":"Rose_thumb_39C0681D-24E8-5EC4-4F2AC4BC15910054.jpg","galleries_id":303842,"server_id":5,"link":"photo_8944137.html","width":260,"caption":"","height":258});
															thumbnails[8944138] = clik.newPhoto({"id":8944138,"src":"Rex_thumb_39C43A9E-24E8-5EC4-4F3E2A325ACAA1C8.jpg","galleries_id":303842,"server_id":5,"link":"photo_8944138.html","width":260,"caption":"","height":260});
															thumbnails[8944145] = clik.newPhoto({"id":8944145,"src":"Helibore1_thumb_39C62EF4-24E8-5EC4-4FAE3B6718AA3EE9.jpg","galleries_id":303842,"server_id":5,"link":"photo_8944145.html","width":260,"caption":"","height":260});
															thumbnails[8961471] = clik.newPhoto({"id":8961471,"src":"4_shells_thumb_391ED12A-1EC9-DFB6-0934A4D4DF0B09CA.jpg","galleries_id":310436,"server_id":5,"link":"photo_8961471.html","width":256,"caption":"","height":260});
															thumbnails[8961482] = clik.newPhoto({"id":8961482,"src":"Rex003_004_thumb_3A0B44CC-24E8-5EC4-4FD998D698B12202.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961482.html","width":260,"caption":"","height":188});
															thumbnails[8961487] = clik.newPhoto({"id":8961487,"src":"Rose_Bud__Hip_thumb_3A305D55-24E8-5EC4-4F47251C7176F523.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961487.html","width":260,"caption":"","height":260});
															thumbnails[8961489] = clik.newPhoto({"id":8961489,"src":"Shell_thumb_393B21D8-1EC9-DFB6-09B188C1D969D289.jpg","galleries_id":310436,"server_id":5,"link":"photo_8961489.html","width":260,"caption":"","height":190});
															thumbnails[8961490] = clik.newPhoto({"id":8961490,"src":"Shell_2_other_side_thumb_394112D0-1EC9-DFB6-09A18F42928CE9AD.jpg","galleries_id":310436,"server_id":5,"link":"photo_8961490.html","width":258,"caption":"","height":260});
															thumbnails[8961522] = clik.newPhoto({"id":8961522,"src":"2_Tunisian_Shells_thumb_3A42B91D-24E8-5EC4-4F162CA31FDBC260.jpg","galleries_id":310436,"server_id":5,"link":"photo_8961522.html","width":260,"caption":"","height":260});
															thumbnails[8961531] = clik.newPhoto({"id":8961531,"src":"8_Tunisian_Shells_39CBB215-1EC9-DFB6-09F80441794C4D38_thumb_39CD1D29-1EC9-DFB6-09F1021195AF38B3.jpg","galleries_id":310436,"server_id":5,"link":"photo_8961531.html","width":260,"caption":"","height":165});
															thumbnails[8961539] = clik.newPhoto({"id":8961539,"src":"blossom1_thumb_39D599FC-1EC9-DFB6-09373AF42021C61C.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961539.html","width":260,"caption":"","height":260});
															thumbnails[8961936] = clik.newPhoto({"id":8961936,"src":"3_Chrysanths_thumb_3CB463ED-24E8-5EC4-4F32CFC1C31C7524.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961936.html","width":260,"caption":"","height":130});
															thumbnails[8961949] = clik.newPhoto({"id":8961949,"src":"Helibore_looking_away_thumb_3CC20A0B-24E8-5EC4-4FFBB03319A062B7.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961949.html","width":208,"caption":"","height":260});
															thumbnails[8961955] = clik.newPhoto({"id":8961955,"src":"Car_Park_Tree_thumb_3CC6AC8A-24E8-5EC4-4F08333AFC9A30F7.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961955.html","width":177,"caption":"","height":260});
															thumbnails[8961961] = clik.newPhoto({"id":8961961,"src":"Rex003_007_thumb_3CCCDC1F-24E8-5EC4-4FCC52F2DC6039EC.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961961.html","width":260,"caption":"","height":107});
															thumbnails[8961967] = clik.newPhoto({"id":8961967,"src":"Roses__thumb_3CD3DB93-24E8-5EC4-4FD8B6FBB74062A7.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961967.html","width":260,"caption":"","height":191});
															thumbnails[8961984] = clik.newPhoto({"id":8961984,"src":"Rex_Buds_thumb_3CDA3DC6-24E8-5EC4-4F573625E06603B3.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961984.html","width":170,"caption":"","height":260});
															thumbnails[8961999] = clik.newPhoto({"id":8961999,"src":"Rex_2003_b_thumb_3CE06F14-24E8-5EC4-4FA61FC840DB6688.jpg","galleries_id":303842,"server_id":5,"link":"photo_8961999.html","width":144,"caption":"","height":260});
															thumbnails[8962019] = clik.newPhoto({"id":8962019,"src":"Pavilion_1_thumb_3CF4E310-24E8-5EC4-4F1DECA54A43A438.jpg","galleries_id":305134,"server_id":5,"link":"photo_8962019.html","width":260,"caption":"","height":155});
															thumbnails[8962021] = clik.newPhoto({"id":8962021,"src":"Pavilion_2_thumb_3CF9B4F0-24E8-5EC4-4F44D7A8BE9366EA.jpg","galleries_id":305134,"server_id":5,"link":"photo_8962021.html","width":260,"caption":"","height":157});
															thumbnails[8962022] = clik.newPhoto({"id":8962022,"src":"Pavilion_3_thumb_3CFE08B6-24E8-5EC4-4F9512659D1B4844.jpg","galleries_id":305134,"server_id":5,"link":"photo_8962022.html","width":260,"caption":"","height":156});
															thumbnails[8962023] = clik.newPhoto({"id":8962023,"src":"Pavilion_4_thumb_3D04A1DC-24E8-5EC4-4FC379019D746144.jpg","galleries_id":305134,"server_id":5,"link":"photo_8962023.html","width":260,"caption":"","height":176});
															thumbnails[8962037] = clik.newPhoto({"id":8962037,"src":"Pavilion_5_thumb_3D08F5D6-24E8-5EC4-4F394B0FFDB88A2C.jpg","galleries_id":305134,"server_id":5,"link":"photo_8962037.html","width":260,"caption":"","height":171});
															thumbnails[8962127] = clik.newPhoto({"id":8962127,"src":"Rick_thumb_3A615353-24E8-5EC4-4FC0CC24D47486D5.jpg","galleries_id":305134,"server_id":5,"link":"photo_8962127.html","width":191,"caption":"","height":191});
															thumbnails[8962133] = clik.newPhoto({"id":8962133,"src":"John_thumb_3A64A214-24E8-5EC4-4F224BD11D7B8E58.jpg","galleries_id":305134,"server_id":5,"link":"photo_8962133.html","width":260,"caption":"","height":260});
															thumbnails[8962137] = clik.newPhoto({"id":8962137,"src":"J_Gordon_Lukehurst_thumb_3A6871B2-24E8-5EC4-4F7FE43D37EAA5F5.jpg","galleries_id":305134,"server_id":5,"link":"photo_8962137.html","width":260,"caption":"","height":260});
															thumbnails[8962294] = clik.newPhoto({"id":8962294,"src":"Dafodil_2_thumb_3F98301A-24E8-5EC4-4F09F2342FF9694B.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962294.html","width":166,"caption":"","height":260});
															thumbnails[8962296] = clik.newPhoto({"id":8962296,"src":"Carnations003_b_thumb_3F9C8DF8-24E8-5EC4-4F414A0A1DD94108.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962296.html","width":146,"caption":"","height":260});
															thumbnails[8962301] = clik.newPhoto({"id":8962301,"src":"Gladiolus_thumb_3FA1047C-24E8-5EC4-4F8285D18CF02315.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962301.html","width":126,"caption":"","height":260});
															thumbnails[8962303] = clik.newPhoto({"id":8962303,"src":"Gladiolus_2_thumb_3FA527BD-24E8-5EC4-4FFD77F301482DFA.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962303.html","width":113,"caption":"","height":260});
															thumbnails[8962309] = clik.newPhoto({"id":8962309,"src":"Catpee_thumb.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962309.html","width":260,"caption":"","height":260});
															thumbnails[8962311] = clik.newPhoto({"id":8962311,"src":"Rose_Bud__thumb.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962311.html","width":260,"caption":"","height":260});
															thumbnails[8962316] = clik.newPhoto({"id":8962316,"src":"White_Fresia_thumb_3A70B134-24E8-5EC4-4F4269D75690AD7C.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962316.html","width":186,"caption":"","height":186});
															thumbnails[8962319] = clik.newPhoto({"id":8962319,"src":"Lavateria_1_thumb_3A37DBAA-24E8-5EC4-4FD3AD609CB8F93B.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962319.html","width":260,"caption":"","height":260});
															thumbnails[8962323] = clik.newPhoto({"id":8962323,"src":"Lavateria_2_thumb_3A3BDD59-24E8-5EC4-4F05E10E3586AD51.jpg","galleries_id":303842,"server_id":5,"link":"photo_8962323.html","width":260,"caption":"","height":260});
															thumbnails[8990382] = clik.newPhoto({"id":8990382,"src":"Helibore_looking_away_framed_650_thumb_A6AE01EA-1EC9-D45B-1C1ED59A7091FA59.jpg","galleries_id":473501,"server_id":5,"link":"photo_8990382.html","width":175,"caption":"","height":175});
															thumbnails[8990805] = clik.newPhoto({"id":8990805,"src":"Car_Park_Tree_framed_thumb_A696A8E2-1EC9-D45B-1C06549D428715F4.jpg","galleries_id":473501,"server_id":5,"link":"photo_8990805.html","width":165,"caption":"","height":165});
															thumbnails[8990864] = clik.newPhoto({"id":8990864,"src":"Lavateria_2_framed_thumb_A69A1305-1EC9-D45B-1C46C751ED2EE247.jpg","galleries_id":473501,"server_id":5,"link":"photo_8990864.html","width":184,"caption":"","height":184});
															thumbnails[8990931] = clik.newPhoto({"id":8990931,"src":"Rose_Bud__Hip_framed_thumb_A69CE969-1EC9-D45B-1C75F091ED58C9FA.jpg","galleries_id":473501,"server_id":5,"link":"photo_8990931.html","width":159,"caption":"","height":159});
															thumbnails[8990948] = clik.newPhoto({"id":8990948,"src":"White_Fresia_Framed_thumb_A6A32BF9-1EC9-D45B-1CCC372061B3871E.jpg","galleries_id":473501,"server_id":5,"link":"photo_8990948.html","width":149,"caption":"","height":149});
															thumbnails[8997800] = clik.newPhoto({"id":8997800,"src":"Blossom_3_framed_thumb_F92AFFA4-24E8-5EC4-4FE4668BD1EDE4D8.jpg","galleries_id":473501,"server_id":5,"link":"photo_8997800.html","width":145,"caption":"","height":145});
															thumbnails[8997801] = clik.newPhoto({"id":8997801,"src":"Lavateria_1_framed_thumb_F9327309-24E8-5EC4-4F8894F4B71E0585.jpg","galleries_id":473501,"server_id":5,"link":"photo_8997801.html","width":142,"caption":"","height":142});
															thumbnails[8997803] = clik.newPhoto({"id":8997803,"src":"Rose_Bud_framed_thumb_F93B1379-24E8-5EC4-4F07DF182E031F12.jpg","galleries_id":473501,"server_id":5,"link":"photo_8997803.html","width":135,"caption":"","height":135});
															thumbnails[8999365] = clik.newPhoto({"id":8999365,"src":"Face_2_framed_thumb_049AE2FC-24E8-5EC4-4F86AAE31293E490.jpg","galleries_id":473501,"server_id":5,"link":"photo_8999365.html","width":216,"caption":"","height":216});
															thumbnails[8999371] = clik.newPhoto({"id":8999371,"src":"Face_1_framed_thumb_04A374D0-24E8-5EC4-4F548D066462879D.jpg","galleries_id":473501,"server_id":5,"link":"photo_8999371.html","width":204,"caption":"","height":204});
															thumbnails[8999375] = clik.newPhoto({"id":8999375,"src":"Face_3_framed_thumb_04ABF2E6-24E8-5EC4-4FDF0EE3B7DBA97B.jpg","galleries_id":473501,"server_id":5,"link":"photo_8999375.html","width":211,"caption":"","height":211});
															thumbnails[8999376] = clik.newPhoto({"id":8999376,"src":"Found_Animal_Skull_Framed_1_thumb_04B66050-24E8-5EC4-4F44B57269AF06EF.jpg","galleries_id":473501,"server_id":5,"link":"photo_8999376.html","width":209,"caption":"","height":209});
															thumbnails[5436833] = clik.newPhoto({"id":5436833,"src":"Face_6_thumb.jpg","galleries_id":305134,"server_id":5,"link":"photo_5436833.html","width":130,"caption":"","height":184});
															thumbnails[5436836] = clik.newPhoto({"id":5436836,"src":"Face_Three_thumb.jpg","galleries_id":305134,"server_id":5,"link":"photo_5436836.html","width":130,"caption":"","height":184});
															thumbnails[5436837] = clik.newPhoto({"id":5436837,"src":"Face_Four_thumb.jpg","galleries_id":305134,"server_id":5,"link":"photo_5436837.html","width":130,"caption":"","height":184});
															thumbnails[5436844] = clik.newPhoto({"id":5436844,"src":"Face_One__thumb.jpg","galleries_id":305134,"server_id":5,"link":"photo_5436844.html","width":130,"caption":"","height":184});
															thumbnails[5436845] = clik.newPhoto({"id":5436845,"src":"Face_Two_thumb.jpg","galleries_id":305134,"server_id":5,"link":"photo_5436845.html","width":130,"caption":"","height":184});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[303842] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"FLORA","link":"gallery_303842.html","maxRecords":0.0,"photoIDs":[8944137.0,8944138.0,8944145.0,8961482.0,8961487.0,8961539.0,8961936.0,8961949.0,8961955.0,8961961.0,8961967.0,8961984.0,8961999.0,8962294.0,8962296.0,8962301.0,8962303.0,8962309.0,8962311.0,8962316.0,8962319.0,8962323.0],"skipIndex":0,"section_code":"gallery","featured_images":"8962323,8962319,8962316,8962311,8962309,8962303,8962301,8962296,8962294,8961999","id":303842,"singleSection":false});				  						galleries[473501] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"FRAMED IMAGES","link":"gallery_473501.html","maxRecords":0.0,"photoIDs":[8990382.0,8990805.0,8990864.0,8990931.0,8990948.0,8997800.0,8997801.0,8997803.0,8999365.0,8999371.0,8999375.0,8999376.0],"skipIndex":0,"section_code":"gallery","featured_images":"8999376,8999375,8999371,8999365,8997803,8997801,8997800,8990948,8990931,8990864","id":473501,"singleSection":false});				  						galleries[305134] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"HUMAN ELLEMENT","link":"gallery_305134.html","maxRecords":0.0,"photoIDs":[8962019.0,8962021.0,8962022.0,8962023.0,8962037.0,8962127.0,8962133.0,8962137.0,5436833.0,5436836.0,5436837.0,5436844.0,5436845.0],"skipIndex":0,"section_code":"gallery","featured_images":"8962137,8962133,8962127,8962037,8962023,8962022,8962021,8962019,5436845,5436844","id":305134,"singleSection":false});				  						galleries[310436] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"SHELLS","link":"gallery_310436.html","maxRecords":0.0,"photoIDs":[8961471.0,8961489.0,8961490.0,8961522.0,8961531.0],"skipIndex":0,"section_code":"gallery","featured_images":"8961531,8961522,8961490,8961489,8961471","id":310436,"singleSection":false});				  						galleries[303841] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"STAND OFF","link":"gallery_303841.html","maxRecords":0.0,"photoIDs":[8943546.0,8943593.0,8943597.0,8943600.0,8943605.0],"skipIndex":0,"section_code":"gallery","featured_images":"8943605,8943600,8943597,8943593,8943546","id":303841,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8962311,8962022,8961522,8944145,8943597';
imageSets[3] = '5436833';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lesrucinski/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/lesrucinski/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 += '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 = 'Les Rucinski    Photographic Imagery: ' + 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> &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.item_price !== '') {
																		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="leslie.a.rucinski@btinternet.com">';
					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="leslie.a.rucinski@btinternet.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({					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;
	}
}

			

