window.thumbnails = new Object();
												thumbnails[5457345] = new thumbnail(5457345,'','With love at Christmas','Elena--Abigail-Christmas-c_thumb.jpg',130, 93,1,'															#');
												thumbnails[3487028] = new thumbnail(3487028,'','Christmas Angel','Angel Elena (raw to jpeg) editted_edited-2 card_thumb.jpg',130, 92,1,'															#');
												thumbnails[3071489] = new thumbnail(3071489,'','Christmas Baby Angel','Sleeping-Angel_thumb.gif',130, 92,1,'															#');
												thumbnails[6450193] = new thumbnail(6450193,'','On location at the beach','WEBFRONT1-Beach_thumb.jpg',130, 80,1,'															#');
												thumbnails[6450361] = new thumbnail(6450361,'','','WEBFRONT2-fun_thumb.jpg',130, 80,1,'															#');
												thumbnails[6450386] = new thumbnail(6450386,'','Just dreamy...','WEBFRONT3-dreamy_thumb.jpg',130, 80,1,'															#');
												thumbnails[6450420] = new thumbnail(6450420,'','Dressing up!','WEBFRONT4--dressing-up_thumb.jpg',130, 80,1,'															#');
												thumbnails[6450427] = new thumbnail(6450427,'','Love!','WEBFRONT5-love_thumb.jpg',130, 80,1,'															#');
												thumbnails[5457307] = new thumbnail(5457307,'213204','Getting ready to crawl','Teyte-low-res_thumb.jpg',130, 163,1,'																			photo_5457307.html');
												thumbnails[4799018] = new thumbnail(4799018,'183648','Door name plaque','olivercastledoorplaque_thumb.jpg',130, 92,1,'																			photo_4799018.html');
												thumbnails[4798957] = new thumbnail(4798957,'213204','I love my hat!','hat_thumb.jpg',130, 93,1,'																			photo_4798957.html');
												thumbnails[4798964] = new thumbnail(4798964,'213211','Nature lover','dress_thumb.jpg',130, 130,1,'																			photo_4798964.html');
												thumbnails[4798980] = new thumbnail(4798980,'213211','Summer flowers','strawhat_thumb.jpg',130, 130,1,'																			photo_4798980.html');
												thumbnails[4799866] = new thumbnail(4799866,'213209','Sisters','Siblingrivalry_thumb.jpg',130, 104,1,'																			photo_4799866.html');
												thumbnails[3647227] = new thumbnail(3647227,'183648','building up several images on one picture','Toddling-along_thumb.jpg',130, 65,1,'																			photo_3647227.html');
												thumbnails[3647231] = new thumbnail(3647231,'213209','Family fun!','Family-fun_thumb.jpg',130, 93,1,'																			photo_3647231.html');
												thumbnails[3647289] = new thumbnail(3647289,'213211','Walking with mum & dad','walking-with-mum--dad_thumb.jpg',130, 130,1,'																			photo_3647289.html');
												thumbnails[3487274] = new thumbnail(3487274,'183648','Double bubble trouble!','FINAL 22 bubble boys (24)_thumb.jpg',130, 72,1,'																			photo_3487274.html');
												thumbnails[3487283] = new thumbnail(3487283,'213211','Awake & dreamy','FINAL 30 Awake and Dreamy_thumb.jpg',130, 104,1,'																			photo_3487283.html');
												thumbnails[3487288] = new thumbnail(3487288,'213204','All wrapped up','FINAL 31 All wrapped up_thumb.jpg',130, 104,1,'																			photo_3487288.html');
												thumbnails[3487322] = new thumbnail(3487322,'183648','Composition: Outdoor fun ','FINAL Outdoor composition_thumb.jpg',130, 130,1,'																			photo_3487322.html');
												thumbnails[3487324] = new thumbnail(3487324,'213209','Goodnight sweetheart','M & M 12 (2061)_thumb.jpg',130, 173,1,'																			photo_3487324.html');
												thumbnails[3487329] = new thumbnail(3487329,'213211','Bubble brothers','M & M 20 (2144)_thumb.jpg',130, 93,1,'																			photo_3487329.html');
												thumbnails[3487145] = new thumbnail(3487145,'213204','Newborn bliss','Emily Asleep with green hat_thumb.jpg',130, 93,1,'																			photo_3487145.html');
												thumbnails[3487021] = new thumbnail(3487021,'213204','Playing with the Autumn leaves','1499 Toby studying the leaves uncropped_thumb.jpg',130, 87,1,'																			photo_3487021.html');
												thumbnails[3487394] = new thumbnail(3487394,'183648','Composition: 1st steps','Three-landscape-Toby-pics-2_thumb.jpg',130, 270,1,'																			photo_3487394.html');
												thumbnails[3487102] = new thumbnail(3487102,'213209','Sisterly love','christmascard2008 from flickr_thumb.jpg',130, 92,1,'																			photo_3487102.html');
												thumbnails[3487064] = new thumbnail(3487064,'213204','Sleeping baby angel','Baby Angel 4_thumb.jpg',130, 64,1,'																			photo_3487064.html');
												thumbnails[3487313] = new thumbnail(3487313,'213211','Fun in the forest','Final L10 for 20 x 16 print_thumb.jpg',130, 104,1,'																			photo_3487313.html');
												thumbnails[3487381] = new thumbnail(3487381,'213211','Skipping through the woods','skipping through the woods_thumb.jpg',130, 141,1,'																			photo_3487381.html');
												thumbnails[3487358] = new thumbnail(3487358,'183648','Rotate & recrop','Moo Card 6_thumb.jpg',130, 54,1,'																			photo_3487358.html');
												thumbnails[3487058] = new thumbnail(3487058,'213204','Babes in the wood','Babes in the Wood_thumb.jpg',130, 87,1,'																			photo_3487058.html');
												thumbnails[2952399] = new thumbnail(2952399,'213211','Butterfly Girl','butterfly-friend_thumb.jpg',130, 161,1,'																			photo_2952399.html');
												thumbnails[3487331] = new thumbnail(3487331,'213204','Tiny toes','Moo Card 4_thumb.jpg',130, 54,1,'																			photo_3487331.html');
												thumbnails[3487390] = new thumbnail(3487390,'213211','Summertime','Summertime (June 08)_thumb.jpg',130, 87,1,'																			photo_3487390.html');
												thumbnails[3487113] = new thumbnail(3487113,'213211','Dreamy springtime','Elena and buttercups 4 may 08_thumb.jpg',130, 97,1,'																			photo_3487113.html');
												thumbnails[3647274] = new thumbnail(3647274,'213209','Taking a stroll','out-for-a-family-stroll_thumb.jpg',130, 182,1,'																			photo_3647274.html');
												thumbnails[2980390] = new thumbnail(2980390,'213204','Fun in the forest','C5b-low-res-for-web-and-ema_thumb.jpg',130, 87,1,'																			photo_2980390.html');
												thumbnails[2982385] = new thumbnail(2982385,'213211','Little Ballerina','Ballet-girl-lr_thumb.jpg',130, 81,1,'																			photo_2982385.html');
												thumbnails[2988761] = new thumbnail(2988761,'183648','Fairy Baby','Fairy-baby-with-pointy-ears_thumb.jpg',130, 87,1,'																			photo_2988761.html');
												thumbnails[4799264] = new thumbnail(4799264,'183648','Photo gifts','products_thumb.jpg',130, 100,1,'																			photo_4799264.html');
												thumbnails[4799964] = new thumbnail(4799964,'183648','Home time!','Hometime_thumb.jpg',130, 178,1,'																			photo_4799964.html');
												thumbnails[4800011] = new thumbnail(4800011,'183648','Mini cards','mini-cards_thumb.jpg',130, 78,1,'																			photo_4800011.html');
												thumbnails[4800072] = new thumbnail(4800072,'213209','Growing up fast!','growingupfast_thumb.jpg',130, 130,1,'																			photo_4800072.html');
												thumbnails[4800182] = new thumbnail(4800182,'183648','Canvas Prints','canvas_thumb.jpg',130, 195,1,'																			photo_4800182.html');
												thumbnails[4800187] = new thumbnail(4800187,'183648','Frames & mounts','framing_thumb.jpg',130, 135,1,'																			photo_4800187.html');
												thumbnails[5770762] = new thumbnail(5770762,'326842','Pre-school - playing around','Aaron-Taylor-lr_thumb.jpg',130, 104,1,'																			photo_5770762.html');
												thumbnails[5770774] = new thumbnail(5770774,'326842','Pre-school - natural posing','Grace-Reeve---LR_thumb.jpg',130, 163,1,'																			photo_5770774.html');
												thumbnails[5770780] = new thumbnail(5770780,'326842','Pre-school - Studio setting','Teyte-LR_thumb.jpg',130, 104,1,'																			photo_5770780.html');
												thumbnails[5770788] = new thumbnail(5770788,'326842','Pre-school - outdoor fun!','Harry-Gilbert--brother-2--_thumb.jpg',130, 104,1,'																			photo_5770788.html');
												thumbnails[5770793] = new thumbnail(5770793,'326842','Pre-school - siblings welcome!','Harry-Gilbert--brother---L_thumb.jpg',130, 104,1,'																			photo_5770793.html');
												thumbnails[5770801] = new thumbnail(5770801,'326842','Pre-school - outdoor fun','Harry-Gilbert-3-lr_thumb.jpg',130, 104,1,'																			photo_5770801.html');
												thumbnails[6445771] = new thumbnail(6445771,'213209','Family','Liz-family-low-res-for-webs_thumb.jpg',130, 104,1,'																			photo_6445771.html');
												thumbnails[6448144] = new thumbnail(6448144,'213204','Spirited toddler','A-swinging-in-the-forest-0_thumb.jpg',130, 130,1,'																			photo_6448144.html');
												thumbnails[2952479] = new thumbnail(2952479,'213211','Little Red Riding Hood','Little-Red-Riding-Hood_thumb.jpg',130, 87,1,'																			photo_2952479.html');
												thumbnails[4800105] = new thumbnail(4800105,'213204','Looking up','babyfront_thumb.jpg',130, 104,1,'																			photo_4800105.html');
												thumbnails[3647293] = new thumbnail(3647293,'213204','Just beautiful!','Just-beautiful12_thumb.jpg',130, 182,1,'																			photo_3647293.html');
												thumbnails[4798987] = new thumbnail(4798987,'213204','Smile','smilebw_thumb.jpg',130, 87,1,'																			photo_4798987.html');
												thumbnails[3487131] = new thumbnail(3487131,'213204','Smiling newborn','Emily2 smiling_thumb.jpg',130, 87,1,'																			photo_3487131.html');
												thumbnails[3487139] = new thumbnail(3487139,'213204','Sleepy baby','Emily Asleep on front 5x3 landscape softened_thumb.jpg',130, 78,1,'																			photo_3487139.html');
												thumbnails[3487121] = new thumbnail(3487121,'213204','Teeny tiny fingers','Emily2 holding mum\'s hand_thumb.jpg',130, 87,1,'																			photo_3487121.html');
												thumbnails[3487089] = new thumbnail(3487089,'213204','Misty angel','Baby Angel 6_thumb.jpg',130, 99,1,'																			photo_3487089.html');
												thumbnails[3487303] = new thumbnail(3487303,'213204','Forest fun!','Final C2 for 20x16 print_thumb.jpg',130, 104,1,'																			photo_3487303.html');
												thumbnails[3487396] = new thumbnail(3487396,'213204','1st steps','Toby-&-mum-walking-selectiv_thumb.jpg',130, 130,1,'																			photo_3487396.html');
												thumbnails[2952286] = new thumbnail(2952286,'213204','Tiny Tearaway','Tiny-Tearaway_thumb.jpg',130, 145,1,'																			photo_2952286.html');
												thumbnails[7353086] = new thumbnail(7353086,'355771','2011 WEDDINGS: Sample prices and packages','2011WeddingpackagesWEB_thumb.jpg',130, 86,1,'																			photo_7353086.html');
												thumbnails[6357741] = new thumbnail(6357741,'355755','Here comes the bride...','LR_1b_Bride_in_the_car_98211_thumb.jpg',130, 130,1,'																			photo_6357741.html');
												thumbnails[6357803] = new thumbnail(6357803,'355755','The bridal preparations','LR-16l-Bride-getting-ready-_thumb.jpg',130, 93,1,'																			photo_6357803.html');
												thumbnails[6357807] = new thumbnail(6357807,'355755','Introducing the groom','LR-17b-groom-getting-ready-_thumb.jpg',130, 182,1,'																			photo_6357807.html');
												thumbnails[6357813] = new thumbnail(6357813,'355755','At the church','LR-4d-bride-at-the-church-d_thumb.jpg',130, 195,1,'																			photo_6357813.html');
												thumbnails[6357822] = new thumbnail(6357822,'355755','Getting married','LR-6a-couple-from-the-back-_thumb.jpg',130, 163,1,'																			photo_6357822.html');
												thumbnails[6357829] = new thumbnail(6357829,'355755','Bridal reflections','LR-14g-bride-after-the-wedd_thumb.jpg',130, 93,1,'																			photo_6357829.html');
												thumbnails[6357833] = new thumbnail(6357833,'355755','Leaving the church','LR-11g-leaving-the-church-_thumb.jpg',130, 182,1,'																			photo_6357833.html');
												thumbnails[6448026] = new thumbnail(6448026,'355753','Christening Albums','Album-Christeninglr_thumb.jpg',130, 87,1,'																			photo_6448026.html');
												thumbnails[6448036] = new thumbnail(6448036,'355755','Celebrations','Wedding-bride-portfolio-sho_thumb.jpg',130, 130,1,'																			photo_6448036.html');
												thumbnails[6450469] = new thumbnail(6450469,'355754','','WEBFRONT6-pARTY_thumb.jpg',130, 80,1,'																			photo_6450469.html');
												thumbnails[5770634] = new thumbnail(5770634,'355753','Christening photographs','Lily-9-9881-low-res_thumb.jpg',130, 130,1,'																			photo_5770634.html');
												thumbnails[5770645] = new thumbnail(5770645,'355753','Christening (family)','Lily-family-2b-9789-low-r_thumb.jpg',130, 104,1,'																			photo_5770645.html');
												thumbnails[5770657] = new thumbnail(5770657,'355753','Christening (service)','Lily-3-9753-low-res_thumb.jpg',130, 163,1,'																			photo_5770657.html');
												thumbnails[5770651] = new thumbnail(5770651,'355753','Christening (party games)','Lily-11-9943-low-res_thumb.jpg',130, 163,1,'																			photo_5770651.html');
												thumbnails[5770509] = new thumbnail(5770509,'326826','Viva La Beader - handmade jewellery (marketing) ','4_Posterlow_res_thumb.jpg',130, 104,1,'																			photo_5770509.html');
												thumbnails[5770515] = new thumbnail(5770515,'326826','Viva La Beader - handmade jewellery (product)','3_flute__hearts_necklace_close_uplow_res_thumb.jpg',130, 163,1,'																			photo_5770515.html');
												thumbnails[5770517] = new thumbnail(5770517,'326826','Viva La Beader - handmade jewellery (modelled)','12_Sleepyheadlow_res_thumb.jpg',130, 87,1,'																			photo_5770517.html');
												thumbnails[5770529] = new thumbnail(5770529,'326826','Angelic Folk childrens clothing (composite)','2_blue_hat_18m-2yr_-_composite_thumb.jpg',130, 130,1,'																			photo_5770529.html');
												thumbnails[5770543] = new thumbnail(5770543,'326826','Angelic Folk handmade childrens clothing (modelled)','3_roundneck_summer_dress_-_modelled_d_thumb.jpg',130, 130,1,'																			photo_5770543.html');
												thumbnails[5770549] = new thumbnail(5770549,'326826','Angelic Folk handmade clothing (modelled)','5_Cath_Kidson_Party_Dress_-_modelled_b_thumb.jpg',130, 182,1,'																			photo_5770549.html');
												thumbnails[5770555] = new thumbnail(5770555,'326826','Angelic Folk handmade childrens clothes (product)','8_Blue_coat_18m_3yr_-_product_front__back_thumb.jpg',130, 55,1,'																			photo_5770555.html');
												thumbnails[5770562] = new thumbnail(5770562,'326826','Angelic Folk - handmade childrens clothing (modelled - baby)','11_Green__White_Playsuit_6m_-_modelled_b_thumb.jpg',130, 130,1,'																			photo_5770562.html');
												thumbnails[4810855] = new thumbnail(4810855,'181872','Lonely Tree','Lonely-tree---web_thumb.jpg',130, 108,1,'																			photo_4810855.html');
												thumbnails[4810934] = new thumbnail(4810934,'181872','Beach Huts','Southwold-Beach-Huts---web_thumb.jpg',130, 108,1,'																			photo_4810934.html');
												thumbnails[4811047] = new thumbnail(4811047,'181872','Butterfly','butterfly1---web_thumb.jpg',130, 108,1,'																			photo_4811047.html');
												thumbnails[4811326] = new thumbnail(4811326,'181872','Snail 1','Snail-1-web_thumb.jpg',130, 108,1,'																			photo_4811326.html');
												thumbnails[4811329] = new thumbnail(4811329,'181872','Snail 2','snail-2_thumb.jpg',130, 108,1,'																			photo_4811329.html');
												thumbnails[4811343] = new thumbnail(4811343,'181872','Butterfly 2','butterfly2---web_thumb.jpg',130, 108,1,'																			photo_4811343.html');
												thumbnails[7368668] = new thumbnail(7368668,'181872','GIFT VOUCHERS - on sale NOW!','A-swinging-in-the-forest-0_6B6AA319-1EC9-DFB6-09D2EA9879F9A99E_thumb.jpg',130, 130,1,'																			photo_7368668.html');
												thumbnails[7039085] = new thumbnail(7039085,'181872','Camille\'s Appeal Calendar 2011','2011Camillesappealcalendar_thumb.jpg',130, 92,1,'																			photo_7039085.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[213204] = new gallery(213204,'5457307,4798987,3487145,3487064,3487021','Babies & toddlers','section424202',[5457307,4798957,3487288,3487145,3487021,3487064,3487058,3487331,2980390,6448144,4800105,3647293,4798987,3487131,3487139,3487121,3487089,3487303,3487396,2952286],0, 0, '', '																																																																																																							section424202_213204.html',0,0);
				  					galleries[213211] = new gallery(213211,'4798980,2952479','Boys & girls come out to play!','section424202',[4798964,4798980,3647289,3487283,3487329,3487313,3487381,2952399,3487390,3487113,2982385,2952479],0, 0, '', '																																																																																																							section424202_213211.html',0,0);
				  					galleries[213209] = new gallery(213209,'6445771,4799866,3487324,3487102','Families, adults & older children.','section424202',[4799866,3647231,3487324,3487102,3647274,4800072,6445771],0, 0, '', '																																																																																																							section424202_213209.html',0,0);
				  					galleries[326826] = new gallery(326826,'5770509','Product Photography','section424204',[5770509,5770515,5770517,5770529,5770543,5770549,5770555,5770562],0, 0, '', '																																																																																																																																	section424204.html',0,1);
				  					galleries[355753] = new gallery(355753,'5770634','CHRISTENINGS','section424203',[6448026,5770634,5770645,5770657,5770651],0, 0, '', '																																																																																																							section424203_355753.html',0,0);
				  					galleries[355755] = new gallery(355755,'6448036,6357833,6357741','WEDDINGS','section424203',[6357741,6357803,6357807,6357813,6357822,6357829,6357833,6448036],0, 0, '', '																																																																																																							section424203_355755.html',0,0);
				  					galleries[355754] = new gallery(355754,'6450469','PARTIES','section424203',[6450469],0, 0, '', '																																																																																																							section424203_355754.html',0,0);
				  					galleries[355771] = new gallery(355771,'7353086','PRICE LIST','section424203',[7353086],0, 0, '', '																																																																																																							section424203_355771.html',0,0);
				  					galleries[326842] = new gallery(326842,'5770801,5770788,5770774','Schools, Nurseries & groups','section424202',[5770762,5770774,5770780,5770788,5770793,5770801],0, 0, '', '																																																																																																							section424202_326842.html',0,0);
				  					galleries[183648] = new gallery(183648,'3647227,2988761','Creative touches & photo gift ideas','section424202',[4799018,3647227,3487274,3487322,3487394,3487358,2988761,4799264,4799964,4800011,4800182,4800187],0, 0, '', '																																																																																																							section424202_183648.html',0,0);
				  					galleries[181872] = new gallery(181872,'4810855','For Sale','section424205',[4810855,4810934,4811047,4811326,4811329,4811343,7368668,7039085],0, 0, '', '																																																																																																																																	section424205.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6450469,6450427,6450420,6450386,6450361,6450193';
imageSets[2] = '7353086,6450469,6450193,6448036,6445771,6357833,6357741,5770801,5770788,5770774,5770634,5770509,5457345,5457307,4810855,4799866,4798987,4798980,3647227,3487324,3487145,3487102,3487064,3487028,3487021,2988761,2952479';
imageSets[3] = '4798964,3647231,3487288,3487145,2952479';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/SarahLeigh/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/SarahLeigh/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 += 'section424202.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 && 'section424202' != '') {
					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));		}, 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 = '~   Sarah Leigh Photography   ~: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      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));    }        
    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>';
	}
					
	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="SARAHLEIGH">';
		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;
	}
}

			

