window.thumbnails = new Object();
												thumbnails[1011906] = new thumbnail(1011906,'','Water Lilly','water lilly - logo0011_thumb.jpg',130, 130,15,'#');
												thumbnails[1033081] = new thumbnail(1033081,'75824','Old Blue Door','workshopimg005001_thumb.jpg',98, 130,15,'photo_1033081.html');
												thumbnails[1033120] = new thumbnail(1033120,'76959','Spring Foliage','PICT0359_thumb.jpg',130, 104,15,'photo_1033120.html');
												thumbnails[1300434] = new thumbnail(1300434,'92197','Exhibition Poster','Billboard_Poster1_thumb.jpg',92, 130,15,'photo_1300434.html');
												thumbnails[4250949] = new thumbnail(4250949,'251608','E3 001','Ptks_Br_at_dawn_B304692_thumb.jpg',130, 98,15,'photo_4250949.html');
												thumbnails[1033089] = new thumbnail(1033089,'75824','Wooden Lock','workshopimg006001_thumb.jpg',130, 98,15,'photo_1033089.html');
												thumbnails[1034169] = new thumbnail(1034169,'76959','Cape Iris','Iris Kirstenbosch PICT0010_thumb.jpg',130, 104,15,'photo_1034169.html');
												thumbnails[1300417] = new thumbnail(1300417,'92197','Sunrise at Lapp\'s Quay','E1_001-Sunrise-at-Lapp\'s-Qua_thumb.jpg',130, 98,15,'photo_1300417.html');
												thumbnails[4250984] = new thumbnail(4250984,'251608','E3 002','_9273791_tonemap_thumb.jpg',130, 98,15,'photo_4250984.html');
												thumbnails[1033104] = new thumbnail(1033104,'75824','Padlock & Hasp','corrugated b&w lock0051_thumb.jpg',93, 130,15,'photo_1033104.html');
												thumbnails[1300439] = new thumbnail(1300439,'92197','97 South Mall','E1_002-97-Sth_thumb.-Mall.jpg',98, 130,15,'photo_1300439.html');
												thumbnails[4250997] = new thumbnail(4250997,'251608','E3 003','City_Hall_Final_Colour__8033096_1__thumb.jpg',130, 98,15,'photo_4250997.html');
												thumbnails[2275418] = new thumbnail(2275418,'75814','Sundays Well & \"Shakey Bridge\"','Shakey Bridge crop _6012380 Curve adjust copy_thumb.jpg',130, 98,15,'photo_2275418.html');
												thumbnails[1034168] = new thumbnail(1034168,'76959','Nature\'s Breakfast',' Blister Beetles PICT0036_thumb.jpg',130, 98,15,'photo_1034168.html');
												thumbnails[1034175] = new thumbnail(1034175,'75824','The Window','Open Window_A254059_thumb.jpg',98, 130,15,'photo_1034175.html');
												thumbnails[1300441] = new thumbnail(1300441,'92197','E1 003','E1_003-Shandon_thumb.jpg',98, 130,15,'photo_1300441.html');
												thumbnails[4251175] = new thumbnail(4251175,'251608','E3 004','River_view_from_Kingsley_6202657_thumb.jpg',130, 98,15,'photo_4251175.html');
												thumbnails[2275401] = new thumbnail(2275401,'75814','Red House on River Lee','Red House Reflection 1 _6012365 copy_thumb.jpg',98, 130,15,'photo_2275401.html');
												thumbnails[1300443] = new thumbnail(1300443,'92197','E1 004','E1_004-St_thumb.-Mary\'s-&-Dominica.jpg',98, 130,15,'photo_1300443.html');
												thumbnails[2112483] = new thumbnail(2112483,'76959','Woodland Light 1','Woodland1_thumb.jpg',98, 130,15,'photo_2112483.html');
												thumbnails[4251191] = new thumbnail(4251191,'251608','E3 005','Market_Parade_9273781_thumb.jpg',98, 130,15,'photo_4251191.html');
												thumbnails[2123552] = new thumbnail(2123552,'75814','Bridge at Inniscarra','Inniscarra Bridge for clikpic  _6062441 copy_thumb.jpg',130, 98,15,'photo_2123552.html');
												thumbnails[1300497] = new thumbnail(1300497,'92197','E1 005','E1_005-View-of-Gurranebraher_thumb.jpg',130, 98,15,'photo_1300497.html');
												thumbnails[2112486] = new thumbnail(2112486,'76959','Woodland Light 2','Woodland2_thumb.jpg',97, 130,15,'photo_2112486.html');
												thumbnails[4251223] = new thumbnail(4251223,'251608','E3 006','Ptks_Br__B304692_Toned_Final_thumb.jpg',130, 98,15,'photo_4251223.html');
												thumbnails[1300503] = new thumbnail(1300503,'92197','E1 006','E1_006-Autumn-Morning,-UCC_thumb.jpg',130, 73,15,'photo_1300503.html');
												thumbnails[2112490] = new thumbnail(2112490,'76959','Woodland Light 3','Woodland3_thumb.jpg',98, 130,15,'photo_2112490.html');
												thumbnails[2123543] = new thumbnail(2123543,'75814','Boats at Penrose Wharf','LavittsQuayColour1139506_thumb.jpg',130, 71,15,'photo_2123543.html');
												thumbnails[4251241] = new thumbnail(4251241,'251608','E3 007','English_Market_toned_thumb.jpg',98, 130,15,'photo_4251241.html');
												thumbnails[1300505] = new thumbnail(1300505,'92197','E1 007','E1_007-Before-Dawn-from-Well_thumb.jpg',130, 98,15,'photo_1300505.html');
												thumbnails[2112500] = new thumbnail(2112500,'76959','Woodland Light 4','Woodland4_thumb.jpg',97, 130,15,'photo_2112500.html');
												thumbnails[2123487] = new thumbnail(2123487,'75814','Autumn Panorama, Cork','AutumnPanoramaB067995_thumb.jpg',130, 39,15,'photo_2123487.html');
												thumbnails[4251256] = new thumbnail(4251256,'251608','E3 008','Shandon_Stressed_edges_thumb.jpg',130, 84,15,'photo_4251256.html');
												thumbnails[1300507] = new thumbnail(1300507,'92197','E1 008','E1_008-Sunrise-at-\'Horses\'-S_thumb.jpg',98, 130,15,'photo_1300507.html');
												thumbnails[2123532] = new thumbnail(2123532,'75814','Horse at Sunset, Inniscara','HorseatSunsetB130562_thumb.jpg',130, 98,15,'photo_2123532.html');
												thumbnails[4251301] = new thumbnail(4251301,'251608','E3 009','Rear_Kingsley_sressed_edged1_thumb.jpg',130, 88,15,'photo_4251301.html');
												thumbnails[1300514] = new thumbnail(1300514,'92197','E1 009','E1_009-Twilight,-County-Hal_thumb.jpg',97, 130,15,'photo_1300514.html');
												thumbnails[4251333] = new thumbnail(4251333,'251608','E3 010','Lee_Fields_Frost_Cool_Grey_thumb.jpg',98, 130,15,'photo_4251333.html');
												thumbnails[1300518] = new thumbnail(1300518,'92197','E1 010','E1_010-Misty-Sunrise,-Lee-Va_thumb.jpg',130, 98,15,'photo_1300518.html');
												thumbnails[4251338] = new thumbnail(4251338,'251608','E3 011','St_Finbarrs_Toned_composite_thumb.jpg',98, 130,15,'photo_4251338.html');
												thumbnails[1034135] = new thumbnail(1034135,'75814','Seascape, Capetown','AU06F06_41817660101_thumb.jpg (AN06_418176601.jpg).jpg',130, 98,15,'photo_1034135.html');
												thumbnails[1300522] = new thumbnail(1300522,'92197','E1 011','E1_011-Farmhouse-at-Clogheen_thumb.jpg',130, 70,15,'photo_1300522.html');
												thumbnails[4251357] = new thumbnail(4251357,'251608','E3 012','Ceannt_Station_Frame_edge_thumb.jpg',98, 130,15,'photo_4251357.html');
												thumbnails[1034140] = new thumbnail(1034140,'75814','Lake View, Cederberg','AU06F06_41917840202_thumb.jpg (AN06_419178402.jpg).jpg',130, 98,15,'photo_1034140.html');
												thumbnails[1300526] = new thumbnail(1300526,'92197','E1 012','E1_012-Wildlife-Sanctuary,-B_thumb.jpg',130, 59,15,'photo_1300526.html');
												thumbnails[4251364] = new thumbnail(4251364,'251608','E3 013','Time_Traveller_thumb.jpg',130, 98,15,'photo_4251364.html');
												thumbnails[1034145] = new thumbnail(1034145,'75814','Lake Reflections, Cederberg','Cederberg Lake_4201821_thumb.jpg',130, 98,15,'photo_1034145.html');
												thumbnails[1300528] = new thumbnail(1300528,'92197','E1 013','E1_013-The-Wier-at-Ballincil_thumb.jpg',130, 43,15,'photo_1300528.html');
												thumbnails[4251378] = new thumbnail(4251378,'251608','E3 014','_B224588_89_90_tonemapped_Brighter_thumb.jpg',130, 98,15,'photo_4251378.html');
												thumbnails[1034150] = new thumbnail(1034150,'75814','Rocky Landscape, Cederberg','Cederberg rocky landscape_4201832_thumb.jpg',130, 98,15,'photo_1034150.html');
												thumbnails[1300529] = new thumbnail(1300529,'92197','Horse at Sunset','E1_014-Horse-at-Sunset,-Inni_thumb.jpg',98, 130,15,'photo_1300529.html');
												thumbnails[4251388] = new thumbnail(4251388,'251608','E3 015','B164408__tonemapped_new_sky_thumb.jpg',130, 98,15,'photo_4251388.html');
												thumbnails[1034152] = new thumbnail(1034152,'75814','Rock Vista, Cederberg','Cederberg Rock Vista_4201840_thumb.jpg',130, 98,15,'photo_1034152.html');
												thumbnails[1300564] = new thumbnail(1300564,'92197','E1 015','E1_015-The-Geara-at-Dusk_thumb.jpg',130, 98,15,'photo_1300564.html');
												thumbnails[4251400] = new thumbnail(4251400,'251608','E3 016','RnH_Hall_Stroke_Frame_thumb.jpg',130, 88,15,'photo_4251400.html');
												thumbnails[1034155] = new thumbnail(1034155,'75814','Waterfront, Table Mountain','AU06_B09453901_thumb.jpg',130, 98,15,'photo_1034155.html');
												thumbnails[1300583] = new thumbnail(1300583,'92197','E1 016','E1_016-The-Weir-at-Lee-Field_thumb.jpg',130, 35,15,'photo_1300583.html');
												thumbnails[4251406] = new thumbnail(4251406,'251608','E3 017','Careys_Lane_Fine_edge_frame_thumb.jpg',88, 130,15,'photo_4251406.html');
												thumbnails[1034160] = new thumbnail(1034160,'75814','Lighthouse, Cape Aghulas',' LighthousePICT0065_thumb.jpg',98, 130,15,'photo_1034160.html');
												thumbnails[1331543] = new thumbnail(1331543,'92197','E1 017','E1-017-Sunset-Over-Inniscar_thumb.jpg',130, 98,15,'photo_1331543.html');
												thumbnails[4251434] = new thumbnail(4251434,'251608','E3 018','_1069126_tonemapped1_thumb.jpg',98, 130,15,'photo_4251434.html');
												thumbnails[1034164] = new thumbnail(1034164,'75814','Round House','Round House PICT0002_thumb.jpg',130, 98,15,'photo_1034164.html');
												thumbnails[2353041] = new thumbnail(2353041,'75814','Lee View, Cork','River view from Kingsley_6202657 for web_thumb.jpg',130, 98,15,'photo_2353041.html');
												thumbnails[2089080] = new thumbnail(2089080,'139427','E2/001','E2001_3150663_thumb.jpg',98, 130,15,'photo_2089080.html');
												thumbnails[2331188] = new thumbnail(2331188,'152042','Office artwork 1','  _5132032_thumb.jpg',98, 130,2,'photo_2331188.html');
												thumbnails[2089081] = new thumbnail(2089081,'139427','E2/002','E2002_1059087_thumb.jpg',130, 98,15,'photo_2089081.html');
												thumbnails[2331283] = new thumbnail(2331283,'152042','Office Artwork 2',' _51320431_thumb.jpg',98, 130,2,'photo_2331283.html');
												thumbnails[2089082] = new thumbnail(2089082,'139427','E2/003','E2003_1139506_thumb.jpg',130, 71,15,'photo_2089082.html');
												thumbnails[2331286] = new thumbnail(2331286,'152042','Office Artwork 3','_5132052_thumb.jpg',97, 130,15,'photo_2331286.html');
												thumbnails[2331291] = new thumbnail(2331291,'152042','Office Artwork 4','_5132054_thumb.jpg',98, 130,15,'photo_2331291.html');
												thumbnails[2089084] = new thumbnail(2089084,'139427','E2/004','E2004_1129438_thumb.jpg',130, 98,15,'photo_2089084.html');
												thumbnails[2331289] = new thumbnail(2331289,'152042','Office Artwork 5','_5132059_thumb.jpg',130, 98,15,'photo_2331289.html');
												thumbnails[2089087] = new thumbnail(2089087,'139427','E2/005','E2005_1129444_thumb.jpg',130, 98,15,'photo_2089087.html');
												thumbnails[2331296] = new thumbnail(2331296,'152042','Office Artwork 6',' _5132044_thumb.jpg',98, 130,2,'photo_2331296.html');
												thumbnails[2089089] = new thumbnail(2089089,'139427','E2/006','E2006_1139493_thumb.jpg',130, 71,15,'photo_2089089.html');
												thumbnails[2331304] = new thumbnail(2331304,'152042','Office Artwork 7','_5132064_thumb.jpg',130, 98,15,'photo_2331304.html');
												thumbnails[2089091] = new thumbnail(2089091,'139427','E2/007','E2007_1139497_thumb.jpg',130, 69,15,'photo_2089091.html');
												thumbnails[2089097] = new thumbnail(2089097,'139427','E2/008','E2008_1129458_thumb.jpg',130, 60,15,'photo_2089097.html');
												thumbnails[2089100] = new thumbnail(2089100,'139427','E2/009','E2009_3070401_thumb.jpg',130, 53,15,'photo_2089100.html');
												thumbnails[2089101] = new thumbnail(2089101,'139427','E2/010','E2010_3180832_thumb.jpg',98, 130,15,'photo_2089101.html');
												thumbnails[2099949] = new thumbnail(2099949,'139918','Home Decor, Ballincollig','Night Scene 001 _C108692_thumb.jpg',130, 111,15,'photo_2099949.html');
												thumbnails[2099953] = new thumbnail(2099953,'139918','AIB Bank, Ballincollig','Night Scene 002_C108682_thumb.jpg',98, 130,15,'photo_2099953.html');
												thumbnails[2099955] = new thumbnail(2099955,'139918','Christmas, Shopping Mall, Ballincollig','Night Scene 003 _C108675_thumb.jpg',130, 98,15,'photo_2099955.html');
												thumbnails[2109523] = new thumbnail(2109523,'139918','Christmas,Shopping Mall, Ballincollig (2)','_C108681_thumb.jpg',98, 130,15,'photo_2109523.html');
												thumbnails[2109524] = new thumbnail(2109524,'139918','Acadamy St., Cork','Acadamy St_thumb. , Cork.jpg',98, 130,15,'photo_2109524.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[251608] = new gallery(251608,'4251434,4251406,4251400,4251388,4251378,4251364,4251357,4251338,4251333,4251301','Imagining Cork - an eclectic journey.','gallery',[4250949,4250984,4250997,4251175,4251191,4251223,4251241,4251256,4251301,4251333,4251338,4251357,4251364,4251378,4251388,4251400,4251406,4251434],0, 1, '151476', 'gallery_251608.html',0,0);
				  					galleries[92197] = new gallery(92197,'1331543,1300583,1300564,1300529,1300528,1300526,1300522,1300518,1300514,1300507','Dawn to Dusk, Scene Leeside','gallery',[1300434,1300417,1300439,1300441,1300443,1300497,1300503,1300505,1300507,1300514,1300518,1300522,1300526,1300528,1300529,1300564,1300583,1331543],0, 1, '151476', 'gallery_92197.html',0,0);
				  					galleries[151476] = new gallery(151476,'4251434,4251406,4251400,4251388,4251378,4251364,4251357,4251338,4251333,4251301','Exhibitions','gallery',[],0, 1, '', 'gallery_151476.html',0,0);
				  					galleries[75814] = new gallery(75814,'2353041,2275418,2275401,2123552,2123543,2123532,2123487,1034164,1034160,1034155','Landscapes','gallery',[2275418,2275401,2123552,2123543,2123487,2123532,1034135,1034140,1034145,1034150,1034152,1034155,1034160,1034164,2353041],0, 1, '', 'gallery_75814.html',0,0);
				  					galleries[75824] = new gallery(75824,'1034175,1033104,1033089,1033081','Of Doors & Gates','gallery',[1033081,1033089,1033104,1034175],0, 1, '', 'gallery_75824.html',0,0);
				  					galleries[76959] = new gallery(76959,'2112500,2112490,2112486,2112483,1034169,1034168,1033120','Nature','gallery',[1033120,1034169,1034168,2112483,2112486,2112490,2112500],0, 1, '', 'gallery_76959.html',0,0);
				  					galleries[139427] = new gallery(139427,'2089101,2089100,2089097,2089091,2089089,2089087,2089084,2089082,2089081,2089080','Second Take Leeside','gallery',[2089080,2089081,2089082,2089084,2089087,2089089,2089091,2089097,2089100,2089101],0, 1, '151476', 'gallery_139427.html',0,0);
				  					galleries[139918] = new gallery(139918,'2109524,2109523,2099955,2099953,2099949','After Dark','gallery',[2099949,2099953,2099955,2109523,2109524],0, 1, '', 'gallery_139918.html',0,0);
				  					galleries[152042] = new gallery(152042,'2331304,2331296,2331291,2331289,2331286,2331283,2331188','Commercial Work','gallery',[2331188,2331283,2331286,2331291,2331289,2331296,2331304],0, 1, '', 'gallery_152042.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '4251434,4251406,4251400,4251388,4251378,4251364,4251357,4251338,4251333,4251301,4251256,4251241,4251223,4251191,4251175,4250997,4250984,4250949,2353041,2331304,2331296,2331291,2331289,2331286,2331283,2331188,2275418,2275401,2123552,2123543,2123532,2123487,2112500,2112490,2112486,2112483,2109524,2109523,2099955,2099953,2099949,2089101,2089100,2089097,2089091,2089089,2089087,2089084,2089082,2089081';
imageSets[3] = '4251434,4251406,4251400,4251388,4251378,4251364,4251357,4251338,4251333,4251301,4251256,4251241,4251223,4251191,4251175,4250997,4250984,4250949,2353041,2331304,2331296,2331291,2331289,2331286,2331283,2331188,2275418,2275401,2123552,2123543,2123532,2123487,2112500,2112490,2112486,2112483,2109524,2109523,2099955,2099953,2099949,2089101,2089100,2089097,2089091,2089089,2089087,2089084,2089082,2089081';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/ianweaver/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/ianweaver/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 = 'Ian Weaver Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object' || array == 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>';
	}
					
				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;
	}
}

		

