window.thumbnails = new Object();
												thumbnails[1234654] = new thumbnail(1234654,'88248','','Earey (30)1_thumb.jpg',130, 87,1,'photo_1234654.html');
												thumbnails[1234662] = new thumbnail(1234662,'88248','','Earey (56)_thumb.jpg',130, 87,1,'photo_1234662.html');
												thumbnails[1234836] = new thumbnail(1234836,'88263','','Earey (39)_thumb.jpg',130, 87,1,'photo_1234836.html');
												thumbnails[1234844] = new thumbnail(1234844,'88263','','Earey (76)_thumb.jpg',130, 87,1,'photo_1234844.html');
												thumbnails[1234849] = new thumbnail(1234849,'88263','','Earey (110)_thumb.jpg',130, 85,1,'photo_1234849.html');
												thumbnails[1234958] = new thumbnail(1234958,'88262','','_MAX0872_thumb.jpg',130, 86,1,'photo_1234958.html');
												thumbnails[1250438] = new thumbnail(1250438,'88262','','3_thumb.jpg',130, 86,1,'photo_1250438.html');
												thumbnails[1250440] = new thumbnail(1250440,'88262','','8_thumb.jpg',130, 86,1,'photo_1250440.html');
												thumbnails[1250448] = new thumbnail(1250448,'89089','','DSC_0469_thumb.jpg',130, 87,1,'photo_1250448.html');
												thumbnails[1250449] = new thumbnail(1250449,'89089','','DSC_7175_thumb.jpg',130, 87,1,'photo_1250449.html');
												thumbnails[1256043] = new thumbnail(1256043,'89089','','DSC_6986_thumb.jpg',130, 87,1,'photo_1256043.html');
												thumbnails[1276035] = new thumbnail(1276035,'88262','','DSC_5767_thumb.jpg',130, 87,1,'photo_1276035.html');
												thumbnails[1276037] = new thumbnail(1276037,'89089','','DSC_7222_thumb.jpg',130, 87,1,'photo_1276037.html');
												thumbnails[1288708] = new thumbnail(1288708,'91452','','1008_thumb.jpg',130, 85,1,'photo_1288708.html');
												thumbnails[1288709] = new thumbnail(1288709,'88262','','DSC_5739_thumb.jpg',130, 87,1,'photo_1288709.html');
												thumbnails[1289079] = new thumbnail(1289079,'88263','','Max 71_thumb.jpg',130, 86,1,'photo_1289079.html');
												thumbnails[1290695] = new thumbnail(1290695,'88263','','DSC_0023_thumb.jpg',130, 87,1,'photo_1290695.html');
												thumbnails[1290736] = new thumbnail(1290736,'88262','','Earey 017_thumb.jpg',130, 86,1,'photo_1290736.html');
												thumbnails[1292956] = new thumbnail(1292956,'91452','','DSC_64922_thumb.jpg',130, 87,1,'photo_1292956.html');
												thumbnails[1631408] = new thumbnail(1631408,'91452','','Max@jaws_thumb.jpg',130, 87,1,'photo_1631408.html');
												thumbnails[1631409] = new thumbnail(1631409,'91452','','MAX_70601_thumb.jpg',130, 87,1,'photo_1631409.html');
												thumbnails[1631410] = new thumbnail(1631410,'91452','','MAX_9025_thumb.jpg',130, 87,1,'photo_1631410.html');
												thumbnails[1677528] = new thumbnail(1677528,'91452','','MAX_7399_thumb.jpg',130, 87,1,'photo_1677528.html');
												thumbnails[1677894] = new thumbnail(1677894,'91452','','MAX_9261_thumb.jpg',130, 87,1,'photo_1677894.html');
												thumbnails[1677897] = new thumbnail(1677897,'284774','','MAX_9548_thumb.jpg',130, 87,1,'photo_1677897.html');
												thumbnails[2098459] = new thumbnail(2098459,'91452','','MAX_9585_thumb.jpg',130, 87,1,'photo_2098459.html');
												thumbnails[3416997] = new thumbnail(3416997,'88248','','Max Earey 8890_thumb.jpg',130, 86,1,'photo_3416997.html');
												thumbnails[3440982] = new thumbnail(3440982,'88262','','Earey 8737_thumb.jpg',130, 87,1,'photo_3440982.html');
												thumbnails[3440986] = new thumbnail(3440986,'91452','','Earey 8210_thumb.jpg',130, 87,1,'photo_3440986.html');
												thumbnails[3440989] = new thumbnail(3440989,'91452','','MAX_9156_thumb.jpg',130, 87,1,'photo_3440989.html');
												thumbnails[3444881] = new thumbnail(3444881,'91452','','MAX_9091_thumb.jpg',130, 87,1,'photo_3444881.html');
												thumbnails[3444902] = new thumbnail(3444902,'91452','','MAX_7059_thumb.jpg',130, 87,1,'photo_3444902.html');
												thumbnails[3444907] = new thumbnail(3444907,'88263','','Max Earey (334)_thumb.jpg',130, 87,1,'photo_3444907.html');
												thumbnails[4017295] = new thumbnail(4017295,'88263','','_MAX5718_thumb.jpg',130, 86,1,'photo_4017295.html');
												thumbnails[4017320] = new thumbnail(4017320,'88263','','_MAX5654_thumb.jpg',130, 86,1,'photo_4017320.html');
												thumbnails[4017323] = new thumbnail(4017323,'88263','','_DSC7166_thumb.jpg',130, 86,1,'photo_4017323.html');
												thumbnails[4875834] = new thumbnail(4875834,'88248','','_DSC5540_thumb.jpg',130, 86,1,'photo_4875834.html');
												thumbnails[4950946] = new thumbnail(4950946,'88248','','_MAX0679_thumb.jpg',130, 86,1,'photo_4950946.html');
												thumbnails[4967608] = new thumbnail(4967608,'88248','','014_thumb.jpg',130, 86,1,'photo_4967608.html');
												thumbnails[4967610] = new thumbnail(4967610,'88248','','006_thumb.jpg',130, 86,1,'photo_4967610.html');
												thumbnails[4967617] = new thumbnail(4967617,'88248','','015_thumb.jpg',130, 86,1,'photo_4967617.html');
												thumbnails[4980169] = new thumbnail(4980169,'88248','','009_8FD3D0B3-1D09-001F-998D10F13F7B480F_thumb.jpg',130, 86,1,'photo_4980169.html');
												thumbnails[4980297] = new thumbnail(4980297,'88248','','008_thumb.jpg',130, 86,1,'photo_4980297.html');
												thumbnails[5029182] = new thumbnail(5029182,'284774','','001_B0E166C8-1D09-001F-994A8CBCC078CD87_thumb.jpg',130, 86,1,'photo_5029182.html');
												thumbnails[5029186] = new thumbnail(5029186,'284774','','002_B0E25DAB-1D09-001F-996A2CDE86731D19_thumb.jpg',130, 86,1,'photo_5029186.html');
												thumbnails[5029199] = new thumbnail(5029199,'284774','','007_thumb.jpg',130, 86,1,'photo_5029199.html');
												thumbnails[5029203] = new thumbnail(5029203,'284774','','004_B0E4A307-1D09-001F-998659FAD1EE8D8B_thumb.jpg',130, 86,1,'photo_5029203.html');
												thumbnails[5029213] = new thumbnail(5029213,'284774','','0091_thumb.jpg',130, 86,1,'photo_5029213.html');
												thumbnails[5029216] = new thumbnail(5029216,'284774','','006_B0E6C693-1D09-001F-99F531BBF39469AC_thumb.jpg',130, 86,1,'photo_5029216.html');
												thumbnails[5033897] = new thumbnail(5033897,'284774','','Blo_002_thumb.jpg',130, 86,1,'photo_5033897.html');
												thumbnails[5033898] = new thumbnail(5033898,'284774','','blog_003_thumb.jpg',130, 86,1,'photo_5033898.html');
												thumbnails[5033899] = new thumbnail(5033899,'284774','','blog_004_thumb.jpg',130, 86,1,'photo_5033899.html');
												thumbnails[5033900] = new thumbnail(5033900,'284774','','blog_005_thumb.jpg',130, 86,1,'photo_5033900.html');
												thumbnails[5033902] = new thumbnail(5033902,'284774','','Blog_001_thumb.jpg',130, 86,1,'photo_5033902.html');
												thumbnails[5038455] = new thumbnail(5038455,'284774','','_DSC5241_thumb.jpg',130, 86,1,'photo_5038455.html');
												thumbnails[5038456] = new thumbnail(5038456,'284774','','_DSC5074_thumb.jpg',130, 86,1,'photo_5038456.html');
												thumbnails[5038457] = new thumbnail(5038457,'91452','','_DSC4305_thumb.jpg',130, 86,1,'photo_5038457.html');
												thumbnails[5049853] = new thumbnail(5049853,'284774','','_DSC5441_thumb.jpg',130, 86,1,'photo_5049853.html');
												thumbnails[5049854] = new thumbnail(5049854,'284774','','_DSC6084_thumb.jpg',130, 86,1,'photo_5049854.html');
												thumbnails[5049855] = new thumbnail(5049855,'284774','','DSC_4971_thumb.jpg',130, 86,1,'photo_5049855.html');
												thumbnails[5049856] = new thumbnail(5049856,'284774','','_DSC5840_thumb.jpg',130, 86,1,'photo_5049856.html');
												thumbnails[5092706] = new thumbnail(5092706,'284774','','_DSC7515_thumb.jpg',130, 86,1,'photo_5092706.html');
												thumbnails[5092707] = new thumbnail(5092707,'284774','','_DSC7560_thumb.jpg',130, 86,1,'photo_5092707.html');
												thumbnails[5092708] = new thumbnail(5092708,'284774','','_DSC7623_thumb.jpg',130, 86,1,'photo_5092708.html');
												thumbnails[5119276] = new thumbnail(5119276,'88262','','Clik_001_thumb.jpg',130, 86,1,'photo_5119276.html');
												thumbnails[5139277] = new thumbnail(5139277,'88262','','_MAX2667_thumb.jpg',130, 86,1,'photo_5139277.html');
												thumbnails[5139279] = new thumbnail(5139279,'88262','','_MAX2937_thumb.jpg',130, 86,1,'photo_5139279.html');
												thumbnails[5139282] = new thumbnail(5139282,'88262','','_MAX2403_thumb.jpg',130, 86,1,'photo_5139282.html');
												thumbnails[6366526] = new thumbnail(6366526,'88262','','Earey_99011_thumb.jpg',130, 86,1,'photo_6366526.html');
												thumbnails[6490219] = new thumbnail(6490219,'88263','','Earey83_thumb.jpg',130, 86,1,'photo_6490219.html');
												thumbnails[6490246] = new thumbnail(6490246,'88248','','Earey133_thumb.jpg',130, 89,1,'photo_6490246.html');
												thumbnails[6490263] = new thumbnail(6490263,'88263','','Earey214_thumb.jpg',130, 86,1,'photo_6490263.html');
												thumbnails[6490268] = new thumbnail(6490268,'88263','','Earey70_thumb.jpg',130, 86,1,'photo_6490268.html');
												thumbnails[6490355] = new thumbnail(6490355,'88263','','Earey82_thumb.jpg',130, 86,1,'photo_6490355.html');
												thumbnails[6490380] = new thumbnail(6490380,'88248','','Earey88_thumb.jpg',130, 86,1,'photo_6490380.html');
												thumbnails[6490386] = new thumbnail(6490386,'88262','','Earey34_thumb.jpg',130, 86,1,'photo_6490386.html');
												thumbnails[6490389] = new thumbnail(6490389,'88262','','Earey92_thumb.jpg',130, 86,1,'photo_6490389.html');
												thumbnails[6490402] = new thumbnail(6490402,'88262','','Earey152_thumb.jpg',130, 86,1,'photo_6490402.html');
												thumbnails[6490409] = new thumbnail(6490409,'88262','','Earey1541_thumb.jpg',130, 86,1,'photo_6490409.html');
												thumbnails[6490422] = new thumbnail(6490422,'88248','','Earey25_thumb.jpg',130, 86,1,'photo_6490422.html');
												thumbnails[6490436] = new thumbnail(6490436,'88248','','Earey4_thumb.jpg',130, 86,1,'photo_6490436.html');
												thumbnails[6490522] = new thumbnail(6490522,'88263','','Earey861_thumb.jpg',130, 86,1,'photo_6490522.html');
												thumbnails[6490525] = new thumbnail(6490525,'88248','','Earey40_thumb.jpg',130, 86,1,'photo_6490525.html');
												thumbnails[6490532] = new thumbnail(6490532,'88263','','Earey199_thumb.jpg',130, 86,1,'photo_6490532.html');
												thumbnails[6492566] = new thumbnail(6492566,'357583','','Earey29_thumb.jpg',130, 86,1,'photo_6492566.html');
												thumbnails[6492609] = new thumbnail(6492609,'357583','','Earey91_thumb.jpg',130, 86,1,'photo_6492609.html');
												thumbnails[6492617] = new thumbnail(6492617,'357583','','Earey103_thumb.jpg',130, 86,1,'photo_6492617.html');
												thumbnails[6492623] = new thumbnail(6492623,'357583','','Earey97_thumb.jpg',130, 86,1,'photo_6492623.html');
												thumbnails[6492635] = new thumbnail(6492635,'357583','','Earey104_thumb.jpg',130, 86,1,'photo_6492635.html');
												thumbnails[6492639] = new thumbnail(6492639,'357583','','Earey107_thumb.jpg',130, 86,1,'photo_6492639.html');
												thumbnails[6492641] = new thumbnail(6492641,'357583','','Earey213_thumb.jpg',130, 87,1,'photo_6492641.html');
												thumbnails[6492644] = new thumbnail(6492644,'357583','','Earey138_thumb.jpg',130, 86,1,'photo_6492644.html');
												thumbnails[6495722] = new thumbnail(6495722,'357583','','_MJE6349_thumb.jpg',130, 86,1,'photo_6495722.html');
												thumbnails[6496332] = new thumbnail(6496332,'88248','','Earey_6092_thumb.jpg',130, 86,1,'photo_6496332.html');
												thumbnails[6527127] = new thumbnail(6527127,'88248','','Earey66_thumb.jpg',130, 86,1,'photo_6527127.html');
												thumbnails[6527129] = new thumbnail(6527129,'88248','','Earey79_thumb.jpg',130, 86,1,'photo_6527129.html');
												thumbnails[6527141] = new thumbnail(6527141,'88248','','Earey197_thumb.jpg',130, 87,1,'photo_6527141.html');
												thumbnails[6527146] = new thumbnail(6527146,'88248','','Earey202_thumb.jpg',130, 86,1,'photo_6527146.html');
												thumbnails[6527148] = new thumbnail(6527148,'88248','','Earey94_thumb.jpg',130, 86,1,'photo_6527148.html');
												thumbnails[6527691] = new thumbnail(6527691,'357583','','Earey_3917_thumb.jpg',130, 86,1,'photo_6527691.html');
												thumbnails[6527698] = new thumbnail(6527698,'357583','','Earey_6544_thumb.jpg',130, 86,1,'photo_6527698.html');
												thumbnails[6527704] = new thumbnail(6527704,'357583','','Earey_88451_thumb.jpg',130, 86,1,'photo_6527704.html');
												thumbnails[6527757] = new thumbnail(6527757,'357583','','Earey_4028_thumb.jpg',130, 86,1,'photo_6527757.html');
												thumbnails[6527830] = new thumbnail(6527830,'88248','','Earey1641_thumb.jpg',130, 86,1,'photo_6527830.html');
												thumbnails[6527840] = new thumbnail(6527840,'88248','','Earey2061_thumb.jpg',130, 87,1,'photo_6527840.html');
												thumbnails[6527968] = new thumbnail(6527968,'88248','','Earey_8872_thumb.jpg',130, 86,1,'photo_6527968.html');
												thumbnails[6527970] = new thumbnail(6527970,'357583','','Earey_3510_thumb.jpg',130, 86,1,'photo_6527970.html');
												thumbnails[6527973] = new thumbnail(6527973,'357583','','Earey_9566_thumb.jpg',130, 86,1,'photo_6527973.html');
												thumbnails[6527974] = new thumbnail(6527974,'357583','','Earey_6569_thumb.jpg',130, 86,1,'photo_6527974.html');
												thumbnails[6528236] = new thumbnail(6528236,'88263','','Earey_Web_48_thumb.jpg',130, 86,1,'photo_6528236.html');
												thumbnails[6528238] = new thumbnail(6528238,'88263','','Earey_5631_thumb.jpg',130, 86,1,'photo_6528238.html');
												thumbnails[6528240] = new thumbnail(6528240,'88263','','Earey_8214_thumb.jpg',130, 86,1,'photo_6528240.html');
												thumbnails[6528250] = new thumbnail(6528250,'88263','','Earey_1506_thumb.jpg',130, 86,1,'photo_6528250.html');
												thumbnails[6528466] = new thumbnail(6528466,'88263','','Earey_8645_thumb.jpg',130, 86,1,'photo_6528466.html');
												thumbnails[6528472] = new thumbnail(6528472,'88263','','Earey_9006_thumb.jpg',130, 86,1,'photo_6528472.html');
												thumbnails[6528475] = new thumbnail(6528475,'88263','','Earey_Web_55_thumb.jpg',130, 86,1,'photo_6528475.html');
												thumbnails[6529422] = new thumbnail(6529422,'357583','','Earey_3117_thumb.jpg',130, 86,1,'photo_6529422.html');
												thumbnails[6529425] = new thumbnail(6529425,'357583','','Earey_9348_thumb.jpg',130, 87,1,'photo_6529425.html');
												thumbnails[6529429] = new thumbnail(6529429,'357583','','Earey_3033_thumb.jpg',130, 86,1,'photo_6529429.html');
												thumbnails[6529437] = new thumbnail(6529437,'88248','','Earey_3145_thumb.jpg',130, 86,1,'photo_6529437.html');
												thumbnails[7366349] = new thumbnail(7366349,'88262','','Earey_27001_thumb.jpg',130, 87,1,'photo_7366349.html');
												thumbnails[7366351] = new thumbnail(7366351,'88262','','Earey_173612_thumb.jpg',130, 87,1,'photo_7366351.html');
												thumbnails[7366353] = new thumbnail(7366353,'88262','','_MJE27241_thumb.jpg',130, 86,1,'photo_7366353.html');
												thumbnails[7397397] = new thumbnail(7397397,'88248','','Max_Earey_Web__C87B0D10-1EC9-DFB6-094EF47FF2E5FC2A_thumb.jpg',130, 86,1,'photo_7397397.html');
												thumbnails[7475389] = new thumbnail(7475389,'88248','','_DSC8075_thumb.jpg',130, 86,1,'photo_7475389.html');
												thumbnails[8151850] = new thumbnail(8151850,'357583','','Earey_48_thumb.jpg',130, 86,1,'photo_8151850.html');
												thumbnails[8151852] = new thumbnail(8151852,'357583','','Earey_3117_25563F4D-1EC9-DFB6-0912F29A1EA6C20E_thumb.jpg',130, 86,1,'photo_8151852.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[88248] = new gallery(88248,'7397397,6527968,4967610,3416997,1234662','Automotive','gallery',[1234654,1234662,3416997,4875834,4950946,4967608,4967610,4967617,4980169,4980297,6490246,6490380,6490422,6490436,6490525,6496332,6527127,6527129,6527141,6527146,6527148,6527830,6527840,6527968,6529437,7397397,7475389],0, 0, '', 'gallery_88248.html',0,0);
				  					galleries[89089] = new gallery(89089,'1250449,1250448','Commercial','gallery',[1250448,1250449,1256043,1276037],0, 0, '', 'gallery_89089.html',0,0);
				  					galleries[357583] = new gallery(357583,'6529425,6495722','Detail','gallery',[6492566,6492609,6492617,6492623,6492635,6492639,6492641,6492644,6495722,6527691,6527698,6527704,6527757,6527970,6527973,6527974,6529422,6529425,6529429,8151850,8151852],0, 0, '', 'gallery_357583.html',0,0);
				  					galleries[88263] = new gallery(88263,'6490263,1289079,1234844','Motor Sport','gallery',[1234836,1234844,1234849,1289079,1290695,3444907,4017295,4017320,4017323,6490219,6490263,6490268,6490355,6490522,6490532,6528236,6528238,6528240,6528250,6528466,6528472,6528475],0, 0, '', 'gallery_88263.html',0,0);
				  					galleries[91452] = new gallery(91452,'3444902,3440989,2098459,1631409,1631408','Sport','gallery',[1288708,1292956,1631408,1631409,1631410,1677528,1677894,2098459,3440986,3440989,3444881,3444902,5038457],0, 0, '', 'gallery_91452.html',0,0);
				  					galleries[88262] = new gallery(88262,'1276035,1234958','Travel','gallery',[1234958,1250438,1250440,1276035,1288709,1290736,3440982,5119276,5139277,5139279,5139282,6366526,6490386,6490389,6490402,6490409,7366349,7366351,7366353],0, 0, '', 'gallery_88262.html',0,0);
				  					galleries[284774] = new gallery(284774,'5092708,1677897','Wave Sailing','gallery',[1677897,5029182,5029186,5029199,5029203,5029213,5029216,5033897,5033898,5033899,5033900,5033902,5038455,5038456,5049853,5049854,5049855,5049856,5092706,5092707,5092708],0, 0, '', 'gallery_284774.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7397397,4950946,4875834,3416997';
imageSets[2] = '7397397,6529425,6527968,6495722,6490263,5092708,4967610,3444902,3440989,3416997,2098459,1677897,1631409,1631408,1289079,1276035,1250449,1250448,1234958,1234844,1234662';
imageSets[181770] = '7397397,4980297,4980169';
imageSets[3] = '8151852,8151850,7475389,7397397,7366353,7366351,7366349,6529437,6529429,6529425,6529422,6528475,6528472,6528466,6528250,6528240,6528238,6528236,6527974,6527973,6527970,6527968,6527840,6527830,6527757,6527704,6527698,6527691,6527148,6527146,6527141,6527129,6527127,6496332,6495722,6492644,6492641,6492639,6492635,6492623,6492617,6492609,6492566,6490532,6490525,6490522,6490436,6490422,6490409,6490402';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/maxearey/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/maxearey/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/maxearey/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/maxearey/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/maxearey/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/maxearey/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 && backgrounds[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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Photographer - Max Earey: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object' || array == undefined) {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = 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({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

