window.thumbnails = {};
															thumbnails[4851326] = clik.newPhoto({"id":4851326,"src":"alan1_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851326.html","width":130,"caption":"","height":139});
															thumbnails[4851376] = clik.newPhoto({"id":4851376,"src":"Nick0841_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_4851376.html","width":130,"caption":"","height":107});
															thumbnails[5047015] = clik.newPhoto({"id":5047015,"src":"shop_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_5047015.html","width":130,"caption":"","height":83});
															thumbnails[6884279] = clik.newPhoto({"id":6884279,"src":"Crystal_Castles_41_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884279.html","width":130,"caption":"","height":98});
															thumbnails[8578603] = clik.newPhoto({"id":8578603,"src":"SIBOS_ISSUE_2_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_8578603.html","width":130,"caption":"","height":111});
															thumbnails[9033611] = clik.newPhoto({"id":9033611,"src":"217013_10150263040275744_504205743_9293766_5142244_n_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033611.html","width":130,"caption":"","height":93});
															thumbnails[9033877] = clik.newPhoto({"id":9033877,"src":"grave1mini_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_9033877.html","width":130,"caption":"","height":63});
															thumbnails[4851366] = clik.newPhoto({"id":4851366,"src":"IMG_00601_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851366.html","width":130,"caption":"","height":88});
															thumbnails[4851380] = clik.newPhoto({"id":4851380,"src":"Nick2291_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_4851380.html","width":130,"caption":"","height":93});
															thumbnails[6884192] = clik.newPhoto({"id":6884192,"src":"Joana__the_Wolf_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884192.html","width":130,"caption":"","height":173});
															thumbnails[7866459] = clik.newPhoto({"id":7866459,"src":"Amsterdam_408_of_462_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_7866459.html","width":130,"caption":"","height":195});
															thumbnails[8578604] = clik.newPhoto({"id":8578604,"src":"Tom_Price_-_LEI_implementation_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_8578604.html","width":130,"caption":"","height":87});
															thumbnails[9033613] = clik.newPhoto({"id":9033613,"src":"231032_10150300959720744_504205743_9661042_3679467_n_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033613.html","width":130,"caption":"","height":93});
															thumbnails[9033878] = clik.newPhoto({"id":9033878,"src":"bench_small_bnw_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_9033878.html","width":130,"caption":"","height":57});
															thumbnails[4851363] = clik.newPhoto({"id":4851363,"src":"IMG_00021_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851363.html","width":130,"caption":"","height":181});
															thumbnails[6884283] = clik.newPhoto({"id":6884283,"src":"ZZ_Top_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884283.html","width":130,"caption":"","height":178});
															thumbnails[7866456] = clik.newPhoto({"id":7866456,"src":"Amsterdam_47_of_462_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_7866456.html","width":130,"caption":"","height":87});
															thumbnails[7866555] = clik.newPhoto({"id":7866555,"src":"IMG_1643_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_7866555.html","width":130,"caption":"","height":195});
															thumbnails[8578606] = clik.newPhoto({"id":8578606,"src":"IMG_5410_BnW_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_8578606.html","width":130,"caption":"","height":192});
															thumbnails[8578644] = clik.newPhoto({"id":8578644,"src":"IMG_0080_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_8578644.html","width":130,"caption":"","height":181});
															thumbnails[9033614] = clik.newPhoto({"id":9033614,"src":"231038_10150300969680744_504205743_9661097_787860_n_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033614.html","width":130,"caption":"","height":48});
															thumbnails[4851344] = clik.newPhoto({"id":4851344,"src":"dd1_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851344.html","width":130,"caption":"","height":186});
															thumbnails[6884343] = clik.newPhoto({"id":6884343,"src":"Pendulum_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884343.html","width":130,"caption":"","height":98});
															thumbnails[7866460] = clik.newPhoto({"id":7866460,"src":"IMG_1260_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_7866460.html","width":130,"caption":"","height":85});
															thumbnails[8578609] = clik.newPhoto({"id":8578609,"src":"IMG_3043_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_8578609.html","width":130,"caption":"","height":103});
															thumbnails[9033616] = clik.newPhoto({"id":9033616,"src":"409422_10150628344030744_504205743_11873749_98698242_n_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033616.html","width":130,"caption":"","height":93});
															thumbnails[5726997] = clik.newPhoto({"id":5726997,"src":"IMG_6274_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_5726997.html","width":130,"caption":"","height":87});
															thumbnails[6884381] = clik.newPhoto({"id":6884381,"src":"Aphex_Twin_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884381.html","width":130,"caption":"","height":98});
															thumbnails[6884383] = clik.newPhoto({"id":6884383,"src":"IMG_0188_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884383.html","width":130,"caption":"","height":93});
															thumbnails[7866325] = clik.newPhoto({"id":7866325,"src":"IMG_7255_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_7866325.html","width":130,"caption":"","height":189});
															thumbnails[7866512] = clik.newPhoto({"id":7866512,"src":"IMG_1396_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_7866512.html","width":130,"caption":"","height":51});
															thumbnails[9033618] = clik.newPhoto({"id":9033618,"src":"317142_10150461414190744_504205743_11109213_2125964517_n_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033618.html","width":130,"caption":"","height":93});
															thumbnails[6884385] = clik.newPhoto({"id":6884385,"src":"IMG_0152_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884385.html","width":130,"caption":"","height":97});
															thumbnails[7866217] = clik.newPhoto({"id":7866217,"src":"IMG_0180_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_7866217.html","width":130,"caption":"","height":111});
															thumbnails[8578643] = clik.newPhoto({"id":8578643,"src":"IMG_5326_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_8578643.html","width":130,"caption":"","height":195});
															thumbnails[8578652] = clik.newPhoto({"id":8578652,"src":"311964_10150447501720744_504205743_11023828_783753860_n_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_8578652.html","width":130,"caption":"","height":180});
															thumbnails[9033621] = clik.newPhoto({"id":9033621,"src":"200525_10150215266700744_504205743_9095606_1817349_n_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033621.html","width":130,"caption":"","height":104});
															thumbnails[9033815] = clik.newPhoto({"id":9033815,"src":"1302893489149_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033815.html","width":130,"caption":"","height":93});
															thumbnails[4851343] = clik.newPhoto({"id":4851343,"src":"bridge21_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851343.html","width":130,"caption":"","height":201});
															thumbnails[6884388] = clik.newPhoto({"id":6884388,"src":"IMG_8806_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884388.html","width":130,"caption":"","height":81});
															thumbnails[9033818] = clik.newPhoto({"id":9033818,"src":"1305736387662_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033818.html","width":130,"caption":"","height":48});
															thumbnails[7866311] = clik.newPhoto({"id":7866311,"src":"Grand_Master_Theodore12_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_7866311.html","width":130,"caption":"","height":98});
															thumbnails[9033820] = clik.newPhoto({"id":9033820,"src":"1305746682119_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033820.html","width":130,"caption":"","height":93});
															thumbnails[6884396] = clik.newPhoto({"id":6884396,"src":"NYD-226_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884396.html","width":130,"caption":"","height":87});
															thumbnails[7866272] = clik.newPhoto({"id":7866272,"src":"IMG_9761_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_7866272.html","width":130,"caption":"","height":94});
															thumbnails[7866434] = clik.newPhoto({"id":7866434,"src":"IMG_0053_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_7866434.html","width":130,"caption":"","height":87});
															thumbnails[9033822] = clik.newPhoto({"id":9033822,"src":"1307025589245_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033822.html","width":130,"caption":"","height":217});
															thumbnails[6306364] = clik.newPhoto({"id":6306364,"src":"PPL_21_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_6306364.html","width":130,"caption":"","height":98});
															thumbnails[6884400] = clik.newPhoto({"id":6884400,"src":"IMG_2558_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884400.html","width":130,"caption":"","height":92});
															thumbnails[7866276] = clik.newPhoto({"id":7866276,"src":"IMG_6037_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_7866276.html","width":130,"caption":"","height":130});
															thumbnails[7866403] = clik.newPhoto({"id":7866403,"src":"IMG_6921_thumb.jpg","galleries_id":453511,"server_id":5,"link":"photo_7866403.html","width":130,"caption":"","height":92});
															thumbnails[7866473] = clik.newPhoto({"id":7866473,"src":"IMG_1317_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_7866473.html","width":130,"caption":"","height":195});
															thumbnails[9033824] = clik.newPhoto({"id":9033824,"src":"1308139787387_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033824.html","width":130,"caption":"","height":93});
															thumbnails[4851391] = clik.newPhoto({"id":4851391,"src":"pt21_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851391.html","width":130,"caption":"","height":90});
															thumbnails[9033825] = clik.newPhoto({"id":9033825,"src":"1311482624846_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033825.html","width":130,"caption":"","height":181});
															thumbnails[4850748] = clik.newPhoto({"id":4850748,"src":"IMG_2911_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4850748.html","width":130,"caption":"","height":195});
															thumbnails[6884421] = clik.newPhoto({"id":6884421,"src":"IMG_8260_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884421.html","width":130,"caption":"","height":104});
															thumbnails[9033827] = clik.newPhoto({"id":9033827,"src":"1311856238052_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033827.html","width":130,"caption":"","height":181});
															thumbnails[4851351] = clik.newPhoto({"id":4851351,"src":"heron1_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851351.html","width":130,"caption":"","height":187});
															thumbnails[6884425] = clik.newPhoto({"id":6884425,"src":"IMG_5703_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884425.html","width":130,"caption":"","height":195});
															thumbnails[7866294] = clik.newPhoto({"id":7866294,"src":"IMG_1571_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_7866294.html","width":130,"caption":"","height":98});
															thumbnails[9033842] = clik.newPhoto({"id":9033842,"src":"1324212499837_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033842.html","width":130,"caption":"","height":48});
															thumbnails[4851389] = clik.newPhoto({"id":4851389,"src":"pro31_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851389.html","width":130,"caption":"","height":156});
															thumbnails[6884426] = clik.newPhoto({"id":6884426,"src":"IMG_0059_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884426.html","width":130,"caption":"","height":94});
															thumbnails[9033828] = clik.newPhoto({"id":9033828,"src":"1313269230313_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033828.html","width":130,"caption":"","height":130});
															thumbnails[4851388] = clik.newPhoto({"id":4851388,"src":"pro1_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851388.html","width":130,"caption":"","height":198});
															thumbnails[6884427] = clik.newPhoto({"id":6884427,"src":"Killa_Kella_3_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884427.html","width":130,"caption":"","height":98});
															thumbnails[7866271] = clik.newPhoto({"id":7866271,"src":"IMG_0019_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_7866271.html","width":130,"caption":"","height":86});
															thumbnails[8578640] = clik.newPhoto({"id":8578640,"src":"IMG_0023_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_8578640.html","width":130,"caption":"","height":175});
															thumbnails[9033831] = clik.newPhoto({"id":9033831,"src":"1313775105899_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033831.html","width":130,"caption":"","height":181});
															thumbnails[4851327] = clik.newPhoto({"id":4851327,"src":"bridge1_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851327.html","width":130,"caption":"","height":96});
															thumbnails[4851364] = clik.newPhoto({"id":4851364,"src":"IMG_00061_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851364.html","width":130,"caption":"","height":99});
															thumbnails[4851392] = clik.newPhoto({"id":4851392,"src":"rem1_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851392.html","width":130,"caption":"","height":87});
															thumbnails[6884433] = clik.newPhoto({"id":6884433,"src":"Pendulum_3_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_6884433.html","width":130,"caption":"","height":98});
															thumbnails[9033832] = clik.newPhoto({"id":9033832,"src":"1314526340651_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033832.html","width":130,"caption":"","height":181});
															thumbnails[9033836] = clik.newPhoto({"id":9033836,"src":"1316889089637_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033836.html","width":130,"caption":"","height":181});
															thumbnails[4851394] = clik.newPhoto({"id":4851394,"src":"rem211_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851394.html","width":130,"caption":"","height":137});
															thumbnails[9033838] = clik.newPhoto({"id":9033838,"src":"1322823995133_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033838.html","width":130,"caption":"","height":181});
															thumbnails[4851397] = clik.newPhoto({"id":4851397,"src":"tunnel21_thumb.jpg","galleries_id":166524,"server_id":5,"link":"photo_4851397.html","width":130,"caption":"","height":170});
															thumbnails[9033840] = clik.newPhoto({"id":9033840,"src":"1324051666125_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033840.html","width":130,"caption":"","height":181});
															thumbnails[9033845] = clik.newPhoto({"id":9033845,"src":"1324032366028_thumb.jpg","galleries_id":475964,"server_id":5,"link":"photo_9033845.html","width":130,"caption":"","height":93});
															thumbnails[5727010] = clik.newPhoto({"id":5727010,"src":"IMG_8701_thumb.JPG","galleries_id":166524,"server_id":5,"link":"photo_5727010.html","width":130,"caption":"","height":87});
															thumbnails[7866318] = clik.newPhoto({"id":7866318,"src":"IMG_2056_thumb.jpg","galleries_id":324353,"server_id":5,"link":"photo_7866318.html","width":130,"caption":"","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[324353] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Music","link":"gallery_324353.html","maxRecords":0.0,"photoIDs":[6884279.0,6884192.0,6884283.0,6884343.0,6884381.0,6884383.0,6884385.0,7866217.0,6884388.0,7866311.0,6884396.0,7866272.0,6884400.0,7866276.0,6884421.0,6884425.0,7866294.0,6884426.0,6884427.0,7866271.0,6884433.0,7866318.0],"skipIndex":0,"section_code":"gallery","featured_images":"6884433,6884425,6884381,6884283,6884279,6884192","id":324353,"singleSection":false});				  						galleries[453511] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Other Work","link":"gallery_453511.html","maxRecords":0.0,"photoIDs":[4851376.0,8578603.0,4851380.0,8578604.0,8578606.0,8578609.0,7866325.0,7866434.0,7866403.0],"skipIndex":0,"section_code":"gallery","featured_images":"8578609,8578606,8578604,8578603,7866434,7866403,7866325,4851380,4851376","id":453511,"singleSection":false});				  						galleries[166524] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Personal","link":"gallery_166524.html","maxRecords":0.0,"photoIDs":[4851326.0,5047015.0,9033877.0,4851366.0,7866459.0,9033878.0,4851363.0,7866456.0,7866555.0,8578644.0,4851344.0,7866460.0,5726997.0,7866512.0,8578643.0,8578652.0,4851343.0,6306364.0,7866473.0,4851391.0,4850748.0,4851351.0,4851389.0,4851388.0,8578640.0,4851327.0,4851364.0,4851392.0,4851394.0,4851397.0,5727010.0],"skipIndex":0,"section_code":"gallery","featured_images":"5047015,4851397,4851391,4851389,4851388,4851363,4851344,4851326,4850748","id":166524,"singleSection":false});				  						galleries[475964] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Camera Phone","link":"gallery_475964.html","maxRecords":0.0,"photoIDs":[9033611.0,9033613.0,9033614.0,9033616.0,9033618.0,9033621.0,9033815.0,9033818.0,9033820.0,9033822.0,9033824.0,9033825.0,9033827.0,9033842.0,9033828.0,9033831.0,9033832.0,9033836.0,9033838.0,9033840.0,9033845.0],"skipIndex":0,"section_code":"gallery","featured_images":"9033845,9033842,9033840,9033838,9033836,9033832,9033831,9033828,9033827,9033825","id":475964,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6884279,4851326,6884283,7866460,4851344,6884381,7866217,6884425,6884433';
imageSets[2] = '6884279,5047015,4851326,6884192,6884283,4851363,4851344,6884381,4851391,4850748,6884425,4851389,4851388,6884433,4851397';
imageSets[3] = '5726997';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/extant/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/extant/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/extant/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/extant/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/extant/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/extant/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/extant/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/extant/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 = 'extantphotography: ' + 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.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="">';
					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="">';
				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;
	}
}

		

