window.thumbnails = {};
															thumbnails[4264228] = clik.newPhoto({"id":4264228,"src":"BW03_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":83});
															thumbnails[6170063] = clik.newPhoto({"id":6170063,"src":"SOTW_Final_Calender_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":130});
															thumbnails[6172801] = clik.newPhoto({"id":6172801,"src":"newfab_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":23});
															thumbnails[6175286] = clik.newPhoto({"id":6175286,"src":"screen_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":37});
															thumbnails[6175310] = clik.newPhoto({"id":6175310,"src":"side_srcreens_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":14});
															thumbnails[6619187] = clik.newPhoto({"id":6619187,"src":"blackboard_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":92});
															thumbnails[6713609] = clik.newPhoto({"id":6713609,"src":"IMG_3934V2_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":99});
															thumbnails[6713628] = clik.newPhoto({"id":6713628,"src":"blog_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":72});
															thumbnails[7109986] = clik.newPhoto({"id":7109986,"src":"crimbo_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[7268679] = clik.newPhoto({"id":7268679,"src":"02_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268896] = clik.newPhoto({"id":7268896,"src":"03_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268897] = clik.newPhoto({"id":7268897,"src":"04_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268899] = clik.newPhoto({"id":7268899,"src":"05_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268900] = clik.newPhoto({"id":7268900,"src":"06_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268901] = clik.newPhoto({"id":7268901,"src":"07_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268902] = clik.newPhoto({"id":7268902,"src":"08_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268903] = clik.newPhoto({"id":7268903,"src":"09_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268904] = clik.newPhoto({"id":7268904,"src":"10_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268907] = clik.newPhoto({"id":7268907,"src":"11_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268920] = clik.newPhoto({"id":7268920,"src":"12_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7268922] = clik.newPhoto({"id":7268922,"src":"13_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":50});
															thumbnails[7647633] = clik.newPhoto({"id":7647633,"src":"flierFINAL_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":174});
															thumbnails[8132233] = clik.newPhoto({"id":8132233,"src":"pbposterbw_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":277});
															thumbnails[8168468] = clik.newPhoto({"id":8168468,"src":"A-ZCOLOURWEB_thumb.jpg","galleries_id":436346,"server_id":18,"link":"photo_8168468.html","width":130,"caption":"","height":181});
															thumbnails[8168591] = clik.newPhoto({"id":8168591,"src":"IMG8111_thumb.jpg","galleries_id":436346,"server_id":18,"link":"photo_8168591.html","width":130,"caption":"","height":182});
															thumbnails[8132275] = clik.newPhoto({"id":8132275,"src":"AZ50X40_thumb.jpg","galleries_id":436346,"server_id":18,"link":"photo_8132275.html","width":130,"caption":"","height":182});
															thumbnails[6135557] = clik.newPhoto({"id":6135557,"src":"GREATTITBW_thumb.jpg","galleries_id":343693,"server_id":18,"link":"photo_6135557.html","width":130,"caption":"Great Tit. <br>\r\n1 Colour Screen Print. <br>\r\n255mm X 343mm. <br>\r\nEdition of 25. £58.","height":168});
															thumbnails[6135585] = clik.newPhoto({"id":6135585,"src":"GREATTITCOLOUR_thumb.jpg","galleries_id":343693,"server_id":18,"link":"photo_6135585.html","width":130,"caption":"Great Tit. <br>\r\n4 Colour Screen Print. <br>\r\n255mm X 343mm. <br>\r\nEdition of 40. <br>\r\n<br>\r\n£82.","height":168});
															thumbnails[6135599] = clik.newPhoto({"id":6135599,"src":"CRAZYBW01_thumb.jpg","galleries_id":343693,"server_id":18,"link":"photo_6135599.html","width":130,"caption":"Bird.                  <br>\r\n1 Colour Screen Print.<br>\r\n255mm X 343mm.<br>\r\n Edition of 25.£58.","height":168});
															thumbnails[6135600] = clik.newPhoto({"id":6135600,"src":"CRAZYCOLOUR01_thumb.jpg","galleries_id":343693,"server_id":18,"link":"photo_6135600.html","width":130,"caption":"Bird. <br>\r\n<br>\r\n7 Colour Screen Print. <br>\r\n255mm X 343mm. <br>\r\nEdition of 40. <br>\r\n<br>\r\n£82.","height":168});
															thumbnails[6316771] = clik.newPhoto({"id":6316771,"src":"WOODDUCK_thumb.jpg","galleries_id":343693,"server_id":18,"link":"photo_6316771.html","width":130,"caption":"Wood Duck. <br>\r\n<br>\r\n7 Colour Screen Print. <br>\r\n<br>\r\nEdition of 20. <br>\r\n<br>\r\n£120.","height":168});
															thumbnails[6316790] = clik.newPhoto({"id":6316790,"src":"SCRAZY_thumb.jpg","galleries_id":343693,"server_id":18,"link":"photo_6316790.html","width":130,"caption":"Bird. <br>\r\n<br>\r\n6 Colour Screen Print. <br>\r\n<br>\r\nEdition of 20. <br>\r\n<br>\r\n£120.","height":168});
															thumbnails[6692227] = clik.newPhoto({"id":6692227,"src":"butter01_thumb.jpg","galleries_id":365461,"server_id":18,"link":"photo_6692227.html","width":130,"caption":"","height":168});
															thumbnails[6692237] = clik.newPhoto({"id":6692237,"src":"butter02_thumb.jpg","galleries_id":365461,"server_id":18,"link":"photo_6692237.html","width":130,"caption":"","height":168});
															thumbnails[6692247] = clik.newPhoto({"id":6692247,"src":"dave01_thumb.jpg","galleries_id":365459,"server_id":18,"link":"photo_6692247.html","width":130,"caption":"","height":168});
															thumbnails[6692250] = clik.newPhoto({"id":6692250,"src":"dave02_thumb.jpg","galleries_id":365459,"server_id":18,"link":"photo_6692250.html","width":130,"caption":"","height":168});
															thumbnails[6692254] = clik.newPhoto({"id":6692254,"src":"dave03_thumb.jpg","galleries_id":365459,"server_id":18,"link":"photo_6692254.html","width":130,"caption":"","height":168});
															thumbnails[6692258] = clik.newPhoto({"id":6692258,"src":"dave04_thumb.jpg","galleries_id":365459,"server_id":18,"link":"photo_6692258.html","width":130,"caption":"","height":168});
															thumbnails[6692269] = clik.newPhoto({"id":6692269,"src":"emily01_thumb.jpg","galleries_id":365457,"server_id":18,"link":"photo_6692269.html","width":130,"caption":"","height":168});
															thumbnails[6692272] = clik.newPhoto({"id":6692272,"src":"emily05_thumb.jpg","galleries_id":365457,"server_id":18,"link":"photo_6692272.html","width":130,"caption":"","height":168});
															thumbnails[6692278] = clik.newPhoto({"id":6692278,"src":"emily06_thumb.jpg","galleries_id":365457,"server_id":18,"link":"photo_6692278.html","width":130,"caption":"","height":168});
															thumbnails[6692280] = clik.newPhoto({"id":6692280,"src":"emily02_thumb.jpg","galleries_id":365457,"server_id":18,"link":"photo_6692280.html","width":130,"caption":"","height":168});
															thumbnails[6692283] = clik.newPhoto({"id":6692283,"src":"emily03_thumb.jpg","galleries_id":365457,"server_id":18,"link":"photo_6692283.html","width":130,"caption":"","height":168});
															thumbnails[6692285] = clik.newPhoto({"id":6692285,"src":"emily04_thumb.jpg","galleries_id":365457,"server_id":18,"link":"photo_6692285.html","width":130,"caption":"","height":168});
															thumbnails[6692286] = clik.newPhoto({"id":6692286,"src":"emily07_thumb.jpg","galleries_id":365457,"server_id":18,"link":"photo_6692286.html","width":130,"caption":"","height":168});
															thumbnails[6692288] = clik.newPhoto({"id":6692288,"src":"emily08_thumb.jpg","galleries_id":365457,"server_id":18,"link":"photo_6692288.html","width":130,"caption":"","height":168});
															thumbnails[6692289] = clik.newPhoto({"id":6692289,"src":"george01_thumb.jpg","galleries_id":365462,"server_id":18,"link":"photo_6692289.html","width":130,"caption":"","height":168});
															thumbnails[6692290] = clik.newPhoto({"id":6692290,"src":"george02_thumb.jpg","galleries_id":365462,"server_id":18,"link":"photo_6692290.html","width":130,"caption":"","height":168});
															thumbnails[6692291] = clik.newPhoto({"id":6692291,"src":"george03_thumb.jpg","galleries_id":365462,"server_id":18,"link":"photo_6692291.html","width":130,"caption":"","height":168});
															thumbnails[6692292] = clik.newPhoto({"id":6692292,"src":"george04_thumb.jpg","galleries_id":365462,"server_id":18,"link":"photo_6692292.html","width":130,"caption":"","height":168});
															thumbnails[6692838] = clik.newPhoto({"id":6692838,"src":"LISA01_thumb.jpg","galleries_id":365463,"server_id":18,"link":"photo_6692838.html","width":130,"caption":"","height":168});
															thumbnails[6692839] = clik.newPhoto({"id":6692839,"src":"ROB01_thumb.jpg","galleries_id":365458,"server_id":18,"link":"photo_6692839.html","width":130,"caption":"","height":168});
															thumbnails[6692841] = clik.newPhoto({"id":6692841,"src":"ROB02_thumb.jpg","galleries_id":365458,"server_id":18,"link":"photo_6692841.html","width":130,"caption":"","height":168});
															thumbnails[6692847] = clik.newPhoto({"id":6692847,"src":"SUKI01_thumb.jpg","galleries_id":365460,"server_id":18,"link":"photo_6692847.html","width":130,"caption":"","height":168});
															thumbnails[6701867] = clik.newPhoto({"id":6701867,"src":"KAREN04_thumb.jpg","galleries_id":345077,"server_id":18,"link":"photo_6701867.html","width":130,"caption":"","height":168});
															thumbnails[6701871] = clik.newPhoto({"id":6701871,"src":"KAREN05_thumb.jpg","galleries_id":345077,"server_id":18,"link":"photo_6701871.html","width":130,"caption":"","height":168});
															thumbnails[6701878] = clik.newPhoto({"id":6701878,"src":"KAREN06_thumb.jpg","galleries_id":345077,"server_id":18,"link":"photo_6701878.html","width":130,"caption":"","height":168});
															thumbnails[6701881] = clik.newPhoto({"id":6701881,"src":"KAREN07_thumb.jpg","galleries_id":345077,"server_id":18,"link":"photo_6701881.html","width":130,"caption":"","height":168});
															thumbnails[6701885] = clik.newPhoto({"id":6701885,"src":"KAREN01_thumb.jpg","galleries_id":345077,"server_id":18,"link":"photo_6701885.html","width":130,"caption":"","height":168});
															thumbnails[6701902] = clik.newPhoto({"id":6701902,"src":"KAREN02_thumb.jpg","galleries_id":345077,"server_id":18,"link":"photo_6701902.html","width":130,"caption":"","height":168});
															thumbnails[6701971] = clik.newPhoto({"id":6701971,"src":"KAREN03_thumb.jpg","galleries_id":345077,"server_id":18,"link":"photo_6701971.html","width":130,"caption":"","height":168});
															thumbnails[7126365] = clik.newPhoto({"id":7126365,"src":"ellen01_thumb.jpg","galleries_id":385462,"server_id":18,"link":"photo_7126365.html","width":130,"caption":"","height":168});
															thumbnails[7126367] = clik.newPhoto({"id":7126367,"src":"ellen02_thumb.jpg","galleries_id":385462,"server_id":18,"link":"photo_7126367.html","width":130,"caption":"","height":168});
															thumbnails[7126370] = clik.newPhoto({"id":7126370,"src":"ellen03_thumb.jpg","galleries_id":385462,"server_id":18,"link":"photo_7126370.html","width":130,"caption":"","height":168});
															thumbnails[7126375] = clik.newPhoto({"id":7126375,"src":"kirsty01_thumb.jpg","galleries_id":385463,"server_id":18,"link":"photo_7126375.html","width":130,"caption":"","height":168});
															thumbnails[7126376] = clik.newPhoto({"id":7126376,"src":"kirsty03_thumb.jpg","galleries_id":385463,"server_id":18,"link":"photo_7126376.html","width":130,"caption":"","height":168});
															thumbnails[7126379] = clik.newPhoto({"id":7126379,"src":"kirsty012_thumb.jpg","galleries_id":385463,"server_id":18,"link":"photo_7126379.html","width":130,"caption":"","height":168});
															thumbnails[7126384] = clik.newPhoto({"id":7126384,"src":"kirsty04_thumb.jpg","galleries_id":385463,"server_id":18,"link":"photo_7126384.html","width":130,"caption":"","height":168});
															thumbnails[7735243] = clik.newPhoto({"id":7735243,"src":"lisa_thumb.jpg","galleries_id":365463,"server_id":18,"link":"photo_7735243.html","width":130,"caption":"","height":159});
															thumbnails[8062401] = clik.newPhoto({"id":8062401,"src":"birdsheart1_print_thumb.jpg","galleries_id":345077,"server_id":18,"link":"photo_8062401.html","width":130,"caption":"","height":159});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[365459] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"David Gratus","link":"section435414_365459.html","maxRecords":0.0,"photoIDs":[6692247.0,6692250.0,6692254.0,6692258.0],"skipIndex":0,"section_code":"section435414","featured_images":"6692258,6692254,6692250,6692247","id":365459,"singleSection":false});				  						galleries[385462] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ellen Calvert","link":"section435414_385462.html","maxRecords":0.0,"photoIDs":[7126365.0,7126367.0,7126370.0],"skipIndex":0,"section_code":"section435414","featured_images":"7126370,7126367,7126365","id":385462,"singleSection":false});				  						galleries[365457] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Emily Turner","link":"section435414_365457.html","maxRecords":0.0,"photoIDs":[6692269.0,6692272.0,6692278.0,6692280.0,6692283.0,6692285.0,6692286.0,6692288.0],"skipIndex":0,"section_code":"section435414","featured_images":6692286.0,"id":365457,"singleSection":false});				  						galleries[365462] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"George Sutherland","link":"section435414_365462.html","maxRecords":0.0,"photoIDs":[6692289.0,6692290.0,6692291.0,6692292.0],"skipIndex":0,"section_code":"section435414","featured_images":6692289.0,"id":365462,"singleSection":false});				  						galleries[365461] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"John Butterworth","link":"section435414_365461.html","maxRecords":0.0,"photoIDs":[6692227.0,6692237.0],"skipIndex":0,"section_code":"section435414","featured_images":6692237.0,"id":365461,"singleSection":false});				  						galleries[345077] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Karen Radford","link":"section435414_345077.html","maxRecords":0.0,"photoIDs":[6701867.0,6701871.0,6701878.0,6701881.0,6701885.0,6701902.0,6701971.0,8062401.0],"skipIndex":0,"section_code":"section435414","featured_images":6701885.0,"id":345077,"singleSection":false});				  						galleries[385463] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Kirsty Southam","link":"section435414_385463.html","maxRecords":0.0,"photoIDs":[7126375.0,7126376.0,7126379.0,7126384.0],"skipIndex":0,"section_code":"section435414","featured_images":"7126384,7126379,7126376,7126375","id":385463,"singleSection":false});				  						galleries[365463] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Lisa Jones","link":"section435414_365463.html","maxRecords":0.0,"photoIDs":[6692838.0,7735243.0],"skipIndex":0,"section_code":"section435414","featured_images":6692838.0,"id":365463,"singleSection":false});				  						galleries[418440] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Mark Henson","link":"section435414_418440.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section435414","featured_images":"","id":418440,"singleSection":false});				  						galleries[343693] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Rob Clarke","link":"section435414_343693.html","maxRecords":0.0,"photoIDs":[6135557.0,6135585.0,6135599.0,6135600.0,6316771.0,6316790.0],"skipIndex":0,"section_code":"section435414","featured_images":6316771.0,"id":343693,"singleSection":false});				  						galleries[365458] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Rob Norman","link":"section435414_365458.html","maxRecords":0.0,"photoIDs":[6692839.0,6692841.0],"skipIndex":0,"section_code":"section435414","featured_images":"6692841,6692839","id":365458,"singleSection":false});				  						galleries[418848] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ruth McDonald","link":"section435414_418848.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section435414","featured_images":"","id":418848,"singleSection":false});				  						galleries[365460] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Suki Hayes-Watkins","link":"section435414_365460.html","maxRecords":0.0,"photoIDs":[6692847.0],"skipIndex":0,"section_code":"section435414","featured_images":6692847.0,"id":365460,"singleSection":false});				  						galleries[436346] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Whitstable A-Z Print","link":"section524111.html","maxRecords":0.0,"photoIDs":[8168468.0,8168591.0,8132275.0],"skipIndex":0,"section_code":"section524111","featured_images":"8168591,8168468,8132275","id":436346,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7268920,7268907,7268904,7268903,7268902,7268901,7268900,7268899,7268897,7268896,7268679';
imageSets[2] = '6701885,6692838,6692289,6692286,6692237,6316771';
imageSets[3] = '7735243,7647633,7268922,7268920,7268907,7268904,7268903,7268902,7268901,7268900,7268899,7268897,7268896,7268679,7126384,7126379,7126376,7126375,7126370,7126367,7126365,7109986,6713628,6713609,6701971,6701902,6701885,6701881,6701878,6701871,6701867,6692847,6692841,6692839,6692838,6692292,6692291,6692290,6692289,6692288,6692286,6692285,6692283,6692280,6692278,6692272,6692269,6692258,6692254';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/theprintblock/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/theprintblock/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 += 'section524111.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 && 'section524111' != '') {
					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 = 'THE PRINT BLOCK: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
		else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
											temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="THEPRINTBLOCK">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to basket" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View basket" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

