window.thumbnails = {};
															thumbnails[8941016] = clik.newPhoto({"id":8941016,"src":"noten3_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":173});
															thumbnails[7149365] = clik.newPhoto({"id":7149365,"src":"f3_thumb.JPG","galleries_id":351396,"server_id":5,"link":"photo_7149365.html","width":130,"caption":"human flailings detail","height":191});
															thumbnails[8253250] = clik.newPhoto({"id":8253250,"src":"thoracicpark_thumb.jpg","galleries_id":439544,"server_id":5,"link":"photo_8253250.html","width":130,"caption":"","height":173});
															thumbnails[6340407] = clik.newPhoto({"id":6340407,"src":"senile_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_6340407.html","width":130,"caption":"the senile","height":237});
															thumbnails[6340686] = clik.newPhoto({"id":6340686,"src":"shipwreck1_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_6340686.html","width":130,"caption":"sculpture","height":177});
															thumbnails[6340777] = clik.newPhoto({"id":6340777,"src":"pipe1_thumb.JPG","galleries_id":351394,"server_id":5,"link":"photo_6340777.html","width":130,"caption":"pipe dreams - sculpture","height":165});
															thumbnails[7149361] = clik.newPhoto({"id":7149361,"src":"f1_thumb.JPG","galleries_id":351396,"server_id":5,"link":"photo_7149361.html","width":130,"caption":"human flailings","height":192});
															thumbnails[7632141] = clik.newPhoto({"id":7632141,"src":"005_thumb.JPG","galleries_id":413945,"server_id":5,"link":"photo_7632141.html","width":130,"caption":"","height":161});
															thumbnails[8072576] = clik.newPhoto({"id":8072576,"src":"studio1_thumb.jpg","galleries_id":432579,"server_id":5,"link":"photo_8072576.html","width":130,"caption":"","height":98});
															thumbnails[8941071] = clik.newPhoto({"id":8941071,"src":"018_thumb.JPG","galleries_id":470586,"server_id":5,"link":"photo_8941071.html","width":130,"caption":"","height":327});
															thumbnails[6340496] = clik.newPhoto({"id":6340496,"src":"physician_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_6340496.html","width":130,"caption":"the physician","height":228});
															thumbnails[6340738] = clik.newPhoto({"id":6340738,"src":"shipwreck2_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_6340738.html","width":130,"caption":"drawing","height":166});
															thumbnails[6340787] = clik.newPhoto({"id":6340787,"src":"pipe2_thumb.JPG","galleries_id":351394,"server_id":5,"link":"photo_6340787.html","width":130,"caption":"pipe dreams - drawing","height":173});
															thumbnails[7149362] = clik.newPhoto({"id":7149362,"src":"f2_thumb.JPG","galleries_id":351396,"server_id":5,"link":"photo_7149362.html","width":130,"caption":"human flailings detail","height":162});
															thumbnails[7632143] = clik.newPhoto({"id":7632143,"src":"posterior_thumb.jpg","galleries_id":413945,"server_id":5,"link":"photo_7632143.html","width":130,"caption":"","height":173});
															thumbnails[8072579] = clik.newPhoto({"id":8072579,"src":"studio2_thumb.jpg","galleries_id":432579,"server_id":5,"link":"photo_8072579.html","width":130,"caption":"","height":98});
															thumbnails[8941051] = clik.newPhoto({"id":8941051,"src":"figure2_thumb.jpg","galleries_id":470585,"server_id":5,"link":"photo_8941051.html","width":130,"caption":"","height":180});
															thumbnails[6340526] = clik.newPhoto({"id":6340526,"src":"leper_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_6340526.html","width":130,"caption":"the leper","height":228});
															thumbnails[7149305] = clik.newPhoto({"id":7149305,"src":"mother_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149305.html","width":130,"caption":"the mother","height":195});
															thumbnails[7662218] = clik.newPhoto({"id":7662218,"src":"029_thumb.JPG","galleries_id":413945,"server_id":5,"link":"photo_7662218.html","width":130,"caption":"","height":197});
															thumbnails[6340804] = clik.newPhoto({"id":6340804,"src":"pipe3_thumb.JPG","galleries_id":351394,"server_id":5,"link":"photo_6340804.html","width":130,"caption":"pipe dreams - note","height":186});
															thumbnails[7149310] = clik.newPhoto({"id":7149310,"src":"idle_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149310.html","width":130,"caption":"the idle","height":209});
															thumbnails[7632146] = clik.newPhoto({"id":7632146,"src":"050_thumb.JPG","galleries_id":413945,"server_id":5,"link":"photo_7632146.html","width":130,"caption":"","height":200});
															thumbnails[8072582] = clik.newPhoto({"id":8072582,"src":"studio4_thumb.jpg","galleries_id":432579,"server_id":5,"link":"photo_8072582.html","width":130,"caption":"","height":77});
															thumbnails[8941056] = clik.newPhoto({"id":8941056,"src":"fallenbranches_thumb.jpg","galleries_id":470585,"server_id":5,"link":"photo_8941056.html","width":130,"caption":"","height":236});
															thumbnails[8941060] = clik.newPhoto({"id":8941060,"src":"fb1_thumb.jpg","galleries_id":470585,"server_id":5,"link":"photo_8941060.html","width":130,"caption":"","height":179});
															thumbnails[8943935] = clik.newPhoto({"id":8943935,"src":"ruinfilm-6_thumb.jpg","galleries_id":415105,"server_id":5,"link":"photo_8943935.html","width":130,"caption":"","height":73});
															thumbnails[7149315] = clik.newPhoto({"id":7149315,"src":"inquisitor_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149315.html","width":130,"caption":"the inquisitor","height":210});
															thumbnails[7149317] = clik.newPhoto({"id":7149317,"src":"humorist_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149317.html","width":130,"caption":"the humorist","height":246});
															thumbnails[7149320] = clik.newPhoto({"id":7149320,"src":"illuminant_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149320.html","width":130,"caption":"the illuminant","height":195});
															thumbnails[6340764] = clik.newPhoto({"id":6340764,"src":"shipwreck4_thumb.JPG","galleries_id":351393,"server_id":5,"link":"photo_6340764.html","width":130,"caption":"fragment","height":171});
															thumbnails[6600578] = clik.newPhoto({"id":6600578,"src":"DSC09064_thumb.JPG","galleries_id":351394,"server_id":5,"link":"photo_6600578.html","width":130,"caption":"pipe dreams - 1 of 4 note panel","height":70});
															thumbnails[7656773] = clik.newPhoto({"id":7656773,"src":"circ3_101_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7656773.html","width":130,"caption":"the arbiter","height":216});
															thumbnails[8072583] = clik.newPhoto({"id":8072583,"src":"s1_F0D79307-24E8-5EC4-4FEF6F28191F5AEA_thumb.jpg","galleries_id":432579,"server_id":5,"link":"photo_8072583.html","width":130,"caption":"","height":98});
															thumbnails[8941007] = clik.newPhoto({"id":8941007,"src":"noten1_thumb.jpg","galleries_id":413945,"server_id":5,"link":"photo_8941007.html","width":130,"caption":"","height":172});
															thumbnails[8943936] = clik.newPhoto({"id":8943936,"src":"ruinfilm-8_thumb.jpg","galleries_id":415105,"server_id":5,"link":"photo_8943936.html","width":130,"caption":"","height":72});
															thumbnails[7656774] = clik.newPhoto({"id":7656774,"src":"circ3_108_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7656774.html","width":130,"caption":"the penitent","height":210});
															thumbnails[7656801] = clik.newPhoto({"id":7656801,"src":"DSC09817_thumb.JPG","galleries_id":351392,"server_id":5,"link":"photo_7656801.html","width":130,"caption":"the infant","height":211});
															thumbnails[7321256] = clik.newPhoto({"id":7321256,"src":"face2_thumb.JPG","galleries_id":351393,"server_id":5,"link":"photo_7321256.html","width":130,"caption":"fragment","height":173});
															thumbnails[7658120] = clik.newPhoto({"id":7658120,"src":"mourn11_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7658120.html","width":130,"caption":"the mourner","height":200});
															thumbnails[7149344] = clik.newPhoto({"id":7149344,"src":"s1_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_7149344.html","width":130,"caption":"panel1","height":208});
															thumbnails[7149322] = clik.newPhoto({"id":7149322,"src":"d1_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149322.html","width":130,"caption":"drawing 1","height":165});
															thumbnails[7149348] = clik.newPhoto({"id":7149348,"src":"s2_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_7149348.html","width":130,"caption":"panel 2","height":209});
															thumbnails[8072853] = clik.newPhoto({"id":8072853,"src":"082_thumb.JPG","galleries_id":432579,"server_id":5,"link":"photo_8072853.html","width":130,"caption":"","height":98});
															thumbnails[8941013] = clik.newPhoto({"id":8941013,"src":"noten2_thumb.jpg","galleries_id":413945,"server_id":5,"link":"photo_8941013.html","width":130,"caption":"","height":168});
															thumbnails[8941067] = clik.newPhoto({"id":8941067,"src":"thread1_thumb.jpg","galleries_id":470586,"server_id":5,"link":"photo_8941067.html","width":130,"caption":"","height":173});
															thumbnails[7149351] = clik.newPhoto({"id":7149351,"src":"s3_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_7149351.html","width":130,"caption":"panel 3","height":208});
															thumbnails[7149325] = clik.newPhoto({"id":7149325,"src":"d2_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149325.html","width":130,"caption":"drawing 2 ","height":161});
															thumbnails[8140203] = clik.newPhoto({"id":8140203,"src":"057_thumb.JPG","galleries_id":432579,"server_id":5,"link":"photo_8140203.html","width":130,"caption":"","height":98});
															thumbnails[8941026] = clik.newPhoto({"id":8941026,"src":"noten31_thumb.jpg","galleries_id":413945,"server_id":5,"link":"photo_8941026.html","width":130,"caption":"","height":173});
															thumbnails[7149354] = clik.newPhoto({"id":7149354,"src":"s4_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_7149354.html","width":130,"caption":"panel 4","height":201});
															thumbnails[7149326] = clik.newPhoto({"id":7149326,"src":"d3_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149326.html","width":130,"caption":"drawing 3","height":160});
															thumbnails[8253240] = clik.newPhoto({"id":8253240,"src":"studio9_thumb.jpg","galleries_id":432579,"server_id":5,"link":"photo_8253240.html","width":130,"caption":"","height":89});
															thumbnails[8941017] = clik.newPhoto({"id":8941017,"src":"notenerv_thumb.jpg","galleries_id":413945,"server_id":5,"link":"photo_8941017.html","width":130,"caption":"","height":233});
															thumbnails[8943379] = clik.newPhoto({"id":8943379,"src":"3d1_thumb.jpg","galleries_id":415105,"server_id":5,"link":"photo_8943379.html","width":130,"caption":"","height":91});
															thumbnails[8943974] = clik.newPhoto({"id":8943974,"src":"3danse_thumb.jpg","galleries_id":415105,"server_id":5,"link":"photo_8943974.html","width":130,"caption":"","height":104});
															thumbnails[7149355] = clik.newPhoto({"id":7149355,"src":"s5_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_7149355.html","width":130,"caption":"panel 5","height":205});
															thumbnails[7149327] = clik.newPhoto({"id":7149327,"src":"d4_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149327.html","width":130,"caption":"drawing 4","height":164});
															thumbnails[8253243] = clik.newPhoto({"id":8253243,"src":"studio8_thumb.jpg","galleries_id":432579,"server_id":5,"link":"photo_8253243.html","width":130,"caption":"","height":113});
															thumbnails[7149357] = clik.newPhoto({"id":7149357,"src":"s6_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_7149357.html","width":130,"caption":"panel 6","height":203});
															thumbnails[7149328] = clik.newPhoto({"id":7149328,"src":"d5_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149328.html","width":130,"caption":"drawing 5","height":164});
															thumbnails[7149358] = clik.newPhoto({"id":7149358,"src":"s7_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_7149358.html","width":130,"caption":"panel 7","height":205});
															thumbnails[8943933] = clik.newPhoto({"id":8943933,"src":"ruinfilm-5_thumb_7417FF5B-1EC9-D45B-1CAD54E6CB1FF0F1.jpg","galleries_id":415105,"server_id":5,"link":"photo_8943933.html","width":130,"caption":"","height":189});
															thumbnails[7149330] = clik.newPhoto({"id":7149330,"src":"d6_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149330.html","width":130,"caption":"drawing 6","height":161});
															thumbnails[7149359] = clik.newPhoto({"id":7149359,"src":"s8_thumb.jpg","galleries_id":351393,"server_id":5,"link":"photo_7149359.html","width":130,"caption":"panel 8","height":203});
															thumbnails[7149332] = clik.newPhoto({"id":7149332,"src":"d7_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149332.html","width":130,"caption":"drawing 7","height":165});
															thumbnails[7149334] = clik.newPhoto({"id":7149334,"src":"d8_thumb.jpg","galleries_id":351392,"server_id":5,"link":"photo_7149334.html","width":130,"caption":"drawing 8","height":166});
															thumbnails[8253247] = clik.newPhoto({"id":8253247,"src":"studio81_thumb.jpg","galleries_id":432579,"server_id":5,"link":"photo_8253247.html","width":130,"caption":"","height":173});
															thumbnails[8253252] = clik.newPhoto({"id":8253252,"src":"flailingnote_thumb.jpg","galleries_id":351396,"server_id":5,"link":"photo_8253252.html","width":130,"caption":"human flailings detail","height":173});
															thumbnails[8140198] = clik.newPhoto({"id":8140198,"src":"077_thumb.JPG","galleries_id":432579,"server_id":5,"link":"photo_8140198.html","width":130,"caption":"","height":173});
															thumbnails[8943376] = clik.newPhoto({"id":8943376,"src":"dr11_thumb.jpg","galleries_id":432579,"server_id":5,"link":"photo_8943376.html","width":130,"caption":"","height":183});
															thumbnails[8140205] = clik.newPhoto({"id":8140205,"src":"034_thumb.JPG","galleries_id":432579,"server_id":5,"link":"photo_8140205.html","width":130,"caption":"","height":173});
															thumbnails[8140232] = clik.newPhoto({"id":8140232,"src":"009_thumb.JPG","galleries_id":432579,"server_id":5,"link":"photo_8140232.html","width":130,"caption":"","height":164});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[351392] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"circular ruin","link":"gallery_351392.html","maxRecords":0.0,"photoIDs":[6340407.0,6340496.0,6340526.0,7149305.0,7149310.0,7149315.0,7149317.0,7149320.0,7656773.0,7656774.0,7656801.0,7658120.0,7149322.0,7149325.0,7149326.0,7149327.0,7149328.0,7149330.0,7149332.0,7149334.0],"skipIndex":0,"section_code":"gallery","featured_images":"7658120,7656801,7656774,7656773,7149334,7149332,7149330,7149328,7149327,7149326","id":351392,"singleSection":false});				  						galleries[351393] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"imaginary shipwreck","link":"gallery_351393.html","maxRecords":0.0,"photoIDs":[6340686.0,6340738.0,6340764.0,7321256.0,7149344.0,7149348.0,7149351.0,7149354.0,7149355.0,7149357.0,7149358.0,7149359.0],"skipIndex":0,"section_code":"gallery","featured_images":"7321256,7149359,7149358,7149357,7149355,7149354,7149351,7149348,7149344,6340764","id":351393,"singleSection":false});				  						galleries[439544] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"thoracic park","link":"gallery_439544.html","maxRecords":0.0,"photoIDs":[8253250.0],"skipIndex":0,"section_code":"gallery","featured_images":8253250.0,"id":439544,"singleSection":false});				  						galleries[351394] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"pipe dreams","link":"gallery_351394.html","maxRecords":0.0,"photoIDs":[6340777.0,6340787.0,6340804.0,6600578.0],"skipIndex":0,"section_code":"gallery","featured_images":"6600578,6340804,6340787,6340777","id":351394,"singleSection":false});				  						galleries[351396] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"human flailings","link":"gallery_351396.html","maxRecords":0.0,"photoIDs":[7149365.0,7149361.0,7149362.0,8253252.0],"skipIndex":0,"section_code":"gallery","featured_images":"8253252,7149365,7149362,7149361","id":351396,"singleSection":false});				  						galleries[413945] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"nervous tissue","link":"gallery_413945.html","maxRecords":0.0,"photoIDs":[7632141.0,7632143.0,7662218.0,7632146.0,8941007.0,8941013.0,8941026.0,8941017.0],"skipIndex":0,"section_code":"gallery","featured_images":"8941026,8941017,8941013,8941007,7662218,7632146,7632143,7632141","id":413945,"singleSection":false});				  						galleries[470585] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"fallen branches","link":"gallery_470585.html","maxRecords":0.0,"photoIDs":[8941051.0,8941056.0,8941060.0],"skipIndex":0,"section_code":"gallery","featured_images":"8941060,8941056,8941051","id":470585,"singleSection":false});				  						galleries[470586] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"severed threads","link":"gallery_470586.html","maxRecords":0.0,"photoIDs":[8941071.0,8941067.0],"skipIndex":0,"section_code":"gallery","featured_images":"8941071,8941067","id":470586,"singleSection":false});				  						galleries[415105] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"film stills","link":"gallery_415105.html","maxRecords":0.0,"photoIDs":[8943935.0,8943936.0,8943379.0,8943974.0,8943933.0],"skipIndex":0,"section_code":"gallery","featured_images":"8943974,8943936,8943935,8943933,8943379","id":415105,"singleSection":false});				  						galleries[432579] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"studio","link":"gallery_432579.html","maxRecords":0.0,"photoIDs":[8072576.0,8072579.0,8072582.0,8072583.0,8072853.0,8140203.0,8253240.0,8253243.0,8253247.0,8140198.0,8943376.0,8140205.0,8140232.0],"skipIndex":0,"section_code":"gallery","featured_images":"8943376,8253247,8253243,8253240,8140232,8140205,8140203,8140198,8072853,8072583","id":432579,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8943376';
imageSets[3] = '8943974,8943936,8943935,8943933,8943379,8943376,8941071,8941067,8941060,8941056,8941051,8941026,8941017,8941016,8941013,8941007,8253252,8253250,8253247,8253243,8253240,8140232,8140205,8140203,8140198,8072853,8072583,8072582,8072579,8072576,7662218,7658120,7656801,7656774,7656773,7632146,7632143,7632141,7321256,7149365,7149362,7149361,7149359,7149358,7149357,7149355,7149354,7149351,7149348,7149344';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/davidmarron/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/davidmarron/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 = 'david marron artist: ' + 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;
	}
}

		

