window.thumbnails = new Object();
												thumbnails[1505152] = new thumbnail(1505152,'103414','Compactor','compactor_thumb.jpg',130, 155,1,'photo_1505152.html');
												thumbnails[1505159] = new thumbnail(1505159,'103414','Windscreen','windscreen_thumb.jpg',130, 107,1,'photo_1505159.html');
												thumbnails[1505161] = new thumbnail(1505161,'103414','Cabs','cabs_thumb.jpg',130, 129,1,'photo_1505161.html');
												thumbnails[1505166] = new thumbnail(1505166,'103414','Scraper','planer_thumb.jpg',130, 159,1,'photo_1505166.html');
												thumbnails[1505173] = new thumbnail(1505173,'103424','The wicked generation','croick_thumb.jpg',130, 186,1,'photo_1505173.html');
												thumbnails[1505245] = new thumbnail(1505245,'103414','Runway','runway_thumb.jpg',130, 258,1,'photo_1505245.html');
												thumbnails[1505246] = new thumbnail(1505246,'103414','Crane and cow parsley','crane_thumb.jpg',130, 179,1,'photo_1505246.html');
												thumbnails[1505247] = new thumbnail(1505247,'103414','Caterpillars','caterpillars_thumb.jpg',130, 73,1,'photo_1505247.html');
												thumbnails[1505420] = new thumbnail(1505420,'103424','Construction','construction_thumb.jpg',130, 84,1,'photo_1505420.html');
												thumbnails[1505422] = new thumbnail(1505422,'103424','Croick Church','construction2_thumb.jpg',130, 92,1,'photo_1505422.html');
												thumbnails[1505424] = new thumbnail(1505424,'103424','Snowdomes','snowdomes_thumb.jpg',130, 47,1,'photo_1505424.html');
												thumbnails[1527229] = new thumbnail(1527229,'103424','Path to Croick church','path_thumb.jpg',130, 131,1,'photo_1527229.html');
												thumbnails[1972561] = new thumbnail(1972561,'149785','March hare','bella-in-the-snow_thumb.jpg',130, 97,1,'photo_1972561.html');
												thumbnails[1973060] = new thumbnail(1973060,'132599','Altered book','eye_in_a_book_thumb.jpg',130, 107,1,'photo_1973060.html');
												thumbnails[1973064] = new thumbnail(1973064,'132599','Glass book','glass_book_thumb.jpg',130, 68,1,'photo_1973064.html');
												thumbnails[1973066] = new thumbnail(1973066,'132599','Haiku','haiku_thumb.jpg',130, 87,1,'photo_1973066.html');
												thumbnails[1973070] = new thumbnail(1973070,'132599','Organ of beholding','organ-of-beholding_thumb.jpg',130, 92,1,'photo_1973070.html');
												thumbnails[1973073] = new thumbnail(1973073,'132599','Unreadable book','unreadable_thumb.jpg',130, 75,1,'photo_1973073.html');
												thumbnails[1973074] = new thumbnail(1973074,'132599','Wooden book','wooden_book_thumb.jpg',130, 131,1,'photo_1973074.html');
												thumbnails[1973479] = new thumbnail(1973479,'149785','Bella drawings','bella_drawings_thumb.jpg',130, 135,1,'photo_1973479.html');
												thumbnails[2024059] = new thumbnail(2024059,'135669','Rooks with sturdy walk','rook-drawing_thumb.jpg',130, 130,1,'photo_2024059.html');
												thumbnails[2120287] = new thumbnail(2120287,'135669','With full grass, the flock will thrive apace.','lambs_thumb.jpg',130, 130,1,'photo_2120287.html');
												thumbnails[2152044] = new thumbnail(2152044,'132589','Stag skull','stag-skull-symmetrical-with_thumb.jpg',130, 130,1,'photo_2152044.html');
												thumbnails[2274434] = new thumbnail(2274434,'149785','Bella drawing 2','bella-drawing-2_thumb.jpg',130, 90,1,'photo_2274434.html');
												thumbnails[2279402] = new thumbnail(2279402,'135669','The repose of nature','layered-symmetrical-sunset_thumb.jpg',130, 184,1,'photo_2279402.html');
												thumbnails[2623836] = new thumbnail(2623836,'149785','Bella dreaming','bella-dreaming_thumb.jpg',130, 120,1,'photo_2623836.html');
												thumbnails[2841648] = new thumbnail(2841648,'135669','Hares came to the door in the evening 2.','hares-came-to-the-door-in-t_thumb.jpg',130, 130,1,'photo_2841648.html');
												thumbnails[3080413] = new thumbnail(3080413,'149785','Bella and Mig','bella-and-mig-001_thumb.jpg',130, 129,1,'photo_3080413.html');
												thumbnails[3192526] = new thumbnail(3192526,'132599','The Helmsdale Kelpie','kelpie-book_thumb.jpg',130, 130,1,'photo_3192526.html');
												thumbnails[3293580] = new thumbnail(3293580,'132599','Conceptual book','conceptual-book_thumb.jpg',130, 130,1,'photo_3293580.html');
												thumbnails[3572557] = new thumbnail(3572557,'132599','Fingerprints','fingerprints_thumb.jpg',130, 184,1,'photo_3572557.html');
												thumbnails[3655239] = new thumbnail(3655239,'101540','The Foreshadowing: sgarbh an sgumain','foreshadowing_thumb.jpg',130, 182,1,'photo_3655239.html');
												thumbnails[3655253] = new thumbnail(3655253,'101540','Pal\'imp-sest','palimp-sest_thumb.jpg',130, 130,1,'photo_3655253.html');
												thumbnails[4435876] = new thumbnail(4435876,'259495','The phone box','phone-box_thumb.jpg',130, 179,1,'photo_4435876.html');
												thumbnails[4435883] = new thumbnail(4435883,'259495','Stack bothy','stack-bothy_thumb.jpg',130, 92,1,'photo_4435883.html');
												thumbnails[4435886] = new thumbnail(4435886,'259495','The stables','stables_thumb.jpg',130, 92,1,'photo_4435886.html');
												thumbnails[4435891] = new thumbnail(4435891,'259495','The school','school_thumb.jpg',130, 92,1,'photo_4435891.html');
												thumbnails[5773128] = new thumbnail(5773128,'149785','Bella belissima','bella-belissima_thumb.gif',130, 167,1,'photo_5773128.html');
												thumbnails[5773130] = new thumbnail(5773130,'149785','Bella among the daffodils','bella-in-the-daffodils_thumb.gif',130, 171,1,'photo_5773130.html');
												thumbnails[5773133] = new thumbnail(5773133,'326971','In the wake of the plough','corvids-in-the-wake-of-the-_thumb.gif',130, 130,1,'photo_5773133.html');
												thumbnails[5773135] = new thumbnail(5773135,'326971','Thought and Memory','corvids-thought-and-memory_thumb.gif',130, 97,1,'photo_5773135.html');
												thumbnails[5773140] = new thumbnail(5773140,'326971','Thrice the life of a stag','corvids-thrice-the-life_thumb.gif',130, 111,1,'photo_5773140.html');
												thumbnails[4416391] = new thumbnail(4416391,'258706','Oak','oak_thumb.jpg',130, 93,1,'photo_4416391.html');
												thumbnails[4416126] = new thumbnail(4416126,'258706','Clear felling, West Shinness','clear-felling_thumb.jpg',130, 259,1,'photo_4416126.html');
												thumbnails[1505147] = new thumbnail(1505147,'258706','Dog kennel, Culgower Wood','dog-kennel_thumb.jpg',130, 196,1,'photo_1505147.html');
												thumbnails[4416390] = new thumbnail(4416390,'258706','Major Oak and three birches','major-oak_thumb.jpg',130, 103,1,'photo_4416390.html');
												thumbnails[3027782] = new thumbnail(3027782,'258706','Dark energy','dark-energy_2_thumb.jpg',130, 225,1,'photo_3027782.html');
												thumbnails[4416150] = new thumbnail(4416150,'258706','Inverewe pines','inverewe-pines_thumb.jpg',130, 204,1,'photo_4416150.html');
												thumbnails[4435583] = new thumbnail(4435583,'258706','Beech:book','beech-book_thumb.jpg',130, 91,1,'photo_4435583.html');
												thumbnails[4415963] = new thumbnail(4415963,'258706','Tapestried about with rags','clootie-well-munlochy_thumb.jpg',130, 259,1,'photo_4415963.html');
												thumbnails[1972585] = new thumbnail(1972585,'258706','Coll','hazel_thumb.jpg',130, 130,1,'photo_1972585.html');
												thumbnails[1502105] = new thumbnail(1502105,'101540','Stove at Addie\'s','stove_thumb.jpg',130, 130,1,'photo_1502105.html');
												thumbnails[4435585] = new thumbnail(4435585,'258706','Bowthorpe oak','bowthorpe-oak_thumb.jpg',130, 65,1,'photo_4435585.html');
												thumbnails[4435589] = new thumbnail(4435589,'258706','Stag in the spinney','stag-in-the-spinney_thumb.jpg',130, 130,1,'photo_4435589.html');
												thumbnails[4435594] = new thumbnail(4435594,'258706','Clipsham Yew Avenue','clipsham_thumb.jpg',130, 130,1,'photo_4435594.html');
												thumbnails[4435598] = new thumbnail(4435598,'258706','The chancel<br>\r\nTree cathedral, Whipsnade','tree-cathedral_thumb.jpg',130, 130,1,'photo_4435598.html');
												thumbnails[4435601] = new thumbnail(4435601,'258706','The Hermitage','hermitage_thumb.jpg',130, 130,1,'photo_4435601.html');
												thumbnails[4435604] = new thumbnail(4435604,'258706','Rhododendron<br>\r\nInverewe Gardens, Wester Ross','rhododendron_thumb.jpg',130, 130,1,'photo_4435604.html');
												thumbnails[4416136] = new thumbnail(4416136,'258706','Gaelic tree alphabet<br>\r\na: ailm: elm','elm_thumb.jpg',130, 130,1,'photo_4416136.html');
												thumbnails[4416141] = new thumbnail(4416141,'258706','Gaelic tree alphabet<br>\r\nh: uath: hawthorn','hawthorn_thumb.jpg',130, 130,1,'photo_4416141.html');
												thumbnails[5773116] = new thumbnail(5773116,'258706','Gaelic tree alphabet d: dair: oak','tree-alphabet-oak_thumb.gif',130, 130,1,'photo_5773116.html');
												thumbnails[4416154] = new thumbnail(4416154,'258706','Gaelic tree alphabet<br>\r\ng: gort: ivy','ivy_thumb.jpg',130, 130,1,'photo_4416154.html');
												thumbnails[4416438] = new thumbnail(4416438,'258706','Gaelic tree alphabet<br>\r\nl: luis: rowan','rowan1_thumb.jpg',130, 130,1,'photo_4416438.html');
												thumbnails[1505244] = new thumbnail(1505244,'101540','Window at Addie\'s','window_thumb.jpg',130, 182,1,'photo_1505244.html');
												thumbnails[4416142] = new thumbnail(4416142,'258706','Gaelic tree alphabet<br>\r\nu: urr: heather','heather_thumb.jpg',130, 130,1,'photo_4416142.html');
												thumbnails[4416441] = new thumbnail(4416441,'258706','Gaelic tree alphabet<br>\r\no: onn: whin','whin_thumb.jpg',130, 130,1,'photo_4416441.html');
												thumbnails[4416443] = new thumbnail(4416443,'258706','Winter trees, Big Burn','winter-trees-big-burn_thumb.jpg',130, 202,1,'photo_4416443.html');
												thumbnails[4416096] = new thumbnail(4416096,'258706','Autumn beech, Big Burn, Golspie','autumn-beech_thumb.jpg',130, 130,1,'photo_4416096.html');
												thumbnails[4416104] = new thumbnail(4416104,'258706','Caledonian pine, Glen Affric','caledonian-pine_thumb.jpg',130, 260,1,'photo_4416104.html');
												thumbnails[4416128] = new thumbnail(4416128,'258706','Collocation','collocation_thumb.jpg',130, 236,1,'photo_4416128.html');
												thumbnails[4416130] = new thumbnail(4416130,'258706','Covert oaks','covert-oaks_thumb.jpg',130, 195,1,'photo_4416130.html');
												thumbnails[4416156] = new thumbnail(4416156,'258706','January sunrise','january-sunrise_thumb.jpg',130, 195,1,'photo_4416156.html');
												thumbnails[4416388] = new thumbnail(4416388,'258706','Jim\'s whin bush','jims-whin-bush_thumb.jpg',130, 179,1,'photo_4416388.html');
												thumbnails[4416392] = new thumbnail(4416392,'258706','Resurgam','resurgam_thumb.jpg',130, 195,1,'photo_4416392.html');
												thumbnails[1505171] = new thumbnail(1505171,'101540','Broken window','broken_thumb.jpg',130, 184,1,'photo_1505171.html');
												thumbnails[4416138] = new thumbnail(4416138,'258706','Full circle','full-circle_thumb.jpg',130, 93,1,'photo_4416138.html');
												thumbnails[1505206] = new thumbnail(1505206,'101540','Installation at Addie\'s','installation_thumb.jpg',130, 167,1,'photo_1505206.html');
												thumbnails[1505419] = new thumbnail(1505419,'132599','Addie\'s','book_thumb.jpg',130, 87,1,'photo_1505419.html');
												thumbnails[1505241] = new thumbnail(1505241,'101540','Prizes','prizes_thumb.jpg',130, 90,1,'photo_1505241.html');
												thumbnails[1505170] = new thumbnail(1505170,'101540','Steading','steading_thumb.jpg',130, 101,1,'photo_1505170.html');
												thumbnails[1505172] = new thumbnail(1505172,'101540','Cheese press','cheesepress_thumb.jpg',130, 91,1,'photo_1505172.html');
												thumbnails[1505148] = new thumbnail(1505148,'101540','Black river','blackriver_thumb.jpg',130, 130,1,'photo_1505148.html');
												thumbnails[1505168] = new thumbnail(1505168,'101540','Clach Mhic Mhios','clach_thumb.jpg',130, 262,1,'photo_1505168.html');
												thumbnails[1508320] = new thumbnail(1508320,'101540','January sunrise 2','sunrise21_thumb.jpg',130, 173,1,'photo_1508320.html');
												thumbnails[1527226] = new thumbnail(1527226,'101540','Kildonan church','kildonan_thumb.jpg',130, 134,1,'photo_1527226.html');
												thumbnails[1527223] = new thumbnail(1527223,'101540','Post office','postoffice_thumb.jpg',130, 130,1,'photo_1527223.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[259495] = new gallery(259495,'4435891,4435886,4435883,4435876','Achfary','gallery',[4435876,4435883,4435886,4435891],0, 0, '103423', 'gallery_259495.html',0,0);
				  					galleries[103414] = new gallery(103414,'1505246,1505245,1505166,1505161,1505159,1505152','Airfield','gallery',[1505152,1505159,1505161,1505166,1505245,1505246,1505247],0, 0, '', 'gallery_103414.html',0,0);
				  					galleries[258706] = new gallery(258706,'5773116,4435604,4435601,4435598,4435594,4435589,4435585,4435583,4416443,4416441,4416438,4416392,4416391,4416390,4416388,4416156,4416154,4416150,4416142,4416141,4416138,4416136,4416128,4416126,4416104,4416096,4415963,3027782,1972585,1505147','Arboreal','gallery',[4416391,4416126,1505147,4416390,3027782,4416150,4435583,4415963,1972585,4435585,4435589,4435594,4435598,4435601,4435604,4416136,4416141,5773116,4416154,4416438,4416142,4416441,4416443,4416096,4416104,4416128,4416130,4416156,4416388,4416392,4416138],0, 0, '', 'gallery_258706.html',0,0);
				  					galleries[132599] = new gallery(132599,'3572557,3293580,3192526,1973074,1973073,1973066,1973064,1973060,1505419','Artist\'s books','gallery',[1973060,1973064,1973066,1973070,1973073,1973074,3192526,3293580,3572557,1505419],0, 0, '', 'gallery_132599.html',0,0);
				  					galleries[149785] = new gallery(149785,'5773128,3080413,2623836,2274434,1973479,1972561','Bella','gallery',[1972561,1973479,2274434,2623836,3080413,5773128,5773130],0, 0, '', 'gallery_149785.html',0,0);
				  					galleries[135669] = new gallery(135669,'2841648,2279402,2120287,2024059','Book of the Farm','gallery',[2024059,2120287,2279402,2841648],0, 0, '', 'gallery_135669.html',0,0);
				  					galleries[326971] = new gallery(326971,'5773140,5773135','Corvids','gallery',[5773133,5773135,5773140],0, 0, '', 'gallery_326971.html',0,0);
				  					galleries[103424] = new gallery(103424,'1527229,1505424,1505420,1505173','Croick Church','gallery',[1505173,1505420,1505422,1505424,1527229],0, 0, '103423', 'gallery_103424.html',0,0);
				  					galleries[132589] = new gallery(132589,'2152044','Miscellaneous','gallery',[2152044],0, 0, '', 'gallery_132589.html',0,0);
				  					galleries[103423] = new gallery(103423,'4435891,4435886,4435883,4435876,3655253,3655239,1527229,1527223,1505424,1505420,1505244,1505241,1505206,1505173,1505172,1505171,1505170,1505168,1505148,1502105','Northern Highlands','gallery',[],0, 0, '', 'gallery_103423.html',0,0);
				  					galleries[101540] = new gallery(101540,'3655253,3655239,1527223,1505244,1505241,1505206,1505172,1505171,1505170,1505168,1505148,1502105','Loth and Helmsdale','gallery',[3655239,3655253,1502105,1505244,1505171,1505206,1505241,1505170,1505172,1505148,1505168,1508320,1527226,1527223],0, 0, '103423', 'gallery_101540.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '5773128,4435604,4435601,4435594,4416443,4416438,4416391,4416390,4416388,4416154,4416141,4416138,4416136,4416128,4416126,4416104,4415963,3027782,1972585,1505147';
imageSets[2] = '5773140,5773135,5773128,5773116,4435891,4435886,4435883,4435876,4435604,4435601,4435598,4435594,4435589,4435585,4435583,4416443,4416441,4416438,4416392,4416391,4416390,4416388,4416156,4416154,4416150,4416142,4416141,4416138,4416136,4416128,4416126,4416104,4416096,4415963,3655253,3655239,3572557,3293580,3192526,3080413,3027782,2841648,2623836,2279402,2274434,2152044,2120287,2024059,1973479,1973074,1973073,1973066,1973064,1973060,1972585,1972561,1527229,1527223,1505424,1505420,1505419,1505246,1505245,1505244,1505241,1505206,1505173,1505172,1505171,1505170,1505168,1505166,1505161,1505159,1505152,1505148,1505147,1502105';
imageSets[3] = '5773140,4435604,4435601,4435598,4435594,4435589,4435585,4416443,4416438,4416391,4416390,4416388,4416156,4416154,4416141,4416138,4416136,4416128,4416126,4416104,4416096,4415963,3027782,1972585,1505147';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/suziemack/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/suziemack/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/suziemack/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/suziemack/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/suziemack/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/suziemack/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 = 'Suzie MacKenzie Fine Art: ' + 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;
	}
}

			

