window.thumbnails = new Object();
												thumbnails[4085256] = new thumbnail(4085256,'70511','Tractor on beach','081104CLR1010_edited-2_thumb.jpg',130, 97,1,'photo_4085256.html');
												thumbnails[4085286] = new thumbnail(4085286,'70511','Alexandra','HJWD1050118_edited-2_thumb.jpg',97, 130,1,'photo_4085286.html');
												thumbnails[4085240] = new thumbnail(4085240,'70511','Spring Fields','HJWD1040816_edited-2_thumb.jpg',98, 130,1,'photo_4085240.html');
												thumbnails[4085248] = new thumbnail(4085248,'70511','Spring rainbow','HJWD1040813_edited-2_thumb.jpg',103, 130,1,'photo_4085248.html');
												thumbnails[4085939] = new thumbnail(4085939,'70511','Winter stream','220509CLR4002_edited-3_thumb.jpg',130, 102,1,'photo_4085939.html');
												thumbnails[4085251] = new thumbnail(4085251,'70511','Long-tailed tit','HJWD1040359_edited-2_thumb.jpg',102, 130,1,'photo_4085251.html');
												thumbnails[4085202] = new thumbnail(4085202,'253268','Autumn Windfall','081104CLR5007_edited-1_thumb.jpg',130, 107,1,'photo_4085202.html');
												thumbnails[4085224] = new thumbnail(4085224,'70511','Moors Stream','081104CLR4001_copy_edited-1_thumb.jpg',130, 108,1,'photo_4085224.html');
												thumbnails[2354044] = new thumbnail(2354044,'70181','Seaweed and sand patterns','HJW6600296_thumb.jpg',130, 130,1,'photo_2354044.html');
												thumbnails[2354208] = new thumbnail(2354208,'70181','Sand patterns','HJW6600306_thumb.jpg',130, 130,1,'photo_2354208.html');
												thumbnails[926214] = new thumbnail(926214,'70184','Our daughter, Alexandra ','HJWD10200901_thumb.jpg',130, 173,1,'photo_926214.html');
												thumbnails[923432] = new thumbnail(923432,'70181','Moors Snowscene (2) ','HJW6600290_thumb.jpg',130, 130,1,'photo_923432.html');
												thumbnails[923435] = new thumbnail(923435,'70181','Moors Snowscene (1)','HJW6600285_thumb.jpg',130, 130,1,'photo_923435.html');
												thumbnails[924966] = new thumbnail(924966,'70181','Dead Moles','HJW6600294_thumb.jpg',130, 130,1,'photo_924966.html');
												thumbnails[924964] = new thumbnail(924964,'253268','Sand Patterns','HJW6600265_thumb.jpg',130, 130,1,'photo_924964.html');
												thumbnails[1094215] = new thumbnail(1094215,'80660','Steps in the Sea Wall','HJW6600269_thumb.jpg',130, 130,1,'photo_1094215.html');
												thumbnails[1108090] = new thumbnail(1108090,'80660','Fisherman\'s hut','HJW66-00232_thumb.jpg',130, 130,1,'photo_1108090.html');
												thumbnails[1108092] = new thumbnail(1108092,'80660','Fisherman\'s hut detail','HJW66-00233_thumb.jpg',130, 130,1,'photo_1108092.html');
												thumbnails[923387] = new thumbnail(923387,'253268','Tree silhouettes and reflections','HJW66-00024_thumb.jpg',130, 130,1,'photo_923387.html');
												thumbnails[923414] = new thumbnail(923414,'70180','Pebbles','HJW66-00113_thumb.jpg',130, 130,1,'photo_923414.html');
												thumbnails[923428] = new thumbnail(923428,'70181','Gnarled hawthorn','HJW66-00193_thumb.jpg',130, 130,1,'photo_923428.html');
												thumbnails[923430] = new thumbnail(923430,'70181','Gate latch','HJW66-001841_thumb.jpg',130, 130,1,'photo_923430.html');
												thumbnails[923450] = new thumbnail(923450,'70030','Icy Stream','HJW66-00017_thumb.jpg',130, 130,1,'photo_923450.html');
												thumbnails[923452] = new thumbnail(923452,'253268','Frosty Sunrise','HJW66-00003_thumb.jpg',130, 130,1,'photo_923452.html');
												thumbnails[923524] = new thumbnail(923524,'70182','Primrose (<em>primula vulgaris</em>)','HJW66-00088_thumb.jpg',130, 130,1,'photo_923524.html');
												thumbnails[923545] = new thumbnail(923545,'253268','Sunrise and tree silhouettes','HJW66-00075_thumb.jpg',130, 130,1,'photo_923545.html');
												thumbnails[923547] = new thumbnail(923547,'70184','Portrait of the photographer','TJWD1010336_thumb.jpg',130, 98,1,'photo_923547.html');
												thumbnails[924914] = new thumbnail(924914,'70030','Snowy Lane','HJW66-00007_thumb.jpg',130, 130,1,'photo_924914.html');
												thumbnails[924929] = new thumbnail(924929,'70030','Winter storm over Robin Hoods Bay','HJW66-00031_thumb.jpg',130, 130,1,'photo_924929.html');
												thumbnails[924930] = new thumbnail(924930,'70030','Spring wood with ransoms','HJW66-00036_thumb.jpg',130, 130,1,'photo_924930.html');
												thumbnails[924932] = new thumbnail(924932,'70030','Frosty morning river with geese','HJW66-00009_thumb.jpg',130, 130,1,'photo_924932.html');
												thumbnails[924933] = new thumbnail(924933,'70030','Misty morning beach with dog walker','HJW66-00062_thumb.jpg',130, 130,1,'photo_924933.html');
												thumbnails[924934] = new thumbnail(924934,'70030','Sunrise over old harbour (1) ','HJW66-00093_thumb.jpg',130, 130,1,'photo_924934.html');
												thumbnails[924935] = new thumbnail(924935,'253268','Sunrise over old harbour (2) ','HJW6600094cropped_edited-1_thumb.jpg',130, 90,1,'photo_924935.html');
												thumbnails[924938] = new thumbnail(924938,'70030','Storm clouds over Staithes ','HJW66-00108_thumb.jpg',130, 130,1,'photo_924938.html');
												thumbnails[924939] = new thumbnail(924939,'70180','Autumn stream','HJW66-00086_thumb.jpg',130, 130,1,'photo_924939.html');
												thumbnails[924940] = new thumbnail(924940,'70030','Tree silhouettes','HJW66-00160_thumb.jpg',130, 130,1,'photo_924940.html');
												thumbnails[924941] = new thumbnail(924941,'70030','Autumn woods (1)','HJW66-00165_thumb.jpg',130, 130,1,'photo_924941.html');
												thumbnails[924942] = new thumbnail(924942,'70030','Autumn woods (2)','HJW66-00167_thumb.jpg',130, 130,1,'photo_924942.html');
												thumbnails[924945] = new thumbnail(924945,'70180','Frosty cobweb','HJW66-00170_thumb.jpg',130, 130,1,'photo_924945.html');
												thumbnails[924947] = new thumbnail(924947,'70181','Church door handle','HJW66-00183_thumb.jpg',130, 130,1,'photo_924947.html');
												thumbnails[924948] = new thumbnail(924948,'70030','Sheep at sunrise','HJW66-00205_thumb.jpg',130, 130,1,'photo_924948.html');
												thumbnails[924950] = new thumbnail(924950,'253268','Sunrise over Kettleness Nab','HJW66-00210_thumb.jpg',130, 130,1,'photo_924950.html');
												thumbnails[924968] = new thumbnail(924968,'70180','Grass against blue sky','HJW66-00121_thumb.jpg',130, 130,1,'photo_924968.html');
												thumbnails[924971] = new thumbnail(924971,'70180','Autumn windfall','HJW66-00149_thumb.jpg',130, 130,1,'photo_924971.html');
												thumbnails[924975] = new thumbnail(924975,'70181','Moors stream and waterfall','HJW66-00216_thumb.jpg',130, 130,1,'photo_924975.html');
												thumbnails[925688] = new thumbnail(925688,'70180','Green rocks','HJW66-00095_thumb.jpg',130, 130,1,'photo_925688.html');
												thumbnails[925838] = new thumbnail(925838,'70030','Morning river','HJW66-00161_thumb.jpg',130, 130,1,'photo_925838.html');
												thumbnails[925847] = new thumbnail(925847,'253268','Boulders and Surf','HJW66-00213_thumb.jpg',130, 130,1,'photo_925847.html');
												thumbnails[925856] = new thumbnail(925856,'70181','Winter Storm','HJW66-00227_thumb.jpg',130, 130,1,'photo_925856.html');
												thumbnails[925870] = new thumbnail(925870,'70181','Winter Storm 2','HJW66-00230_thumb.jpg',130, 130,1,'photo_925870.html');
												thumbnails[926960] = new thumbnail(926960,'70181','St Hilda\'s Well','HJW66-00181_thumb.jpg',130, 130,1,'photo_926960.html');
												thumbnails[2354076] = new thumbnail(2354076,'70180','Gnarled wood - intertwined','HJW66002381_thumb.jpg',130, 130,1,'photo_2354076.html');
												thumbnails[4292000] = new thumbnail(4292000,'253268','Summer Fields','080815CLR1009_edited-2_thumb.jpg',107, 130,1,'photo_4292000.html');
												thumbnails[4292003] = new thumbnail(4292003,'70511','Summer Storm','081104CLR1008_edited-4_thumb.jpg',106, 130,1,'photo_4292003.html');
												thumbnails[4292005] = new thumbnail(4292005,'253268','Eller Beck','081104CLR3006_edited-4_thumb.jpg',130, 107,1,'photo_4292005.html');
												thumbnails[4292008] = new thumbnail(4292008,'253268','Misty Sunrise','081104CLR4009_edited-2_thumb.jpg',130, 107,1,'photo_4292008.html');
												thumbnails[4292009] = new thumbnail(4292009,'253268','Early Autumn Woods','081104CLR5003_edited-3_thumb.jpg',107, 130,1,'photo_4292009.html');
												thumbnails[4292010] = new thumbnail(4292010,'70511','Tree Stump','220509CLR1003_edited-3_thumb.jpg',130, 108,1,'photo_4292010.html');
												thumbnails[4292011] = new thumbnail(4292011,'70511','Frosty Dawn','220509CLR2004_edited-2_thumb.jpg',108, 130,1,'photo_4292011.html');
												thumbnails[4292014] = new thumbnail(4292014,'253268','Bracken and Bluebells','220509CLR5007_edited-6_thumb.jpg',107, 130,1,'photo_4292014.html');
												thumbnails[4292079] = new thumbnail(4292079,'253268','Groyne','HJW6600263_edited-1_thumb.jpg',130, 130,1,'photo_4292079.html');
												thumbnails[4292104] = new thumbnail(4292104,'253268','Snow and Sheep','220509CLR4005_edited-3_thumb.jpg',130, 108,1,'photo_4292104.html');
												thumbnails[4292013] = new thumbnail(4292013,'253268','Black Beck Ice','220509CLR3007_edited-2_thumb.jpg',107, 130,1,'photo_4292013.html');
												thumbnails[2354154] = new thumbnail(2354154,'70182','Emerging dragonfly (1)','HJWD1020467_thumb.jpg',98, 130,1,'photo_2354154.html');
												thumbnails[2354155] = new thumbnail(2354155,'70182','Emerging dragonfly (2)','HJWD1020472_thumb.jpg',98, 130,1,'photo_2354155.html');
												thumbnails[2354052] = new thumbnail(2354052,'70182','Emerging dragonfly (3)','HJW3500339_thumb.jpg',78, 130,1,'photo_2354052.html');
												thumbnails[923427] = new thumbnail(923427,'70181','Waves','HJWD1010980_thumb.jpg',130, 73,1,'photo_923427.html');
												thumbnails[923406] = new thumbnail(923406,'253268','Hawthorn hedge with mist','HJW35-00070_thumb.jpg',130, 87,1,'photo_923406.html');
												thumbnails[2354055] = new thumbnail(2354055,'70182','Flower spike','HJWD1000944_thumb.jpg',98, 130,1,'photo_2354055.html');
												thumbnails[4292082] = new thumbnail(4292082,'253268','Borrowby Snowscene','HJW1010996_edited-3_thumb.jpg',130, 73,1,'photo_4292082.html');
												thumbnails[923447] = new thumbnail(923447,'253268','Castle Howard across the Great Lake','HJW3500187_edited-5_thumb.jpg',130, 87,1,'photo_923447.html');
												thumbnails[2354152] = new thumbnail(2354152,'70182','Bumble bee on lavendar','HJWD1020446_thumb.jpg',102, 130,1,'photo_2354152.html');
												thumbnails[1157420] = new thumbnail(1157420,'253268','Three ammonites','HJW35-00132_thumb.jpg',130, 88,1,'photo_1157420.html');
												thumbnails[2659298] = new thumbnail(2659298,'253268','Teasel','HJWD2434_edited-3_thumb.jpg',90, 130,1,'photo_2659298.html');
												thumbnails[2659388] = new thumbnail(2659388,'253268','Droplet','HJWD2425_edited-22_thumb.jpg',130, 87,1,'photo_2659388.html');
												thumbnails[923422] = new thumbnail(923422,'253268','Lily','HJWD1020161_thumb.jpg',130, 98,1,'photo_923422.html');
												thumbnails[2354034] = new thumbnail(2354034,'70030','Port Mulgrave pre-dawn light','HJW3500328_thumb.jpg',130, 78,1,'photo_2354034.html');
												thumbnails[4291998] = new thumbnail(4291998,'253268','Cow Parsley','080815BW3005_edited-1_thumb.jpg',130, 130,1,'photo_4291998.html');
												thumbnails[2354184] = new thumbnail(2354184,'70184','Alexandra','HJWD1030044_thumb.jpg',130, 98,1,'photo_2354184.html');
												thumbnails[2354198] = new thumbnail(2354198,'253268','Pebbles in Black and White','HJW66-00113 B&W_thumb.jpg',130, 130,1,'photo_2354198.html');
												thumbnails[924946] = new thumbnail(924946,'253268','Frosty clematis seedhead','HJW6600005_BW_edited-1_thumb.jpg',130, 130,1,'photo_924946.html');
												thumbnails[924972] = new thumbnail(924972,'70030','Storm over mountain track','HJWD1010144_thumb.jpg',98, 130,1,'photo_924972.html');
												thumbnails[923382] = new thumbnail(923382,'70030','Fireworks (1)','HJW35-00023_thumb.jpg',87, 130,1,'photo_923382.html');
												thumbnails[923384] = new thumbnail(923384,'70030','Fireworks (2)','HJW35-00026_thumb.jpg',87, 130,1,'photo_923384.html');
												thumbnails[924965] = new thumbnail(924965,'70030','Distant hills at sunset','HJWD1000767_thumb.jpg',130, 85,1,'photo_924965.html');
												thumbnails[923543] = new thumbnail(923543,'70030','River and wilderness','HJW35-00238_thumb.jpg',130, 78,1,'photo_923543.html');
												thumbnails[923419] = new thumbnail(923419,'70180','Frosty holly','HJW35-00101_thumb.jpg',78, 130,1,'photo_923419.html');
												thumbnails[1094106] = new thumbnail(1094106,'70180','Ferns, algae and rocks','HJW35-00131_thumb.jpg',130, 78,1,'photo_1094106.html');
												thumbnails[925836] = new thumbnail(925836,'70180','Dead wood abstract','HJW35-00146_thumb.jpg',130, 78,1,'photo_925836.html');
												thumbnails[924952] = new thumbnail(924952,'70182','Fungus (1)','HJW66-00162_thumb.jpg',130, 130,1,'photo_924952.html');
												thumbnails[924954] = new thumbnail(924954,'70182','Fungus (2)','HJWD1010337_thumb.jpg',98, 130,1,'photo_924954.html');
												thumbnails[924955] = new thumbnail(924955,'70182','Fungus (3)','HJWD1010769_thumb.jpg',98, 130,1,'photo_924955.html');
												thumbnails[924956] = new thumbnail(924956,'70182','Fungus (4)','HJWD1010765_thumb.jpg',98, 130,1,'photo_924956.html');
												thumbnails[924958] = new thumbnail(924958,'70182','Fungus (5)','HJWD1010537_thumb.jpg',95, 130,1,'photo_924958.html');
												thumbnails[924959] = new thumbnail(924959,'70182','Violet','HJWD1010897_thumb.jpg',98, 130,1,'photo_924959.html');
												thumbnails[923424] = new thumbnail(923424,'70182','Cyclamen with dew','HJWD1010010_thumb.jpg',98, 130,1,'photo_923424.html');
												thumbnails[923478] = new thumbnail(923478,'70182','Angle Shades moth (<em>phlogophora meticulosa</em>)','HJW35-00167_thumb.jpg',87, 130,1,'photo_923478.html');
												thumbnails[924962] = new thumbnail(924962,'70182','Hummingbird hawk moth (<em>macroglossum stallatarum</em>)','HJWD1010265_thumb.jpg',130, 98,1,'photo_924962.html');
												thumbnails[923541] = new thumbnail(923541,'70182','Wall Lizard','HJWD1000163_thumb.jpg',130, 84,1,'photo_923541.html');
												thumbnails[923454] = new thumbnail(923454,'70182','Geckos','HJWD1010325_thumb.jpg',130, 98,1,'photo_923454.html');
												thumbnails[923497] = new thumbnail(923497,'70182','Chipmonk','HJW35-00250_thumb.jpg',130, 92,1,'photo_923497.html');
												thumbnails[923539] = new thumbnail(923539,'70182','Goat and shed','HJWD1000455_thumb.jpg',130, 98,1,'photo_923539.html');
												thumbnails[924960] = new thumbnail(924960,'70182','Wagtail and waterfall','HJWD1010874_thumb.jpg',130, 98,1,'photo_924960.html');
												thumbnails[923462] = new thumbnail(923462,'70182','Spring lambs','HJW35-00153_thumb.jpg',130, 78,1,'photo_923462.html');
												thumbnails[2354085] = new thumbnail(2354085,'70182','Horses and foals (1)','HJWD1020353_thumb.jpg',130, 98,1,'photo_2354085.html');
												thumbnails[2354151] = new thumbnail(2354151,'70182','Horses and foals (2)','HJWD1020354_thumb.jpg',130, 98,1,'photo_2354151.html');
												thumbnails[1094213] = new thumbnail(1094213,'80660','Ruined Doorway','HJWD1000377_thumb.jpg',73, 130,1,'photo_1094213.html');
												thumbnails[1108061] = new thumbnail(1108061,'80660','Greek gateway','HJWD1010145_thumb.jpg',130, 98,1,'photo_1108061.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[253268] = new gallery(253268,'924950,923422','Back o\'the Shop Exhibition Prints','gallery',[4085202,924964,923387,923452,923545,924935,924950,925847,4292000,4292005,4292008,4292009,4292014,4292079,4292104,4292013,923406,4292082,923447,1157420,2659298,2659388,923422,4291998,2354198,924946],0, 0, '', 'gallery_253268.html',0,0);
				  					galleries[70511] = new gallery(70511,'4292011,4292010,4292003,4085939,4085286,4085256,4085251,4085248,4085240,4085224','NEW ADDITIONS!','gallery',[4085256,4085286,4085240,4085248,4085939,4085251,4085224,4292003,4292010,4292011],0, 0, '', 'gallery_70511.html',0,0);
				  					galleries[70030] = new gallery(70030,'2354034,925838,924972,924965,924948,924942,924941,924940,924938,924934','Landscapes','gallery',[923450,924914,924929,924930,924932,924933,924934,924938,924940,924941,924942,924948,925838,2354034,924972,923382,923384,924965,923543],0, 0, '', 'gallery_70030.html',0,0);
				  					galleries[70180] = new gallery(70180,'923414','Macro','gallery',[923414,924939,924945,924968,924971,925688,2354076,923419,1094106,925836],0, 0, '', 'gallery_70180.html',0,0);
				  					galleries[70181] = new gallery(70181,'924947','Black & White','gallery',[2354044,2354208,923432,923435,924966,923428,923430,924947,924975,925856,925870,926960,923427],0, 0, '', 'gallery_70181.html',0,0);
				  					galleries[70182] = new gallery(70182,'924959','Flora & Fauna','gallery',[923524,2354154,2354155,2354052,2354055,2354152,924952,924954,924955,924956,924958,924959,923424,923478,924962,923541,923454,923497,923539,924960,923462,2354085,2354151],0, 0, '', 'gallery_70182.html',0,0);
				  					galleries[80660] = new gallery(80660,'1094215','Architectural','gallery',[1094215,1108090,1108092,1094213,1108061],0, 0, '', 'gallery_80660.html',0,0);
				  					galleries[70184] = new gallery(70184,'2354184,926214,923547','Portraits','gallery',[926214,923547,2354184],0, 0, '', 'gallery_70184.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '4085939,4085286,4085256,4085251,4085248,4085240,4085224,4085202,2354208,2354198,2354076,2354044,1108092,1108090,1094215,926960,926214,925870,925856,925847,925838,925688,924975,924971,924968,924966,924964';
imageSets[2] = '1094215,924959,924950,924947,923422,923414';
imageSets[3] = '4085939,4085286,4085256,4085251,4085248,4085240,4085224,4085202,2354208,2354198,2354076,2354044,1108092,1108090,1094215,926960,926214,925870,925856,925847,925838,925688,924975,924971,924968,924966,924964';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/howardwallis/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/howardwallis/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 = 'Howard Wallis Photography: ' + 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.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>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (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="updateCartValue(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
				
		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 + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
	temp = temp + '	<input type="hidden" name="item_option" value="' + item_option + '">';
	temp = temp + '	<input type="hidden" name="site" value="HOWARDWALLIS">';
		temp = temp + '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp = temp + '	<input type="hidden" name="quantity" value="1">';
								temp = temp + '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
			temp = temp + '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
	temp = temp + '</form>';
		temp = temp + '<div class="clearing">&nbsp;</div>';
	temp = temp + '<div id="confirmContainer">';
	temp = temp + '<div id="paymentConfirm">Item added to cart</div>';
	temp = temp + '</div>';
			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;
	}
}

			

