window.thumbnails = new Object();
												thumbnails[1710031] = new thumbnail(1710031,'','','Me_thumb.jpg',130, 93,1,'#');
												thumbnails[2191155] = new thumbnail(2191155,'','','All with fire1_thumb.jpg',130, 86,1,'#');
												thumbnails[2846443] = new thumbnail(2846443,'','','Fanning flames 21_thumb.jpg',130, 86,1,'#');
												thumbnails[5131511] = new thumbnail(5131511,'','','Portrait_of_County_Downcover12_thumb.jpg',130, 121,1,'#');
												thumbnails[95230] = new thumbnail(95230,'52618','Tranquil ','Tranquil Sunset_thumb.jpg',130, 184,1,'photo_95230.html');
												thumbnails[137093] = new thumbnail(137093,'52614','Hay Bales at Sunrise','Hay Bales_thumb.jpg',130, 92,1,'photo_137093.html');
												thumbnails[269486] = new thumbnail(269486,'52610','Jetty Sunset','Pier 2 - Holywood_thumb.jpg',130, 92,1,'photo_269486.html');
												thumbnails[411135] = new thumbnail(411135,'52622','Pier and Slipway ','Pier Slipway 2_thumb.jpg',130, 86,1,'photo_411135.html');
												thumbnails[552307] = new thumbnail(552307,'52607','Carrickfergus Castle at Dawn','Castle 2_thumb.jpg',130, 86,1,'photo_552307.html');
												thumbnails[570779] = new thumbnail(570779,'52618','Jetty Remains','Broken Jetty 1, Oxford Island, Northern Ireland_thumb.jpg',130, 86,1,'photo_570779.html');
												thumbnails[605918] = new thumbnail(605918,'141075','Scrabo Dawn ','Scrabo Tower Dawn 2, Comber, Northern Ireland_thumb.jpg',130, 86,1,'photo_605918.html');
												thumbnails[1627845] = new thumbnail(1627845,'110331','Moonlit Ballyholme','Moonlit panorama, Ballyholme Beach_thumb.jpg',130, 27,1,'photo_1627845.html');
												thumbnails[2498262] = new thumbnail(2498262,'52603','The Mourne Mountains ','Mournes 11_thumb.jpg',130, 86,1,'photo_2498262.html');
												thumbnails[3032392] = new thumbnail(3032392,'52625','White Rocks Beach','Whiterocks beach 9_thumb.jpg',130, 86,1,'photo_3032392.html');
												thumbnails[3534398] = new thumbnail(3534398,'216256','Lake Wakatipu at Dawn','Lake_Wakatipo_blue_skies_1_thumb.jpg',130, 86,1,'photo_3534398.html');
												thumbnails[5349290] = new thumbnail(5349290,'156487','Ballynoe Stone Circle','Ballynoe_Stone_Circle_6_thumb.jpg',130, 86,1,'photo_5349290.html');
												thumbnails[6360771] = new thumbnail(6360771,'352235','Doon at Blackwaterfoot','Doondusk2_thumb.jpg',130, 86,1,'photo_6360771.html');
												thumbnails[95228] = new thumbnail(95228,'52618','Broken','Broken Fence_thumb.jpg',130, 184,1,'photo_95228.html');
												thumbnails[232044] = new thumbnail(232044,'52603','Mournes from Murlough','Dunes Mournes_thumb.jpg',130, 86,1,'photo_232044.html');
												thumbnails[232059] = new thumbnail(232059,'52614','Bluebells in Delamont Country Park','Bluebells_and_forest_h_thumb.jpg',130, 86,1,'photo_232059.html');
												thumbnails[250525] = new thumbnail(250525,'52622','Serene Sea','Groyne into the sea with sky_thumb.jpg',130, 86,1,'photo_250525.html');
												thumbnails[250541] = new thumbnail(250541,'52610','Groomsport Harbour Sunset','Groomsport Harbour sunset_thumb.jpg',130, 86,1,'photo_250541.html');
												thumbnails[420000] = new thumbnail(420000,'52622','Reflections of the Day','Sea Mirror_thumb.jpg',130, 86,1,'photo_420000.html');
												thumbnails[816287] = new thumbnail(816287,'52625','The Boathouse ','Boathouse 3_thumb.jpg',130, 86,1,'photo_816287.html');
												thumbnails[2070480] = new thumbnail(2070480,'141075','Nendrum Monastic Site ','nendrum horizontal 3_thumb.jpg',130, 86,1,'photo_2070480.html');
												thumbnails[3559787] = new thumbnail(3559787,'216256','Twilight Church','Church_of_the_Good_Shepherd_5_thumb.jpg',130, 86,1,'photo_3559787.html');
												thumbnails[5529816] = new thumbnail(5529816,'156487','Tyrella Sunset','Posts_71_thumb.jpg',130, 86,1,'photo_5529816.html');
												thumbnails[6360772] = new thumbnail(6360772,'352235','On the summit of Goatfell mountain','Goatfellsummit2_thumb.jpg',130, 86,1,'photo_6360772.html');
												thumbnails[232057] = new thumbnail(232057,'52614','Spring Tree','Giants_Ring_Tree_hor_4_thumb.jpg',130, 86,1,'photo_232057.html');
												thumbnails[232061] = new thumbnail(232061,'52607','Giant\'s Ring','Giants Ring Hor 41_thumb.jpg',130, 86,1,'photo_232061.html');
												thumbnails[250540] = new thumbnail(250540,'52618','Step Into the Sunset','Metal steps ver_thumb.jpg',130, 195,1,'photo_250540.html');
												thumbnails[283047] = new thumbnail(283047,'141075','Windmill Hill ','Windmill Hill Snow 2_thumb.jpg',130, 86,1,'photo_283047.html');
												thumbnails[425181] = new thumbnail(425181,'52607','Giant\'s Causeway Twilight','Causeway 2_thumb.jpg',130, 86,1,'photo_425181.html');
												thumbnails[510372] = new thumbnail(510372,'52625','Strangford Twilight ','Ballymorran 9redone_thumb.jpg',130, 86,1,'photo_510372.html');
												thumbnails[563873] = new thumbnail(563873,'52610','Kircubbin Dusk','Kirkubbin harbour, Northern Ireland_thumb.jpg',130, 86,1,'photo_563873.html');
												thumbnails[1627898] = new thumbnail(1627898,'110331','Mountstewart','Lake panorama_thumb.jpg',130, 27,1,'photo_1627898.html');
												thumbnails[2530956] = new thumbnail(2530956,'52603','Sunset on Tyrella Beach','Mournes-Tyrella-b_thumb.jpg',130, 86,1,'photo_2530956.html');
												thumbnails[3559791] = new thumbnail(3559791,'216256','Lake Tekapo Sunset','Lake_sunset_thumb.jpg',130, 86,1,'photo_3559791.html');
												thumbnails[5354086] = new thumbnail(5354086,'156487','Ballynoe Stone Circle 2','Ballynoe_Stone_Circle_4_thumb.jpg',130, 86,1,'photo_5354086.html');
												thumbnails[6360775] = new thumbnail(6360775,'352235','Arran Sunset','Hillssunset_thumb.jpg',130, 86,1,'photo_6360775.html');
												thumbnails[152373] = new thumbnail(152373,'52618','Fiery Farewell','Fiery Farewell - Ards Peninsula_thumb.jpg',130, 86,1,'photo_152373.html');
												thumbnails[361126] = new thumbnail(361126,'52622','A Place for Contemplation','Seatsunset_thumb.jpg',130, 86,1,'photo_361126.html');
												thumbnails[504567] = new thumbnail(504567,'52614','Stepping Stones','Stepping stones h 3_thumb.jpg',130, 86,1,'photo_504567.html');
												thumbnails[582783] = new thumbnail(582783,'52607','Stormy Giant\'s Causeway ','Giants Causeway 11_thumb.jpg',130, 86,1,'photo_582783.html');
												thumbnails[582805] = new thumbnail(582805,'52610','Steps to the Lighthouse ','Steps lighthouse_thumb.jpg',130, 86,1,'photo_582805.html');
												thumbnails[605920] = new thumbnail(605920,'52603','Mourne Wall','131_thumb.jpg',130, 86,1,'photo_605920.html');
												thumbnails[997739] = new thumbnail(997739,'52625','Low Tide in Ballywalter','Ballywalter-boat-sunset_thumb.jpg',130, 86,1,'photo_997739.html');
												thumbnails[1849406] = new thumbnail(1849406,'141075','Millin Bay Cairn ','43 - Millin Cairn sunset_thumb.jpg',130, 86,1,'photo_1849406.html');
												thumbnails[3545225] = new thumbnail(3545225,'216256','The Church of the Good Shepherd','Church_of_the_Good_Shepard_stars_3_thumb.jpg',130, 195,1,'photo_3545225.html');
												thumbnails[3859215] = new thumbnail(3859215,'156487','The Blue Lough','Blue_Lough_thumb.jpg',130, 86,1,'photo_3859215.html');
												thumbnails[6360779] = new thumbnail(6360779,'352235','Sunset reflected in a rockpool on Blackwaterfoot beach','Rockpoolsunset_thumb.jpg',130, 86,1,'photo_6360779.html');
												thumbnails[211675] = new thumbnail(211675,'52610','Donaghadee Lighthouse at Dusk ','Lighthouse dusk v_thumb.jpg',130, 195,1,'photo_211675.html');
												thumbnails[411134] = new thumbnail(411134,'52618','Towards the Moonlight ','Islandhill moonlight  vertical_thumb.jpg',130, 195,1,'photo_411134.html');
												thumbnails[621042] = new thumbnail(621042,'141075','Ballycopeland Windmill ','Windmill 1_thumb.jpg',130, 195,1,'photo_621042.html');
												thumbnails[2058134] = new thumbnail(2058134,'110331','Silent Valley','Silent Valley Panorama_thumb.jpg',130, 26,1,'photo_2058134.html');
												thumbnails[3032388] = new thumbnail(3032388,'52625','Gap in the Clouds','Whiterocks beach 5_thumb.jpg',130, 86,1,'photo_3032388.html');
												thumbnails[3140777] = new thumbnail(3140777,'52614','Crawfordsburn Waterfall','Waterfall_in_Crawfordsburn_Country_Park_2_thumb.jpg',130, 195,1,'photo_3140777.html');
												thumbnails[3559786] = new thumbnail(3559786,'216256','Sunset over the Church of the Good Shepherd','Church_of_the_Good_Shepherd_41_thumb.jpg',130, 86,1,'photo_3559786.html');
												thumbnails[3859220] = new thumbnail(3859220,'52607','Wateresk Dolmen','Wateresk_Dolmen_7_thumb.jpg',130, 86,1,'photo_3859220.html');
												thumbnails[4922718] = new thumbnail(4922718,'52603','Reflections of a Mountain Sunset','Sunset_2_thumb.jpg',130, 86,1,'photo_4922718.html');
												thumbnails[5319370] = new thumbnail(5319370,'156487','Chaine Memorial Tower','Chaine_Memorial_Tower_21_thumb.jpg',130, 195,1,'photo_5319370.html');
												thumbnails[6360802] = new thumbnail(6360802,'352235','Rocks at Dusk','Rocksseasunset_thumb.jpg',130, 86,1,'photo_6360802.html');
												thumbnails[376190] = new thumbnail(376190,'52625','Sunset on the Peninsula ','SimonBrown_thumb.jpg',130, 87,1,'photo_376190.html');
												thumbnails[672269] = new thumbnail(672269,'52603','Silent Valley','Drain hole_thumb.jpg',130, 86,1,'photo_672269.html');
												thumbnails[742920] = new thumbnail(742920,'52610','Lough Cowey ','Lough Cowey1_thumb.jpg',130, 87,1,'photo_742920.html');
												thumbnails[997732] = new thumbnail(997732,'52622','Halcyon Horizon','Rock calm sea horizon vertical_thumb.jpg',130, 195,1,'photo_997732.html');
												thumbnails[2120501] = new thumbnail(2120501,'141075','Ballycopeland Windmill Sunset','From-field-h-4_thumb.jpg',130, 86,1,'photo_2120501.html');
												thumbnails[3091887] = new thumbnail(3091887,'52607','Elephant Rock','Elephants Rock 2_thumb.jpg',130, 86,1,'photo_3091887.html');
												thumbnails[3114108] = new thumbnail(3114108,'52603','Sunset over the Mourne Mountains','Mournes from St Johns Point_thumb.jpg',130, 86,1,'photo_3114108.html');
												thumbnails[3545231] = new thumbnail(3545231,'216256','Trees and the Night Sky','Trees_Moonlight_thumb.jpg',130, 195,1,'photo_3545231.html');
												thumbnails[3816869] = new thumbnail(3816869,'52614','Bluebells in Garvagh Forest','Bluebells_and_forest__1_thumb.jpg',130, 86,1,'photo_3816869.html');
												thumbnails[4966599] = new thumbnail(4966599,'156487','Sunset over Crawfordsburn','Crawfordsburn_shore_412_thumb.jpg',130, 86,1,'photo_4966599.html');
												thumbnails[6360883] = new thumbnail(6360883,'352235','Seaweed Sunset','Seaweedsunset_thumb.jpg',130, 86,1,'photo_6360883.html');
												thumbnails[2418928] = new thumbnail(2418928,'52607','St John\'s Point Lighthouse','Horizontal reflection and rocks_thumb.jpg',130, 86,1,'photo_2418928.html');
												thumbnails[2850160] = new thumbnail(2850160,'52603','Rainbow over the Mourne Mountains','Mournes_rainbow_thumb.jpg',130, 86,1,'photo_2850160.html');
												thumbnails[3545229] = new thumbnail(3545229,'216256','Mt John','Mt_John_reflections_thumb.jpg',130, 86,1,'photo_3545229.html');
												thumbnails[567368] = new thumbnail(567368,'52622','Pale Moonlight','Groyne Moon_thumb.jpg',130, 86,1,'photo_567368.html');
												thumbnails[2418936] = new thumbnail(2418936,'52603','Mourne Reflections','Mournes Tyrella reflection 2_thumb.jpg',130, 86,1,'photo_2418936.html');
												thumbnails[2846366] = new thumbnail(2846366,'52607','Mussenden Temple','Mussenden Temple h4_thumb.jpg',130, 86,1,'photo_2846366.html');
												thumbnails[3578997] = new thumbnail(3578997,'216256','Tasman Glacier','Tasman_glacier_2a_thumb.jpg',130, 86,1,'photo_3578997.html');
												thumbnails[3114122] = new thumbnail(3114122,'52607','Quoile River','Quoile River 4_thumb.jpg',130, 86,1,'photo_3114122.html');
												thumbnails[3594871] = new thumbnail(3594871,'216256','Sunrise over Lake Wanaka','Pier_sunrise_thumb.jpg',130, 86,1,'photo_3594871.html');
												thumbnails[3594910] = new thumbnail(3594910,'216256','Wanaka Sunset','Posts_mountain_2_thumb.jpg',130, 86,1,'photo_3594910.html');
												thumbnails[3594865] = new thumbnail(3594865,'216256','Twilight Heart','Heart_thumb.jpg',130, 86,1,'photo_3594865.html');
												thumbnails[3629314] = new thumbnail(3629314,'216256','Misty Te Anau','Posts_early_morning_1_thumb.jpg',130, 86,1,'photo_3629314.html');
												thumbnails[3629328] = new thumbnail(3629328,'216256','Sunset Sailing','2_Yachts_2_thumb.jpg',130, 86,1,'photo_3629328.html');
												thumbnails[3675970] = new thumbnail(3675970,'216256','Lakefront Reflections','Lakefront_reflection_thumb.jpg',130, 86,1,'photo_3675970.html');
												thumbnails[3629323] = new thumbnail(3629323,'216256','Te Anau Jetty','Pier_dark_thumb.jpg',130, 86,1,'photo_3629323.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[352235] = new gallery(352235,'6360779','Arran - July 2010','gallery',[6360771,6360772,6360775,6360779,6360802,6360883],0, 0, '', 'gallery_352235.html',0,0);
				  					galleries[156487] = new gallery(156487,'5349290','Latest Northern Ireland Images','gallery',[5349290,5529816,5354086,3859215,5319370,4966599],0, 0, '', 'gallery_156487.html',0,0);
				  					galleries[141075] = new gallery(141075,'283047','Ards Peninsula ','gallery',[605918,2070480,283047,1849406,621042,2120501],0, 0, '', 'gallery_141075.html',0,0);
				  					galleries[52603] = new gallery(52603,'2850160,2498262','Mourne Mountains ','gallery',[2498262,232044,2530956,605920,4922718,672269,3114108,2850160,2418936],0, 0, '', 'gallery_52603.html',0,0);
				  					galleries[52607] = new gallery(52607,'425181','Around Northern Ireland','gallery',[552307,232061,425181,582783,3859220,3091887,2418928,2846366,3114122],0, 0, '', 'gallery_52607.html',0,0);
				  					galleries[52610] = new gallery(52610,'582805','Harbours and Jetties ','gallery',[269486,250541,563873,582805,211675,742920],0, 0, '', 'gallery_52610.html',0,0);
				  					galleries[52614] = new gallery(52614,'232057','Forests, Fields and Flowers ','gallery',[137093,232059,232057,504567,3140777,3816869],0, 0, '', 'gallery_52614.html',0,0);
				  					galleries[52618] = new gallery(52618,'570779,152373','Shapes and Patterns ','gallery',[95230,570779,95228,250540,152373,411134],0, 0, '', 'gallery_52618.html',0,0);
				  					galleries[52622] = new gallery(52622,'250525','Serene Scenes','gallery',[411135,250525,420000,361126,997732,567368],0, 0, '', 'gallery_52622.html',0,0);
				  					galleries[52625] = new gallery(52625,'997739,376190','Beaches and Coastline ','gallery',[3032392,816287,510372,997739,3032388,376190],0, 0, '', 'gallery_52625.html',0,0);
				  					galleries[110331] = new gallery(110331,'2058134','Panoramas ','gallery',[1627845,1627898,2058134],0, 0, '', 'gallery_110331.html',0,0);
				  					galleries[216256] = new gallery(216256,'3629323,3594871,3545229','New Zealand - March 2009','gallery',[3534398,3559787,3559791,3545225,3559786,3545231,3545229,3578997,3594871,3594910,3594865,3629314,3629328,3675970,3629323],0, 0, '', 'gallery_216256.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6360779,4922718,3629328,3629323,3114108,2846366,2498262,570779,563873,283047,250525,232057';
imageSets[2] = '6360779,5349290,3629323,3594871,3545229,2850160,2498262,2058134,997739,582805,570779,425181,376190,283047,250525,232057,152373';
imageSets[3] = '6360883,6360802,6360779,6360775,6360772,6360771,5529816,5354086,5349290,5319370,5131511,4966599,4922718,3859220,3859215,3816869,3675970,3629328,3629323,3629314,3594910,3594871,3594865,3578997,3559791,3559787,3559786,3545231,3545229,3545225,3534398,3140777,3114122,3114108,3091887,3032392,3032388,2850160,2846443,2846366,2530956,2498262,2418936,2418928,2191155,2120501,2070480,2058134,1849406,1710031';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mcsimeyb/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mcsimeyb/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 = 'My Photography Journey: ' + 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 == undefined) {
    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="MCSIMEYB">';
		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;
	}
}

			

