window.thumbnails = {};
															thumbnails[1823705] = clik.newPhoto({"id":1823705,"src":"IMG_1_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1823840] = clik.newPhoto({"id":1823840,"src":"IMG_12_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[1823842] = clik.newPhoto({"id":1823842,"src":"IMG_21_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[1823843] = clik.newPhoto({"id":1823843,"src":"IMG_31_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[1823845] = clik.newPhoto({"id":1823845,"src":"IMG_41_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1823847] = clik.newPhoto({"id":1823847,"src":"IMG_51_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":89});
															thumbnails[1823850] = clik.newPhoto({"id":1823850,"src":"IMG_61_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":89});
															thumbnails[1823854] = clik.newPhoto({"id":1823854,"src":"IMG_71_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":89});
															thumbnails[1823857] = clik.newPhoto({"id":1823857,"src":"IMG_81_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":93});
															thumbnails[1833024] = clik.newPhoto({"id":1833024,"src":"IMG_14_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1833025] = clik.newPhoto({"id":1833025,"src":"IMG_23_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":93});
															thumbnails[1833027] = clik.newPhoto({"id":1833027,"src":"IMG_33_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1833028] = clik.newPhoto({"id":1833028,"src":"IMG_44_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1833029] = clik.newPhoto({"id":1833029,"src":"IMG_53_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":193});
															thumbnails[1833031] = clik.newPhoto({"id":1833031,"src":"IMG_63_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":193});
															thumbnails[1833032] = clik.newPhoto({"id":1833032,"src":"IMG_73_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":193});
															thumbnails[1833034] = clik.newPhoto({"id":1833034,"src":"IMG_83_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":193});
															thumbnails[1833036] = clik.newPhoto({"id":1833036,"src":"IMG_91_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":193});
															thumbnails[1833037] = clik.newPhoto({"id":1833037,"src":"IMG_101_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":94});
															thumbnails[1824802] = clik.newPhoto({"id":1824802,"src":"IMG_32_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_1824802.html","width":130,"caption":"","height":191});
															thumbnails[1824805] = clik.newPhoto({"id":1824805,"src":"IMG_43_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_1824805.html","width":130,"caption":"","height":192});
															thumbnails[1851235] = clik.newPhoto({"id":1851235,"src":"IMG_74_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_1851235.html","width":130,"caption":"","height":192});
															thumbnails[1866495] = clik.newPhoto({"id":1866495,"src":"alex portraits 029_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1866495.html","width":130,"caption":"","height":192});
															thumbnails[1866498] = clik.newPhoto({"id":1866498,"src":"alex portraits 035_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1866498.html","width":130,"caption":"","height":192});
															thumbnails[1866499] = clik.newPhoto({"id":1866499,"src":"alex portraits 051_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1866499.html","width":130,"caption":"","height":192});
															thumbnails[1891245] = clik.newPhoto({"id":1891245,"src":"Evan Beldon 017_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1891245.html","width":130,"caption":"","height":192});
															thumbnails[1891246] = clik.newPhoto({"id":1891246,"src":"Evan Beldon 025_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1891246.html","width":130,"caption":"","height":192});
															thumbnails[1891248] = clik.newPhoto({"id":1891248,"src":"Evan Beldon 035_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1891248.html","width":130,"caption":"","height":88});
															thumbnails[1891249] = clik.newPhoto({"id":1891249,"src":"Evan Beldon 068-2_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1891249.html","width":130,"caption":"","height":191});
															thumbnails[1891250] = clik.newPhoto({"id":1891250,"src":"Evan Beldon 081_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1891250.html","width":130,"caption":"","height":88});
															thumbnails[1891251] = clik.newPhoto({"id":1891251,"src":"Evan Beldon 092_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1891251.html","width":130,"caption":"","height":88});
															thumbnails[1891252] = clik.newPhoto({"id":1891252,"src":"Evan Beldon 099_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1891252.html","width":130,"caption":"","height":192});
															thumbnails[1898979] = clik.newPhoto({"id":1898979,"src":"Joe Walkom 054_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1898979.html","width":130,"caption":"","height":88});
															thumbnails[1898980] = clik.newPhoto({"id":1898980,"src":"Joe Walkom 064_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1898980.html","width":130,"caption":"","height":88});
															thumbnails[1898981] = clik.newPhoto({"id":1898981,"src":"Joe Walkom 085-2_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1898981.html","width":130,"caption":"","height":191});
															thumbnails[1898982] = clik.newPhoto({"id":1898982,"src":"Joe Walkom 108_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1898982.html","width":130,"caption":"","height":192});
															thumbnails[1898983] = clik.newPhoto({"id":1898983,"src":"Joe Walkom B 010_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1898983.html","width":130,"caption":"","height":192});
															thumbnails[1898984] = clik.newPhoto({"id":1898984,"src":"Joe Walkom B 034_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_1898984.html","width":130,"caption":"","height":192});
															thumbnails[1899007] = clik.newPhoto({"id":1899007,"src":"Joe Walkom B 031-bw_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_1899007.html","width":130,"caption":"","height":191});
															thumbnails[1899009] = clik.newPhoto({"id":1899009,"src":"Joe Walkom B 032-bw_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_1899009.html","width":130,"caption":"","height":88});
															thumbnails[1899010] = clik.newPhoto({"id":1899010,"src":"Joe Walkom B 035-bw_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_1899010.html","width":130,"caption":"","height":190});
															thumbnails[1945902] = clik.newPhoto({"id":1945902,"src":"Jess & Harry 0092_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_1945902.html","width":130,"caption":"","height":192});
															thumbnails[1945906] = clik.newPhoto({"id":1945906,"src":"Jess & Harry 0672_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_1945906.html","width":130,"caption":"","height":192});
															thumbnails[1945908] = clik.newPhoto({"id":1945908,"src":"Jess & Harry 1111_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_1945908.html","width":130,"caption":"","height":88});
															thumbnails[2255936] = clik.newPhoto({"id":2255936,"src":"Emma & Luke 0531_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2255936.html","width":130,"caption":"","height":193});
															thumbnails[2255938] = clik.newPhoto({"id":2255938,"src":"Emma & Luke 0811_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2255938.html","width":130,"caption":"","height":193});
															thumbnails[2255940] = clik.newPhoto({"id":2255940,"src":"Emma & Luke 1151_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2255940.html","width":130,"caption":"","height":193});
															thumbnails[2476520] = clik.newPhoto({"id":2476520,"src":"Theo Bamber 0281_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2476520.html","width":130,"caption":"","height":88});
															thumbnails[2476522] = clik.newPhoto({"id":2476522,"src":"Theo Bamber 0311_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2476522.html","width":130,"caption":"","height":88});
															thumbnails[2476523] = clik.newPhoto({"id":2476523,"src":"Theo Bamber 0701_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2476523.html","width":130,"caption":"","height":88});
															thumbnails[2476524] = clik.newPhoto({"id":2476524,"src":"Theo Bamber 0951_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2476524.html","width":130,"caption":"","height":88});
															thumbnails[2806857] = clik.newPhoto({"id":2806857,"src":"Lily Shell 078-8x6_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2806857.html","width":130,"caption":"","height":171});
															thumbnails[2806858] = clik.newPhoto({"id":2806858,"src":"Lily Shell 090_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2806858.html","width":130,"caption":"","height":88});
															thumbnails[2806859] = clik.newPhoto({"id":2806859,"src":"Lily Shell 168-12x8_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2806859.html","width":130,"caption":"","height":191});
															thumbnails[2806860] = clik.newPhoto({"id":2806860,"src":"Lily Shell 172-8x6_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_2806860.html","width":130,"caption":"","height":171});
															thumbnails[2806863] = clik.newPhoto({"id":2806863,"src":"Lily Shell 090B&W_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_2806863.html","width":130,"caption":"","height":88});
															thumbnails[2858094] = clik.newPhoto({"id":2858094,"src":"Pregnant portraits 008_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_2858094.html","width":130,"caption":"","height":88});
															thumbnails[2858095] = clik.newPhoto({"id":2858095,"src":"Pregnant portraits 026_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_2858095.html","width":130,"caption":"","height":88});
															thumbnails[2858096] = clik.newPhoto({"id":2858096,"src":"Pregnant portraits 028_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_2858096.html","width":130,"caption":"","height":88});
															thumbnails[2858097] = clik.newPhoto({"id":2858097,"src":"Pregnant portraits 040_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_2858097.html","width":130,"caption":"","height":193});
															thumbnails[3356388] = clik.newPhoto({"id":3356388,"src":"A King 0721_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_3356388.html","width":130,"caption":"","height":88});
															thumbnails[3356389] = clik.newPhoto({"id":3356389,"src":"A King 1001_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_3356389.html","width":130,"caption":"","height":88});
															thumbnails[4671352] = clik.newPhoto({"id":4671352,"src":"Ben_Shoot_037_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_4671352.html","width":130,"caption":"","height":189});
															thumbnails[4671353] = clik.newPhoto({"id":4671353,"src":"Ben_Shoot_056_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_4671353.html","width":130,"caption":"","height":189});
															thumbnails[4671355] = clik.newPhoto({"id":4671355,"src":"Ben_Shoot_066_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_4671355.html","width":130,"caption":"","height":89});
															thumbnails[4671356] = clik.newPhoto({"id":4671356,"src":"Ben_Shoot_131_thumb.jpg","galleries_id":122632,"server_id":18,"link":"photo_4671356.html","width":130,"caption":"","height":189});
															thumbnails[4671360] = clik.newPhoto({"id":4671360,"src":"Family_shoot_017_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671360.html","width":130,"caption":"","height":89});
															thumbnails[4671367] = clik.newPhoto({"id":4671367,"src":"mixed_shoot_071_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671367.html","width":130,"caption":"","height":89});
															thumbnails[4671370] = clik.newPhoto({"id":4671370,"src":"mixed_shoot_102_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671370.html","width":130,"caption":"","height":189});
															thumbnails[4671373] = clik.newPhoto({"id":4671373,"src":"mixed_shoot_122_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671373.html","width":130,"caption":"","height":89});
															thumbnails[4671376] = clik.newPhoto({"id":4671376,"src":"mixed_shoot_143_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671376.html","width":130,"caption":"","height":89});
															thumbnails[4671392] = clik.newPhoto({"id":4671392,"src":"mixed_shoot_177_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671392.html","width":130,"caption":"","height":89});
															thumbnails[4671396] = clik.newPhoto({"id":4671396,"src":"mixed_shoot_192_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671396.html","width":130,"caption":"","height":89});
															thumbnails[4671398] = clik.newPhoto({"id":4671398,"src":"The_Shell_Family_014_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671398.html","width":130,"caption":"","height":89});
															thumbnails[4671401] = clik.newPhoto({"id":4671401,"src":"The_Shell_Family_022_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671401.html","width":130,"caption":"","height":89});
															thumbnails[4671402] = clik.newPhoto({"id":4671402,"src":"The_Shell_Family_079_thumb.jpg","galleries_id":124573,"server_id":18,"link":"photo_4671402.html","width":130,"caption":"","height":89});
															thumbnails[5920602] = clik.newPhoto({"id":5920602,"src":"Alfie__Daisy_0461_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920602.html","width":130,"caption":"","height":87});
															thumbnails[5920605] = clik.newPhoto({"id":5920605,"src":"Alfie__Daisy_069_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920605.html","width":130,"caption":"","height":194});
															thumbnails[5920607] = clik.newPhoto({"id":5920607,"src":"Alfie__Daisy_226_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920607.html","width":130,"caption":"","height":87});
															thumbnails[5920608] = clik.newPhoto({"id":5920608,"src":"Alfie__Daisy_243_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920608.html","width":130,"caption":"","height":87});
															thumbnails[5920610] = clik.newPhoto({"id":5920610,"src":"Ava_Dobisz_125_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920610.html","width":130,"caption":"","height":87});
															thumbnails[5920611] = clik.newPhoto({"id":5920611,"src":"Ben__Ted_070_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920611.html","width":130,"caption":"","height":87});
															thumbnails[5920612] = clik.newPhoto({"id":5920612,"src":"Ben__Ted_095_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920612.html","width":130,"caption":"","height":194});
															thumbnails[5920613] = clik.newPhoto({"id":5920613,"src":"Rachel_Smith_060_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920613.html","width":130,"caption":"","height":194});
															thumbnails[5920615] = clik.newPhoto({"id":5920615,"src":"Rachel_Smith_062_thumb.JPG","galleries_id":124573,"server_id":18,"link":"photo_5920615.html","width":130,"caption":"","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[269851] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Individual prices","link":"section324465_269851.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section324465","featured_images":"","id":269851,"singleSection":false});				  						galleries[269852] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Package prices","link":"section324465_269852.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section324465","featured_images":"","id":269852,"singleSection":false});				  						galleries[124573] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_124573.html","maxRecords":0.0,"photoIDs":[1851235.0,1866495.0,1866498.0,1866499.0,1891245.0,1891246.0,1891248.0,1891249.0,1891250.0,1891251.0,1891252.0,1898979.0,1898980.0,1898981.0,1898982.0,1898983.0,1898984.0,1945902.0,1945906.0,1945908.0,2255936.0,2255938.0,2255940.0,2476520.0,2476522.0,2476523.0,2476524.0,2806857.0,2806858.0,2806859.0,2806860.0,3356388.0,3356389.0,4671360.0,4671367.0,4671370.0,4671373.0,4671376.0,4671392.0,4671396.0,4671398.0,4671401.0,4671402.0,5920602.0,5920605.0,5920607.0,5920608.0,5920610.0,5920611.0,5920612.0,5920613.0,5920615.0],"skipIndex":0,"section_code":"gallery","featured_images":2806857.0,"id":124573,"singleSection":false});				  						galleries[122632] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Black & White portraits","link":"gallery_122632.html","maxRecords":0.0,"photoIDs":[1824802.0,1824805.0,1899007.0,1899009.0,1899010.0,2806863.0,2858094.0,2858095.0,2858096.0,2858097.0,4671352.0,4671353.0,4671355.0,4671356.0],"skipIndex":0,"section_code":"gallery","featured_images":1824805.0,"id":122632,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '4671402,4671401,4671398,4671396,4671392,4671376,4671373,4671367,4671360,4671355,3356389,3356388,2476524,2476523,2476520,1945908,1899009,1898980,1898979,1891251';
imageSets[2] = '2806857,1833025,1824805,1823854';
imageSets[3] = '5920615,5920613,5920612,5920611,5920610,5920608,5920607,5920605,5920602,4671402,4671401,4671398,4671396,4671392,4671376,4671373,4671370,4671367,4671360,4671356,4671355,4671353,4671352,3356389,3356388,2858097,2858096,2858095,2858094,2806863,2806860,2806859,2806858,2806857,2476524,2476523,2476522,2476520,2255940,2255938,2255936,1945908,1945906,1945902,1899010,1899009,1899007,1898984,1898983,1898982';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/kaylaimages/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/kaylaimages/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 = 'kaylaimages: ' + 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="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
		else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="kaylaimages@aol.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="kaylaimages@aol.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;
	}
}

			

