window.thumbnails = new Object();
												thumbnails[5706567] = new thumbnail(5706567,'130286','Arndale Springs, 2010, Acrylic on Board, 8\" x 8\"','113_Nick_Johnson_Arndale_Springs_2010004_thumb.jpg',130, 131,15,'photo_5706567.html');
												thumbnails[1947310] = new thumbnail(1947310,'219224','Looking towards Barningham Moor from Whorlton, 2007, Acrylic on Board, 12\" x 12\"  *SOLD*','46_thumb._Looking_towards_Barningham_Moor_from_Whorlton_2007021.jpg',130, 133,15,'photo_1947310.html');
												thumbnails[3608297] = new thumbnail(3608297,'219224','Cloud Shadows, Arkengarthdale, Acrylic on Board, 8\" x 14\"  *SOLD*','7NJohnson_Cloud_Shadows_Arkengarthdale0171_thumb.jpg',130, 74,15,'photo_3608297.html');
												thumbnails[5706574] = new thumbnail(5706574,'130286','Arndale, 2010, Acrylic on Board, 6\" x 6\"','112Nick_Johnson_Arndale_2010003_thumb.jpg',130, 128,15,'photo_5706574.html');
												thumbnails[1947032] = new thumbnail(1947032,'130186','Heather, Fields, Trees, Barningham Moor, 2007, Acrylic on Board, 6\" x 6\"','64_thumb._Heather,_Fields,_Trees_Barningham_Moor_2007038.jpg',130, 129,15,'photo_1947032.html');
												thumbnails[1947080] = new thumbnail(1947080,'130186','Fields and Trees, Teesdale, 2007, Acrylic on Board, 6\" x 6\"','39_thumb._Fields_and_Trees,_Teesdale_2007016.jpg',130, 132,15,'photo_1947080.html');
												thumbnails[1947088] = new thumbnail(1947088,'219224','Teesdale, near Barningham, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','49_thumb._Teesdale,_Near_Barningham_2007024.jpg',130, 130,15,'photo_1947088.html');
												thumbnails[3605246] = new thumbnail(3605246,'130286','Swaledale from Peat Moor Green, Arkengarthdale, May, Acrylic on paper, 8” x 20”  *SOLD*','12NJohnson_Swaledale_from_Peat_Moor_Green_Arkengarthdale_May00412_thumb.jpg',130, 50,15,'photo_3605246.html');
												thumbnails[6277457] = new thumbnail(6277457,'348734','Swaledale from Kisdon 2010<br>\r\nWatercolour on paper','Nick_Johnson_Swaledale__from_Kisdon_June__2010_thumb.jpg',130, 86,15,'photo_6277457.html');
												thumbnails[6277570] = new thumbnail(6277570,'130286','Arkengarthdale, Looking towards Booze from Fremington Edge, 2010, Acrylic on Board','Nick_Johnson_Arkengarthdale_Looking_Towards_Booze_from_Fremington_Edge_thumb.jpg',130, 65,15,'photo_6277570.html');
												thumbnails[1947306] = new thumbnail(1947306,'130186','Teesdale Way at Highcliffe Waters, 2007, Acrylic on Board, 6\" x 6\"','18_thumb._Teesdale_Way_at_Highcliffe_Waters_2007005.jpg',130, 133,15,'photo_1947306.html');
												thumbnails[3605252] = new thumbnail(3605252,'130286','Swaledale from Marrick Moor, April, Acrylic on paper, 8\"\' x 20\"','13NJohnson_Swaledale_from_Marrick_Moor_April0051_thumb.jpg',130, 50,15,'photo_3605252.html');
												thumbnails[6277523] = new thumbnail(6277523,'348734','Swaledale between Kisdon and Black Hill, Watercolour on Paper','Nick_Johnson_Swaledale__between_Kisdon_and__Black_Hill_thumb.jpg',130, 43,15,'photo_6277523.html');
												thumbnails[1962397] = new thumbnail(1962397,'219224','Arkengarthdale, Reeth Low Moor, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','Arkengarthdale_Reeth_Low_Moor,_2007_prof001_thumb.jpg',130, 130,15,'photo_1962397.html');
												thumbnails[5706581] = new thumbnail(5706581,'130186','Teesdale Way, Acrylic on Board','110Nick_Johnson_Teesdale_Way001_thumb.jpg',130, 65,15,'photo_5706581.html');
												thumbnails[1947040] = new thumbnail(1947040,'219224','Howgill Fells, Winter, 2007, Acryic on Board, 6\" x 6\"<br>\r\n*SOLD*','60_thumb._Howgill_Fells_Winter_2007034.jpg',130, 135,15,'photo_1947040.html');
												thumbnails[1947309] = new thumbnail(1947309,'130186','Looking towards the Stang near Mortham Wood, Teesdale, 2007, Acrylic on Board, 6\" x 6\"','43_thumb._Looking_towards_the_Stang_near_Mortham_Wood,_Teesdale_2007018.jpg',130, 133,15,'photo_1947309.html');
												thumbnails[3605265] = new thumbnail(3605265,'130286','Swaledale from Peat Moor Green, Arkengarthdale, November, Acrylic on Paper, 8\" x 20\"  *SOLD*','11NJohnson_Swaledale_from_Peat_Moor_Green_Arkengarthdale_November0031_thumb.jpg',130, 50,15,'photo_3605265.html');
												thumbnails[6277547] = new thumbnail(6277547,'348734','Approaching Swinner Gill, Watercolour on Paper','Nick_Johnson_Approaching_Swinner_Gill_thumb.jpg',130, 88,15,'photo_6277547.html');
												thumbnails[1947090] = new thumbnail(1947090,'219224','Mickle Fell from Barningham Moor, 2007, Acrylic on Board, 6\" x 6\"  *SOLD*','48_thumb._Mickle_Fell_from_Barningham_Moor_2007023.jpg',130, 133,15,'photo_1947090.html');
												thumbnails[1947092] = new thumbnail(1947092,'219224','Swaledale, Reeth Low Moor, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','45_thumb._Swaledale_Reeth_Low_Moor_2007020.jpg',130, 130,15,'photo_1947092.html');
												thumbnails[3605270] = new thumbnail(3605270,'130287','Swaledale from Peat Moor Green, Mixed Media on paper, 8\" x 20\"','19_Swaledale_from_Peat_Moor_Green0111_thumb.jpg',130, 51,15,'photo_3605270.html');
												thumbnails[6277556] = new thumbnail(6277556,'348734','Arkengarthdale from Fremington Edge, Watercolour on Paper','Nick_Johnson_Arkengarthdale_from_Fremington_Edge_thumb.jpg',130, 85,15,'photo_6277556.html');
												thumbnails[1946983] = new thumbnail(1946983,'130186','Sunlight over Barningham Moor, 2008, Acrylic on Board, 6\" x 6\"','74_thumb._Sunlight_over_Barningham_Moor _2008046.jpg',130, 131,15,'photo_1946983.html');
												thumbnails[1947049] = new thumbnail(1947049,'130186','Looking away from Cautley Spout, 2007, Acrylic on Board, 6\" x 6\"','61_thumb._Looking_away_from_Cautley_Spout2007035.jpg',130, 130,15,'photo_1947049.html');
												thumbnails[3605279] = new thumbnail(3605279,'130287','Ullswater from Pooley Bridge, June, Mixed Media on paper, 8\" x 20\"','18NJohnson_Ullswater_from_Pooley_Bridge_June0101_thumb.jpg',130, 52,15,'photo_3605279.html');
												thumbnails[5706406] = new thumbnail(5706406,'130287','Fields and Trees near Barningham Moor, Pastel on Paper','81_Fields_and_Trees_near_Barningham_Moor053_thumb.jpg',130, 113,15,'photo_5706406.html');
												thumbnails[6277562] = new thumbnail(6277562,'348734','Fremington Edge, 2010, Watercolour on Paper','Nick_Johnson_Fremington_Edge_thumb.jpg',130, 86,15,'photo_6277562.html');
												thumbnails[1947051] = new thumbnail(1947051,'130186','Cautley Spout, 2007, Acrylic on Board, 6\" x 6\"','58_thumb._Cautley_Spout_2007032.jpg',130, 129,15,'photo_1947051.html');
												thumbnails[1947294] = new thumbnail(1947294,'219224','View from Brignall Church, 2007, Acylic on Board, 6\" x 6\"<br>\r\n*SOLD*','34_thumb._View_from_Brignall_Church_2007013.jpg',130, 134,15,'photo_1947294.html');
												thumbnails[1947324] = new thumbnail(1947324,'219224','Teesdale, Winter, 2006, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','12_thumb._Teesdale,_Winter_2006001.jpg',130, 129,15,'photo_1947324.html');
												thumbnails[3605657] = new thumbnail(3605657,'130286','Little Punchard Gill no.1, Arkengarthdale, Acrylic on Board, 8\" x 14\"<br>\r\n*SOLD*','14NJohnson_Little_Punchard_Gill_no_1_Arkengarthdale0061_thumb.jpg',130, 72,15,'photo_3605657.html');
												thumbnails[3619882] = new thumbnail(3619882,'130186','Mill Bottom, Swaledale, Acrylic on Board, 6\" x 6\"','Nick_Johnson_Mill_Bottom_Swaledale001_thumb.jpg',130, 128,15,'photo_3619882.html');
												thumbnails[5706429] = new thumbnail(5706429,'130287','River Tees near Whorlton Bridge, Pastel on Paper','82_River_Tees_Whorlton_Bridge_2008054_thumb.jpg',130, 97,15,'photo_5706429.html');
												thumbnails[1947013] = new thumbnail(1947013,'219224','October Clouds, Barningham Moor, 2007, Acrylic on Board, 8\" x 8\"<br>\r\n*SOLD*','69_thumb._October_Clouds,_Barningham_Moor_2007041.jpg',130, 128,15,'photo_1947013.html');
												thumbnails[1947297] = new thumbnail(1947297,'219224','Spring Fields, Teesdale, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','36_thumb._Spring_Fields_Teesdale_2007014.jpg',130, 131,15,'photo_1947297.html');
												thumbnails[1963203] = new thumbnail(1963203,'219224','Teesdale Way near Whorlton, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','19_thumb._Teesdale_Way_Near_Whorlton_2007006.jpg',130, 128,15,'photo_1963203.html');
												thumbnails[3619893] = new thumbnail(3619893,'219224','Rawlinson Nab, Windermere, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','Nick_Johnson_Rawlinson_Nab_Windermere004_thumb.jpg',130, 132,15,'photo_3619893.html');
												thumbnails[5706435] = new thumbnail(5706435,'130287','Ullswater, Mixed Media','Nick_Johnson_Ullswater005_thumb.jpg',130, 72,15,'photo_5706435.html');
												thumbnails[1946997] = new thumbnail(1946997,'219224','Fells Near Castlerigg, 2008, Acrylic  on   Board, 8\" x 8\"<br>\r\n*SOLD*','78_thumb._Fells_Near_Castlerigg_2008050.jpg',130, 129,15,'photo_1946997.html');
												thumbnails[1947302] = new thumbnail(1947302,'130186','Teesdale Way near Whorlton, 2007, Acrylic on Board, 6\" x 6\"','22_thumb._Teesdale_Way_Near_Whorlton_2007_007.jpg',130, 133,15,'photo_1947302.html');
												thumbnails[1963207] = new thumbnail(1963207,'219224','Arkengarthdale, Looking towards Reeth Low Moor, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','1_thumb._Arkengarthdale_looking_towards_Reeth_Low_Moor_2007001.jpg',130, 130,15,'photo_1963207.html');
												thumbnails[2586563] = new thumbnail(2586563,'130286','Arkengarthdale, near Fremington Edge, Acrylic on Paper, 2008<br>\r\n*SOLD*','Nick_Johnson_Arkengarthdale_near_Fremington_Edge001_thumb.jpg',130, 101,15,'photo_2586563.html');
												thumbnails[5706447] = new thumbnail(5706447,'348734','Little Punchard Gill, no. 2, Arkengarthdale, Mixed Media','15NJohnson_Little_Punchard_Gill_no2_Arkengarthdale007_thumb.jpg',130, 96,15,'photo_5706447.html');
												thumbnails[1947052] = new thumbnail(1947052,'130186','Teesdale from Barningham Moor, 2007, Acrylic on Board, 6\" x 6\"','52_thumb._Teesdale_from_Barningham_Moor_2007026.jpg',130, 130,15,'photo_1947052.html');
												thumbnails[1947003] = new thumbnail(1947003,'130186','Approaching Arkengarthdale, 2008, Acrylic on Board, 8\" x 8\"','5NJohnson_Approaching_Arkengarthdale01512_thumb.jpg',130, 131,15,'photo_1947003.html');
												thumbnails[1947070] = new thumbnail(1947070,'219224','Reeth Low Moor, Calver Hill from Great Pinseat, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','57_thumb._Reeth_Low_Moor,_Calver_Hill_from_Great_Pinseat_2007031.jpg',130, 129,15,'photo_1947070.html');
												thumbnails[5706451] = new thumbnail(5706451,'130287','Bowderdale, Howgill Fells, Mixed Media','16NJohnson_Bowderdale_Howgill_Fells008_thumb.jpg',130, 95,15,'photo_5706451.html');
												thumbnails[5706456] = new thumbnail(5706456,'130287','River Tees near Meeting of the Water, Mixed Media','21NJohnson_River_Tees_near_Meeting_of_the_Waters002_thumb.jpg',130, 86,15,'photo_5706456.html');
												thumbnails[5706585] = new thumbnail(5706585,'130186','Holwick Scars, Acrylic on Board','89Nick_Johnson_Holwick_Scars_April_08005_thumb.jpg',130, 130,15,'photo_5706585.html');
												thumbnails[1947005] = new thumbnail(1947005,'219224','Helvellyn, 2008, Acrylic on Board, 8\" x 8\"<br>\r\n*SOLD*','76_thumb._Helvelyn_2008048.jpg',130, 130,15,'photo_1947005.html');
												thumbnails[1947073] = new thumbnail(1947073,'219224','Swaledale, Looking over Forfield Rake, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','55_thumb._Swaledale,_Looking_over_Forefield_Rake_from_Great_Pinseat_2007029.jpg',130, 131,15,'photo_1947073.html');
												thumbnails[1947307] = new thumbnail(1947307,'219224','Looking Towards Teesdale from Brignall Church, 2007, Acrylic on Board, 6\" x 6\"<br>\r\n*SOLD*','31_thumb._Looking_towards_Teesdale_from_Brignall_Church_2007011.jpg',130, 133,15,'photo_1947307.html');
												thumbnails[1947313] = new thumbnail(1947313,'130186','Meeting of the Waters, No.1, 2007, Acrylic on Board, 6\" x 6\"','27_thumb._Meeting_of_the_Waters_No1_2007009.jpg',130, 130,15,'photo_1947313.html');
												thumbnails[3608293] = new thumbnail(3608293,'130286','Gunnerside Gill, Swaledale, Acrylic on Board, 8\" x 8\"','9NJohnson_Gunnerside_Gill_Swaledale01912_thumb.jpg',130, 130,15,'photo_3608293.html');
												thumbnails[5706458] = new thumbnail(5706458,'130287','Osmeril Gill, Barningham Moor, Mixed Media','22NJohnson_Osmeril_Gill_Barningham_Moor003_thumb.jpg',130, 85,15,'photo_5706458.html');
												thumbnails[5706592] = new thumbnail(5706592,'219224','Near Selaby Hall, Teesdale, Acrylic on Board *SOLD*','90Nick_Johnson_Near_Selaby_Hall_Teesdale_May_08SOLD006_thumb.jpg',130, 128,15,'photo_5706592.html');
												thumbnails[1947075] = new thumbnail(1947075,'130186','Barningham Moor, 2007, Acrylic on Board, 6\" x 6\"','50_thumb._Barningham_Moor_2007025.jpg',130, 130,15,'photo_1947075.html');
												thumbnails[3608296] = new thumbnail(3608296,'130286','Ingleborough from Burn Moor, Acrylic on Board, 8\" x 8\"','17NJohnson_Ingleborough_from_Burn_Moor00912_thumb.jpg',130, 130,15,'photo_3608296.html');
												thumbnails[5706464] = new thumbnail(5706464,'130287','View from Barningham Moor, Mixed Media','23NJohnson_View_from_Barningham_Moor004_thumb.jpg',130, 85,15,'photo_5706464.html');
												thumbnails[1945995] = new thumbnail(1945995,'219224','Down to Arkengarthdale, 2008, Acrylic on Board, 8 \" x 8\"<br>\r\n*SOLD*','6NJohnson_Down_to_Arkengarthdale0161_thumb.jpg',130, 129,15,'photo_1945995.html');
												thumbnails[1946979] = new thumbnail(1946979,'130186','Fells Near Kentmere, 2008, Acrylic on Board, 24\' x 24\"','75_thumb._Fells_near_Kentmere_2008047.jpg',130, 131,15,'photo_1946979.html');
												thumbnails[3638452] = new thumbnail(3638452,'130286','Peat Moor Green, Arkengarthdale, 2008, Acrylic on Board, 8\" x 14\"','Nick_Johnson_Peat_Moor_Green_Arkengarthdale001_thumb.jpg',130, 73,15,'photo_3638452.html');
												thumbnails[5706578] = new thumbnail(5706578,'130286','River Swale, 2010, Acrylic on Board, 8\" x 8\"','111Nick_Johnson_River_Swale002_thumb.jpg',130, 129,15,'photo_5706578.html');
												thumbnails[3605768] = new thumbnail(3605768,'348734','Burnt Heather, Barningham Moor, Watercolour, 6\" x 9\"','10NJohnson_Burnt_Heather_Barningham_Moor002_thumb.jpg',130, 199,15,'photo_3605768.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[130286] = new gallery(130286,'5706567','New Work','gallery',[5706567,5706574,3605246,6277570,3605252,3605265,3605657,2586563,3608293,3608296,3638452,5706578],0, 0, '', 'gallery_130286.html',0,0);
				  					galleries[130186] = new gallery(130186,'3619882,1947302,1947003','Gallery 2','gallery',[1947032,1947080,1947306,5706581,1947309,1946983,1947049,1947051,3619882,1947302,1947052,1947003,5706585,1947313,1947075,1946979],0, 0, '', 'gallery_130186.html',0,0);
				  					galleries[348734] = new gallery(348734,'6277457','Watercolours','gallery',[6277457,6277523,6277547,6277556,6277562,5706447,3605768],0, 0, '', 'gallery_348734.html',0,0);
				  					galleries[130287] = new gallery(130287,'3605279','Drawings','gallery',[3605270,3605279,5706406,5706429,5706435,5706451,5706456,5706458,5706464],0, 0, '', 'gallery_130287.html',0,0);
				  					galleries[219224] = new gallery(219224,'1945995','Archive','gallery',[1947310,3608297,1947088,1962397,1947040,1947090,1947092,1947294,1947324,1947013,1947297,1963203,3619893,1946997,1963207,1947070,1947005,1947073,1947307,5706592,1945995],0, 0, '', 'gallery_219224.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6277523,6277457,5706578,5706574,5706567,3638452,3608296,3608293,3605657,3605279,3605265,3605252,3605246,2586563,1947003';
imageSets[2] = '6277457,5706567,3619882,3605279,1947302,1947003,1945995';
imageSets[3] = '6277570,6277562,6277556,6277547,6277523,6277457,5706592,5706585,5706581,5706578,5706574,5706567,5706464,5706458,5706456,5706451,5706447,5706435,5706429,5706406,3638452,3619893,3619882,3608297,3608296,3608293,3605768,3605657,3605279,3605270,3605265,3605252,3605246,2586563,1963207,1963203,1962397,1947324,1947313,1947310,1947309,1947307,1947306,1947302,1947297,1947294,1947092,1947090,1947088,1947080';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/nickjohnsonart/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/nickjohnsonart/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 = 'Nick Johnson: ' + 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 = 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;
	}
}

			

