window.thumbnails = {};
															thumbnails[474039] = clik.newPhoto({"id":474039,"src":"Citrus_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Citrus<br>\r\n(no longer available)","height":130});
															thumbnails[733338] = clik.newPhoto({"id":733338,"src":"Itsabitkenkiff_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"It's A Bit Ken Kiff","height":108});
															thumbnails[733343] = clik.newPhoto({"id":733343,"src":"londoneye_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"London Eye","height":98});
															thumbnails[733356] = clik.newPhoto({"id":733356,"src":"pier_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Pier","height":114});
															thumbnails[1418114] = clik.newPhoto({"id":1418114,"src":"singingtwo_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Singing II","height":138});
															thumbnails[1418181] = clik.newPhoto({"id":1418181,"src":"glove_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Glove","height":108});
															thumbnails[1418191] = clik.newPhoto({"id":1418191,"src":"wherenowtwo_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Where Is He Now? II","height":122});
															thumbnails[2265244] = clik.newPhoto({"id":2265244,"src":"exampleframe_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"An example of a small painting on canvas, mounted on board, with a wooden frame:<br>\r\nEcho, 33 x 40 cms including frame","height":122});
															thumbnails[474208] = clik.newPhoto({"id":474208,"src":"fivemats_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_474208.html","width":130,"caption":"Five Mats","height":131});
															thumbnails[561373] = clik.newPhoto({"id":561373,"src":"kite_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_561373.html","width":130,"caption":"Kite","height":130});
															thumbnails[733334] = clik.newPhoto({"id":733334,"src":"bigwindow_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_733334.html","width":130,"caption":"Big Window ","height":124});
															thumbnails[948944] = clik.newPhoto({"id":948944,"src":"redboot_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_948944.html","width":130,"caption":"Red Boot","height":129});
															thumbnails[948950] = clik.newPhoto({"id":948950,"src":"surface_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_948950.html","width":130,"caption":"Surface","height":131});
															thumbnails[948953] = clik.newPhoto({"id":948953,"src":"threetwoone_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_948953.html","width":130,"caption":"Three Two One","height":118});
															thumbnails[985425] = clik.newPhoto({"id":985425,"src":"aimlesslysoblue_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_985425.html","width":130,"caption":"Aimlessly So Blue","height":131});
															thumbnails[1211801] = clik.newPhoto({"id":1211801,"src":"1001_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_1211801.html","width":130,"caption":"One Thousand and One","height":130});
															thumbnails[1211802] = clik.newPhoto({"id":1211802,"src":"aliens_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_1211802.html","width":130,"caption":"Aliens","height":130});
															thumbnails[1914586] = clik.newPhoto({"id":1914586,"src":"allsorts_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_1914586.html","width":130,"caption":"Allsorts","height":130});
															thumbnails[1914592] = clik.newPhoto({"id":1914592,"src":"amazon_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_1914592.html","width":130,"caption":"Amazon","height":130});
															thumbnails[1914602] = clik.newPhoto({"id":1914602,"src":"newflag_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_1914602.html","width":130,"caption":"New Flag","height":108});
															thumbnails[1914607] = clik.newPhoto({"id":1914607,"src":"oldegg_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_1914607.html","width":130,"caption":"Old Egg (no longer available)","height":130});
															thumbnails[2021501] = clik.newPhoto({"id":2021501,"src":"MilfordHaven_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_2021501.html","width":130,"caption":"Milford Haven","height":130});
															thumbnails[2022502] = clik.newPhoto({"id":2022502,"src":"Twig_thumb.jpg","galleries_id":135585,"server_id":18,"link":"photo_2022502.html","width":130,"caption":"Twig","height":130});
															thumbnails[2265310] = clik.newPhoto({"id":2265310,"src":"Barcodemats_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_2265310.html","width":130,"caption":"Barcode Mat","height":130});
															thumbnails[2265312] = clik.newPhoto({"id":2265312,"src":"threemats_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_2265312.html","width":130,"caption":"Three Mats","height":130});
															thumbnails[2390585] = clik.newPhoto({"id":2390585,"src":"Risingtide_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_2390585.html","width":130,"caption":"Rising Tide","height":131});
															thumbnails[3129783] = clik.newPhoto({"id":3129783,"src":"bhutanrevisited_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_3129783.html","width":130,"caption":"Bhutan Revisited","height":129});
															thumbnails[3388984] = clik.newPhoto({"id":3388984,"src":"bequia_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_3388984.html","width":130,"caption":"Bequia I","height":130});
															thumbnails[3388989] = clik.newPhoto({"id":3388989,"src":"viewNYB_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_3388989.html","width":130,"caption":"View From The New York Bar","height":130});
															thumbnails[3598552] = clik.newPhoto({"id":3598552,"src":"Bequia2_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_3598552.html","width":130,"caption":"Bequia II","height":130});
															thumbnails[3598558] = clik.newPhoto({"id":3598558,"src":"Bequia3_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_3598558.html","width":130,"caption":"Bequia III","height":130});
															thumbnails[3598560] = clik.newPhoto({"id":3598560,"src":"bequia4_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_3598560.html","width":130,"caption":"Bequia IV","height":129});
															thumbnails[3598563] = clik.newPhoto({"id":3598563,"src":"BigLeaf_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_3598563.html","width":130,"caption":"Big Leaf","height":130});
															thumbnails[4949357] = clik.newPhoto({"id":4949357,"src":"greenflash_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_4949357.html","width":130,"caption":"Green Flash At Sunset","height":131});
															thumbnails[4949528] = clik.newPhoto({"id":4949528,"src":"newshoots_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_4949528.html","width":130,"caption":"Green Shoots","height":130});
															thumbnails[4949793] = clik.newPhoto({"id":4949793,"src":"lipstick_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_4949793.html","width":130,"caption":"Lipstick Coast","height":130});
															thumbnails[7202997] = clik.newPhoto({"id":7202997,"src":"cooberpedy_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_7202997.html","width":130,"caption":"Coober Pedy","height":129});
															thumbnails[7202999] = clik.newPhoto({"id":7202999,"src":"flightpath_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_7202999.html","width":130,"caption":"Flight Path","height":124});
															thumbnails[7203003] = clik.newPhoto({"id":7203003,"src":"Levera2_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_7203003.html","width":130,"caption":"Levera II","height":131});
															thumbnails[7203005] = clik.newPhoto({"id":7203005,"src":"Mirage_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_7203005.html","width":130,"caption":"Mirage","height":130});
															thumbnails[7203008] = clik.newPhoto({"id":7203008,"src":"Pilot_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_7203008.html","width":130,"caption":"Pilot","height":130});
															thumbnails[7203011] = clik.newPhoto({"id":7203011,"src":"Underneath_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_7203011.html","width":130,"caption":"Underneath","height":129});
															thumbnails[7203017] = clik.newPhoto({"id":7203017,"src":"whoknows_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_7203017.html","width":130,"caption":"Who Knows What Will Happen When The Sun Goes Down","height":131});
															thumbnails[7508360] = clik.newPhoto({"id":7508360,"src":"lifeusedto_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_7508360.html","width":130,"caption":"Life Used To Be So Easy","height":130});
															thumbnails[7508367] = clik.newPhoto({"id":7508367,"src":"tabs_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_7508367.html","width":130,"caption":"Tabs","height":129});
															thumbnails[7508375] = clik.newPhoto({"id":7508375,"src":"perch_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_7508375.html","width":130,"caption":"Perch","height":132});
															thumbnails[7508382] = clik.newPhoto({"id":7508382,"src":"jaipur_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_7508382.html","width":130,"caption":"Jaipur","height":128});
															thumbnails[7508385] = clik.newPhoto({"id":7508385,"src":"nightsee_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_7508385.html","width":130,"caption":"Nightsee","height":128});
															thumbnails[7508393] = clik.newPhoto({"id":7508393,"src":"bulb_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_7508393.html","width":130,"caption":"Bulb","height":103});
															thumbnails[7508403] = clik.newPhoto({"id":7508403,"src":"burgh_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_7508403.html","width":130,"caption":"Burgh","height":115});
															thumbnails[7508407] = clik.newPhoto({"id":7508407,"src":"spotlight_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_7508407.html","width":130,"caption":"Spotlight","height":107});
															thumbnails[7508416] = clik.newPhoto({"id":7508416,"src":"tip_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_7508416.html","width":130,"caption":"Tip","height":111});
															thumbnails[8149466] = clik.newPhoto({"id":8149466,"src":"everestweb_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_8149466.html","width":130,"caption":"Everest","height":102});
															thumbnails[8149471] = clik.newPhoto({"id":8149471,"src":"standfast_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_8149471.html","width":130,"caption":"Standfast Point","height":172});
															thumbnails[8149480] = clik.newPhoto({"id":8149480,"src":"fairisle_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_8149480.html","width":130,"caption":"Fair Isle","height":98});
															thumbnails[8149482] = clik.newPhoto({"id":8149482,"src":"marloesweb_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_8149482.html","width":130,"caption":"Marloes","height":107});
															thumbnails[8149490] = clik.newPhoto({"id":8149490,"src":"sliochmaree_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_8149490.html","width":130,"caption":"Slioch and Loch Maree","height":103});
															thumbnails[8149495] = clik.newPhoto({"id":8149495,"src":"westdale_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_8149495.html","width":130,"caption":"West Dale","height":99});
															thumbnails[8149500] = clik.newPhoto({"id":8149500,"src":"worbarrowweb_thumb.jpg","galleries_id":128390,"server_id":18,"link":"photo_8149500.html","width":130,"caption":"Worbarrow Bay","height":102});
															thumbnails[6552855] = clik.newPhoto({"id":6552855,"src":"animalprint1_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_6552855.html","width":130,"caption":"Animal Print","height":130});
															thumbnails[6552622] = clik.newPhoto({"id":6552622,"src":"blueburger_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_6552622.html","width":130,"caption":"Blue Burger","height":129});
															thumbnails[6552925] = clik.newPhoto({"id":6552925,"src":"sunnyside_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_6552925.html","width":130,"caption":"Sunnyside","height":129});
															thumbnails[6552957] = clik.newPhoto({"id":6552957,"src":"overasea_thumb.jpg","galleries_id":37402,"server_id":18,"link":"photo_6552957.html","width":130,"caption":"Over A Sea","height":129});
															thumbnails[6552960] = clik.newPhoto({"id":6552960,"src":"lastboat_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_6552960.html","width":130,"caption":"Last Boat","height":130});
															thumbnails[6552965] = clik.newPhoto({"id":6552965,"src":"underlyingdusk_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_6552965.html","width":130,"caption":"Underlying Dusk","height":128});
															thumbnails[6552969] = clik.newPhoto({"id":6552969,"src":"cruesetimemayreau_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_6552969.html","width":130,"caption":"Cruisetime Mayreau","height":130});
															thumbnails[6552976] = clik.newPhoto({"id":6552976,"src":"sunbleached_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_6552976.html","width":130,"caption":"Sunbleached","height":131});
															thumbnails[6552979] = clik.newPhoto({"id":6552979,"src":"breakingwave_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_6552979.html","width":130,"caption":"Breaking Wave","height":130});
															thumbnails[1690915] = clik.newPhoto({"id":1690915,"src":"picnic_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_1690915.html","width":130,"caption":"Picnic","height":120});
															thumbnails[6552983] = clik.newPhoto({"id":6552983,"src":"midnightbeach_thumb.jpg","galleries_id":56494,"server_id":18,"link":"photo_6552983.html","width":130,"caption":"Midnight Beach","height":133});
															thumbnails[1690914] = clik.newPhoto({"id":1690914,"src":"diy_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_1690914.html","width":130,"caption":"DIY","height":132});
															thumbnails[1690918] = clik.newPhoto({"id":1690918,"src":"spiderunderneath_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_1690918.html","width":130,"caption":"A Spider Underneath<br>\r\nNo longer available","height":131});
															thumbnails[1690919] = clik.newPhoto({"id":1690919,"src":"springtime_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_1690919.html","width":130,"caption":"Springtime","height":128});
															thumbnails[1690921] = clik.newPhoto({"id":1690921,"src":"waterfall_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_1690921.html","width":130,"caption":"Waterfall","height":126});
															thumbnails[1690922] = clik.newPhoto({"id":1690922,"src":"woodys_thumb.jpg","galleries_id":113852,"server_id":18,"link":"photo_1690922.html","width":130,"caption":"Woody's<br>\r\n","height":112});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[128390] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Recent Paintings","link":"gallery_128390.html","maxRecords":0.0,"photoIDs":[7508360.0,7508367.0,7508382.0,7508393.0,7508403.0,7508407.0,7508416.0,8149466.0,8149471.0,8149480.0,8149482.0,8149490.0,8149495.0,8149500.0],"skipIndex":0,"section_code":"gallery","featured_images":"8149500,8149495,8149490,8149482,8149480,8149471,8149466,7508416,7508407,7508403","id":128390,"singleSection":false});				  						galleries[56494] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Inspired by the Caribbean","link":"gallery_56494.html","maxRecords":0.0,"photoIDs":[948950.0,985425.0,3388984.0,3388989.0,3598552.0,3598558.0,3598560.0,3598563.0,4949357.0,4949528.0,4949793.0,7203003.0,7203005.0,7203011.0,7203017.0,6552925.0,6552960.0,6552965.0,6552969.0,6552976.0,6552979.0,6552983.0],"skipIndex":0,"section_code":"gallery","featured_images":"3388984,948950","id":56494,"singleSection":false});				  						galleries[37402] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Paintings","link":"gallery_37402.html","maxRecords":0.0,"photoIDs":[474208.0,561373.0,733334.0,948944.0,948953.0,1211801.0,1211802.0,1914586.0,1914592.0,1914602.0,2265310.0,2265312.0,3129783.0,7202997.0,7202999.0,7203008.0,7508375.0,7508385.0,6552855.0,6552622.0,6552957.0],"skipIndex":0,"section_code":"gallery","featured_images":"2265310,1914602","id":37402,"singleSection":false});				  						galleries[113852] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Large Paintings (no longer available)","link":"gallery_113852.html","maxRecords":0.0,"photoIDs":[1914607.0,2021501.0,2390585.0,1690915.0,1690914.0,1690918.0,1690919.0,1690921.0,1690922.0],"skipIndex":0,"section_code":"gallery","featured_images":"2390585,2021501,1914607,1690922,1690921,1690919,1690918,1690915,1690914","id":113852,"singleSection":false});				  						galleries[135585] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Prints","link":"gallery_135585.html","maxRecords":0.0,"photoIDs":[2022502.0],"skipIndex":0,"section_code":"gallery","featured_images":2022502.0,"id":135585,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7508416,7508407,7508403,7508393,7508385,7508382,7508375,7508367,7508360,3129783,2265310,948944,6552957,6552976';
imageSets[2] = '3388984,2265310,2022502,1914602,948950';
imageSets[3] = '8149500,8149495,8149490,8149482,8149480,8149471,8149466,7508416,7508407,7508403,7508393,7508385,7508382,7508375,7508367,7508360,7203017,7203011,7203008,7203005,7203003,7202999,7202997,6552983,6552979,6552976,6552969,6552965,6552960,6552957,6552925,6552855,6552622,4949793,4949528,4949357,3598563,3598560,3598558,3598552,3388989,3388984,3129783,2390585,2265312,2265310,2265244,2022502,2021501,1914607';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/niamhcollins/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/niamhcollins/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 = 'Niamh Collins - Paintings : ' + 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> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="niamhcollinsjackman@blueyonder.co.uk">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="niamhcollinsjackman@blueyonder.co.uk">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

