window.thumbnails = {};
															thumbnails[1688233] = clik.newPhoto({"id":1688233,"src":"Cockenzie_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1688233.html","width":160,"caption":"The darkening","height":110});
															thumbnails[1701534] = clik.newPhoto({"id":1701534,"src":"Sit-down_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1701534.html","width":160,"caption":"Sit Down and rest","height":107});
															thumbnails[1701537] = clik.newPhoto({"id":1701537,"src":"Flyers_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1701537.html","width":160,"caption":"Thats Entertainment","height":111});
															thumbnails[1713983] = clik.newPhoto({"id":1713983,"src":"IMG_1927_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1713983.html","width":160,"caption":"Power and Nature","height":113});
															thumbnails[2610430] = clik.newPhoto({"id":2610430,"src":"Chained_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_2610430.html","width":160,"caption":"Chain Me Up","height":213});
															thumbnails[4229059] = clik.newPhoto({"id":4229059,"src":"Toilets_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_4229059.html","width":160,"caption":"Essential Services","height":233});
															thumbnails[1475666] = clik.newPhoto({"id":1475666,"src":"Beach-Games_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1475666.html","width":160,"caption":"Beach Games","height":225});
															thumbnails[1896839] = clik.newPhoto({"id":1896839,"src":"Posters_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1896839.html","width":160,"caption":"Sound Advice","height":105});
															thumbnails[1349745] = clik.newPhoto({"id":1349745,"src":"Darkness_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1349745.html","width":160,"caption":"The Dark","height":233});
															thumbnails[1476420] = clik.newPhoto({"id":1476420,"src":"Fishy_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1476420.html","width":160,"caption":"Venue","height":110});
															thumbnails[1582777] = clik.newPhoto({"id":1582777,"src":"IMG_1080_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1582777.html","width":160,"caption":"Seedy","height":160});
															thumbnails[1643592] = clik.newPhoto({"id":1643592,"src":"Overkill_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1643592.html","width":160,"caption":"Overkill","height":110});
															thumbnails[1425856] = clik.newPhoto({"id":1425856,"src":"BMX_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1425856.html","width":160,"caption":"BMX","height":110});
															thumbnails[1643587] = clik.newPhoto({"id":1643587,"src":"Goose-2008_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1643587.html","width":160,"caption":"Goose","height":233});
															thumbnails[1643590] = clik.newPhoto({"id":1643590,"src":"Swan_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1643590.html","width":160,"caption":"Swan","height":110});
															thumbnails[1701535] = clik.newPhoto({"id":1701535,"src":"Bike-Show-01_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1701535.html","width":160,"caption":"Crazy","height":110});
															thumbnails[4229052] = clik.newPhoto({"id":4229052,"src":"Haven_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_4229052.html","width":160,"caption":"Haven","height":106});
															thumbnails[1626444] = clik.newPhoto({"id":1626444,"src":"BridgeBW_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1626444.html","width":160,"caption":"Crossing","height":233});
															thumbnails[1373708] = clik.newPhoto({"id":1373708,"src":"Through_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1373708.html","width":160,"caption":"Sacred Ground","height":110});
															thumbnails[1425493] = clik.newPhoto({"id":1425493,"src":"Gates_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1425493.html","width":160,"caption":"Through the Gate","height":184});
															thumbnails[1896840] = clik.newPhoto({"id":1896840,"src":"Church_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1896840.html","width":160,"caption":"St Michaels","height":117});
															thumbnails[4229047] = clik.newPhoto({"id":4229047,"src":"Light_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_4229047.html","width":160,"caption":"Walk this way","height":233});
															thumbnails[1713985] = clik.newPhoto({"id":1713985,"src":"Old-toun_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1713985.html","width":160,"caption":"The Past","height":115});
															thumbnails[1524587] = clik.newPhoto({"id":1524587,"src":"Snow-trees_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1524587.html","width":160,"caption":"Trees","height":93});
															thumbnails[1524825] = clik.newPhoto({"id":1524825,"src":"winter_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1524825.html","width":160,"caption":"Fence","height":212});
															thumbnails[1349732] = clik.newPhoto({"id":1349732,"src":"Cobbled-lane_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1349732.html","width":160,"caption":"Back Streets","height":233});
															thumbnails[1761420] = clik.newPhoto({"id":1761420,"src":"Field_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1761420.html","width":130,"caption":"Lines","height":168});
															thumbnails[1896851] = clik.newPhoto({"id":1896851,"src":"Autumn-Gate2_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1896851.html","width":130,"caption":"The Gate","height":89});
															thumbnails[1761421] = clik.newPhoto({"id":1761421,"src":"Bridge-a_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1761421.html","width":130,"caption":"Footbridge","height":189});
															thumbnails[4418395] = clik.newPhoto({"id":4418395,"src":"Pavement_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_4418395.html","width":160,"caption":"Patterns","height":127});
															thumbnails[1713986] = clik.newPhoto({"id":1713986,"src":"Bistro_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1713986.html","width":130,"caption":"Bistro","height":89});
															thumbnails[4229055] = clik.newPhoto({"id":4229055,"src":"Leith-water_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_4229055.html","width":130,"caption":"The Water of Leith","height":189});
															thumbnails[5206942] = clik.newPhoto({"id":5206942,"src":"Bridge_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_5206942.html","width":130,"caption":"Bridge","height":89});
															thumbnails[1896836] = clik.newPhoto({"id":1896836,"src":"Newhaven_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1896836.html","width":130,"caption":"Newhaven","height":81});
															thumbnails[4229053] = clik.newPhoto({"id":4229053,"src":"Lighthouse_E14D14ED-1D09-001F-99DEF1A9970D4983_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_4229053.html","width":130,"caption":"Lighthouse ?","height":189});
															thumbnails[1379926] = clik.newPhoto({"id":1379926,"src":"Bottle2008_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1379926.html","width":130,"caption":"Message in a Bottle ?","height":189});
															thumbnails[1538172] = clik.newPhoto({"id":1538172,"src":"IMG_0686_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1538172.html","width":130,"caption":"Underground","height":100});
															thumbnails[1475659] = clik.newPhoto({"id":1475659,"src":"Wheat_ears_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1475659.html","width":130,"caption":"The Crop","height":89});
															thumbnails[4229049] = clik.newPhoto({"id":4229049,"src":"4th_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_4229049.html","width":130,"caption":"The 4th Hole","height":189});
															thumbnails[4229056] = clik.newPhoto({"id":4229056,"src":"Popppies_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_4229056.html","width":130,"caption":"Poppies","height":81});
															thumbnails[1672825] = clik.newPhoto({"id":1672825,"src":"Shed_1_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1672825.html","width":130,"caption":"Derelict","height":89});
															thumbnails[1552440] = clik.newPhoto({"id":1552440,"src":"Terracotta_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1552440.html","width":130,"caption":"Shed","height":181});
															thumbnails[1405653] = clik.newPhoto({"id":1405653,"src":"Cockenzie-2008_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1405653.html","width":130,"caption":"Gold","height":80});
															thumbnails[1475664] = clik.newPhoto({"id":1475664,"src":"Foggy_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1475664.html","width":130,"caption":"Fog","height":179});
															thumbnails[1643593] = clik.newPhoto({"id":1643593,"src":"Yellow-Lines_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1643593.html","width":130,"caption":"No Parking","height":89});
															thumbnails[1701536] = clik.newPhoto({"id":1701536,"src":"NCP_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1701536.html","width":130,"caption":"NCP","height":88});
															thumbnails[1552441] = clik.newPhoto({"id":1552441,"src":"Harbour-mouth_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1552441.html","width":130,"caption":"Fisherrow","height":89});
															thumbnails[4229051] = clik.newPhoto({"id":4229051,"src":"Cokenzie_redone_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_4229051.html","width":130,"caption":"Warm tones","height":89});
															thumbnails[1713987] = clik.newPhoto({"id":1713987,"src":"2009-Therapy_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1713987.html","width":160,"caption":"Beyond Therapy","height":242});
															thumbnails[1349747] = clik.newPhoto({"id":1349747,"src":"Power-Dawn_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1349747.html","width":130,"caption":"Flat Calm","height":89});
															thumbnails[1688235] = clik.newPhoto({"id":1688235,"src":"2008Beach_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1688235.html","width":130,"caption":"Gullane Beach","height":189});
															thumbnails[1475665] = clik.newPhoto({"id":1475665,"src":"Ripples_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1475665.html","width":130,"caption":"Ripples in the Sand","height":189});
															thumbnails[1626508] = clik.newPhoto({"id":1626508,"src":"Hill2_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1626508.html","width":130,"caption":"Roundabout","height":175});
															thumbnails[1761422] = clik.newPhoto({"id":1761422,"src":"Raging_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1761422.html","width":130,"caption":"Raging Torrent","height":190});
															thumbnails[1446569] = clik.newPhoto({"id":1446569,"src":"IMG_2086_7_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1446569.html","width":130,"caption":"Peaceful start","height":89});
															thumbnails[1896838] = clik.newPhoto({"id":1896838,"src":"Pans-Sunset_thumb.jpg","galleries_id":94406,"server_id":18,"link":"photo_1896838.html","width":130,"caption":"Last Light","height":166});
															thumbnails[1366099] = clik.newPhoto({"id":1366099,"src":"Princes-Street-2_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_1366099.html","width":130,"caption":"Princes Street","height":177});
															thumbnails[1475661] = clik.newPhoto({"id":1475661,"src":"2008-close_thumb.jpg","galleries_id":94590,"server_id":18,"link":"photo_1475661.html","width":130,"caption":"View of The Toun","height":189});
															thumbnails[4418397] = clik.newPhoto({"id":4418397,"src":"Graf-2010_thumb.jpg","galleries_id":101804,"server_id":18,"link":"photo_4418397.html","width":160,"caption":"Masterpeice","height":110});
															thumbnails[1524829] = clik.newPhoto({"id":1524829,"src":"St-Michaels_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_1524829.html","width":160,"caption":"Last Light","height":233});
															thumbnails[5024199] = clik.newPhoto({"id":5024199,"src":"Churchyard_thumb.jpg","galleries_id":94705,"server_id":18,"link":"photo_5024199.html","width":160,"caption":"Churchyard","height":233});
															thumbnails[6672827] = clik.newPhoto({"id":6672827,"src":"Angry_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6672827.html","width":130,"caption":"Angry ?","height":189});
															thumbnails[6672832] = clik.newPhoto({"id":6672832,"src":"Festival_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6672832.html","width":130,"caption":"Contrast","height":122});
															thumbnails[6533710] = clik.newPhoto({"id":6533710,"src":"Fest-01_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6533710.html","width":130,"caption":"All White","height":217});
															thumbnails[6533711] = clik.newPhoto({"id":6533711,"src":"Fest-02_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6533711.html","width":130,"caption":"Shot","height":187});
															thumbnails[6533791] = clik.newPhoto({"id":6533791,"src":"Fest-03_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6533791.html","width":130,"caption":"Surprised","height":189});
															thumbnails[6533810] = clik.newPhoto({"id":6533810,"src":"Fest-04_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6533810.html","width":130,"caption":"Red Umbrella","height":189});
															thumbnails[6533911] = clik.newPhoto({"id":6533911,"src":"Fest-05_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6533911.html","width":130,"caption":"Performing","height":189});
															thumbnails[6533913] = clik.newPhoto({"id":6533913,"src":"Fest-06_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6533913.html","width":130,"caption":"In the Rain","height":89});
															thumbnails[6533915] = clik.newPhoto({"id":6533915,"src":"Fest-07_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6533915.html","width":130,"caption":"On High","height":168});
															thumbnails[6533953] = clik.newPhoto({"id":6533953,"src":"Fest-09_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6533953.html","width":130,"caption":"Painted","height":189});
															thumbnails[4274007] = clik.newPhoto({"id":4274007,"src":"EOS-40D_with_grip_blk_thumb.jpg","galleries_id":252583,"server_id":18,"link":"photo_4274007.html","width":130,"caption":"Canon EOS 40D","height":139});
															thumbnails[6515704] = clik.newPhoto({"id":6515704,"src":"Fringe-06_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515704.html","width":130,"caption":"Face Paint","height":109});
															thumbnails[6515719] = clik.newPhoto({"id":6515719,"src":"Fringe-02_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515719.html","width":130,"caption":"Trying not to smile","height":189});
															thumbnails[6515723] = clik.newPhoto({"id":6515723,"src":"Fringe-05_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515723.html","width":130,"caption":"Girning","height":178});
															thumbnails[6515748] = clik.newPhoto({"id":6515748,"src":"Fringe-07_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515748.html","width":130,"caption":"Grin","height":189});
															thumbnails[6515774] = clik.newPhoto({"id":6515774,"src":"Fringe-08_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515774.html","width":130,"caption":"The Mask","height":92});
															thumbnails[6515752] = clik.newPhoto({"id":6515752,"src":"Fringe-10_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515752.html","width":130,"caption":"Conversation","height":89});
															thumbnails[6515756] = clik.newPhoto({"id":6515756,"src":"Fringe-04_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515756.html","width":130,"caption":"Blues Man","height":189});
															thumbnails[6515764] = clik.newPhoto({"id":6515764,"src":"Fringe-03_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515764.html","width":130,"caption":"Stare","height":193});
															thumbnails[6515768] = clik.newPhoto({"id":6515768,"src":"Fringe-09_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515768.html","width":130,"caption":"Nuns gone bad","height":141});
															thumbnails[6515779] = clik.newPhoto({"id":6515779,"src":"Fringe-11_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515779.html","width":130,"caption":"Playin' the Blues","height":189});
															thumbnails[6515781] = clik.newPhoto({"id":6515781,"src":"Fringe-12_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515781.html","width":130,"caption":"No Parking","height":173});
															thumbnails[6515784] = clik.newPhoto({"id":6515784,"src":"Fringe-13_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515784.html","width":130,"caption":"You Chicken !","height":189});
															thumbnails[6515787] = clik.newPhoto({"id":6515787,"src":"Fringe_61251F34-24E8-5EC4-4FCE9A2F424A5BCD_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515787.html","width":130,"caption":"Nice Hat","height":189});
															thumbnails[6515790] = clik.newPhoto({"id":6515790,"src":"Fringe-2_thumb.jpg","galleries_id":358431,"server_id":18,"link":"photo_6515790.html","width":130,"caption":"Wave","height":189});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[252583] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Equiptment","link":"section129782_252583.html","maxRecords":0.0,"photoIDs":[4274007.0],"skipIndex":0,"section_code":"section129782","featured_images":4274007.0,"id":252583,"singleSection":false});				  						galleries[96293] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Private","link":"section129782_96293.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section129782","featured_images":"","id":96293,"singleSection":false});				  						galleries[94406] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Coastal","link":"gallery_94406.html","maxRecords":0.0,"photoIDs":[1688233.0,2610430.0,1475666.0,4229052.0,1896836.0,4229053.0,1379926.0,1405653.0,1552441.0,4229051.0,1349747.0,1688235.0,1475665.0,1446569.0,1896838.0],"skipIndex":0,"section_code":"gallery","featured_images":"4229051,2610430","id":94406,"singleSection":false});				  						galleries[94590] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Monochrome","link":"gallery_94590.html","maxRecords":0.0,"photoIDs":[1701534.0,1713983.0,1896839.0,1349745.0,1476420.0,1582777.0,1701535.0,1626444.0,1896840.0,1713985.0,1349732.0,1672825.0,1713987.0,1475661.0],"skipIndex":0,"section_code":"gallery","featured_images":"1701535,1701534,1672825,1475661","id":94590,"singleSection":false});				  						galleries[101804] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Urban and Rural","link":"gallery_101804.html","maxRecords":0.0,"photoIDs":[1701537.0,4229059.0,1643592.0,1425856.0,1643587.0,1643590.0,1425493.0,4418395.0,5206942.0,1538172.0,1643593.0,1701536.0,1626508.0,1366099.0,4418397.0],"skipIndex":0,"section_code":"gallery","featured_images":"4418395,1701537,1643593,1643587","id":101804,"singleSection":false});				  						galleries[94705] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes","link":"gallery_94705.html","maxRecords":0.0,"photoIDs":[1373708.0,4229047.0,1524587.0,1524825.0,1761420.0,1896851.0,1761421.0,1713986.0,4229055.0,1475659.0,4229049.0,4229056.0,1552440.0,1475664.0,1761422.0,1524829.0,5024199.0],"skipIndex":0,"section_code":"gallery","featured_images":"5024199,4229049,1896851,1761422,1713986","id":94705,"singleSection":false});				  						galleries[358431] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Edinburgh Festival","link":"section129782_358431.html","maxRecords":0.0,"photoIDs":[6672827.0,6672832.0,6533710.0,6533711.0,6533791.0,6533810.0,6533911.0,6533913.0,6533915.0,6533953.0,6515704.0,6515719.0,6515723.0,6515748.0,6515774.0,6515752.0,6515756.0,6515764.0,6515768.0,6515779.0,6515781.0,6515784.0,6515787.0,6515790.0],"skipIndex":0,"section_code":"section129782","featured_images":"6672832,6672827,6533953,6533915,6533913,6533911,6533810,6533791,6533711,6533710","id":358431,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5206942,4418397,4229056,4229055,4229052,4229051,4229049,4229047,2610430,1896840,1896839,1761422,1713987,1713985,1713983,1701537,1701536,1701535,1688233,1672825,1643590,1626444,1582777,1552441,1552440,1538172,1524825,1524587,1475666,1475665,1475664,1475661,1475659,1425856,1425493,1405653,1379926,1373708,1366099,1349745,1349732,1524829,6515764,5024199';
imageSets[2] = '4418395,4229051,4229049,2610430,1896851,1761422,1713986,1701537,1701535,1701534,1672825,1643593,1643587,1475661,5024199';
imageSets[3] = '4274007';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rtracey/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rtracey/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rtracey/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rtracey/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/rtracey/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/rtracey/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rtracey/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/rtracey/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 = 'Robert Tracey Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (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 += '<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;
	}
}

			

