window.thumbnails = {};
															thumbnails[5326221] = clik.newPhoto({"id":5326221,"src":"DSCN4433clik_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Somewhere in the Alps","height":98});
															thumbnails[5326227] = clik.newPhoto({"id":5326227,"src":"DSCN3615clik1_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Strada Statale Dello Stelvio","height":98});
															thumbnails[5329131] = clik.newPhoto({"id":5329131,"src":"DSCN4429sd_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Sauze D'oulx","height":98});
															thumbnails[5329171] = clik.newPhoto({"id":5329171,"src":"Sicily_Corner_Clik_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Riding Sicily","height":64});
															thumbnails[7247878] = clik.newPhoto({"id":7247878,"src":"_DSC0118_clik_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Trireme Harbour","height":87});
															thumbnails[5326254] = clik.newPhoto({"id":5326254,"src":"DSCN4291clik_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Secret of Sicily","height":98});
															thumbnails[5329199] = clik.newPhoto({"id":5329199,"src":"DSCN3639clik_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Solden in the fog","height":98});
															thumbnails[5330152] = clik.newPhoto({"id":5330152,"src":"DSCN4347mt-pellegrino_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Palermo from Mt Pellegrino","height":98});
															thumbnails[5339494] = clik.newPhoto({"id":5339494,"src":"Sankt-Christof_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Sankt Leonard Pass","height":98});
															thumbnails[7213741] = clik.newPhoto({"id":7213741,"src":"_DSC2169_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Valle de Ordesa","height":196});
															thumbnails[7203676] = clik.newPhoto({"id":7203676,"src":"_DSC2782_1_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Gatteville Le Phare","height":196});
															thumbnails[1092332] = clik.newPhoto({"id":1092332,"src":"DSC0051wm1_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"H2O Theatre","height":87});
															thumbnails[5345272] = clik.newPhoto({"id":5345272,"src":"Hillrecovery_pan_650_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Hill Recovery","height":35});
															thumbnails[5339336] = clik.newPhoto({"id":5339336,"src":"Riding_H20_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Riding H2O","height":73});
															thumbnails[5339372] = clik.newPhoto({"id":5339372,"src":"Riding_H20_II_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Knee deep in H2O","height":64});
															thumbnails[5339381] = clik.newPhoto({"id":5339381,"src":"Long-way-down-II_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Long way down","height":76});
															thumbnails[1746532] = clik.newPhoto({"id":1746532,"src":"_DSC0026clik_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Rhodes Harbour","height":83});
															thumbnails[1749490] = clik.newPhoto({"id":1749490,"src":"_DSC0022clik_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Limin Emborikos","height":84});
															thumbnails[7231160] = clik.newPhoto({"id":7231160,"src":"_DSC1482_clik_thumb.jpg","galleries_id":79585,"server_id":15,"link":"photo_7231160.html","width":130,"caption":"Yachts in Pythagoria harbour","height":86});
															thumbnails[7203670] = clik.newPhoto({"id":7203670,"src":"_DSC2785_1_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_7203670.html","width":130,"caption":"Gatteville le Phare","height":78});
															thumbnails[7214894] = clik.newPhoto({"id":7214894,"src":"_DSC2853_thumb.jpg","galleries_id":79585,"server_id":15,"link":"photo_7214894.html","width":130,"caption":"Cherbourg Harbour","height":190});
															thumbnails[7247598] = clik.newPhoto({"id":7247598,"src":"_DSC1422_clik_thumb.jpg","galleries_id":79585,"server_id":15,"link":"photo_7247598.html","width":130,"caption":"Arki Jetty","height":196});
															thumbnails[7247793] = clik.newPhoto({"id":7247793,"src":"_DSC0888_clik_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_7247793.html","width":130,"caption":"Beach in Christchurch","height":87});
															thumbnails[4787857] = clik.newPhoto({"id":4787857,"src":"DSC_0007copy_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_4787857.html","width":130,"caption":"Gondola Pier","height":87});
															thumbnails[4787934] = clik.newPhoto({"id":4787934,"src":"_DSC0190c_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_4787934.html","width":130,"caption":"Pirates Cove","height":87});
															thumbnails[4793576] = clik.newPhoto({"id":4793576,"src":"_DSC0005clik_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_4793576.html","width":130,"caption":"RYS","height":87});
															thumbnails[4793580] = clik.newPhoto({"id":4793580,"src":"_DSC0007copy_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_4793580.html","width":130,"caption":"The boys of H2O ","height":87});
															thumbnails[4804594] = clik.newPhoto({"id":4804594,"src":"DSC_0123_thumb.jpg","galleries_id":79585,"server_id":15,"link":"photo_4804594.html","width":130,"caption":"Italian Job","height":87});
															thumbnails[4840861] = clik.newPhoto({"id":4840861,"src":"_DSC0007clik_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_4840861.html","width":130,"caption":"Sun Downer","height":87});
															thumbnails[7349950] = clik.newPhoto({"id":7349950,"src":"DCS143wm_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_7349950.html","width":130,"caption":"Friendly Jelly","height":88});
															thumbnails[7349977] = clik.newPhoto({"id":7349977,"src":"_DSC0347_c_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_7349977.html","width":130,"caption":"Warrior's Baby","height":86});
															thumbnails[7351361] = clik.newPhoto({"id":7351361,"src":"DSC0482wm_thumb.jpg","galleries_id":79585,"server_id":15,"link":"photo_7351361.html","width":130,"caption":"Entering Port","height":87});
															thumbnails[7351394] = clik.newPhoto({"id":7351394,"src":"DSC0071wm_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_7351394.html","width":130,"caption":"After the Meltemi","height":87});
															thumbnails[7351484] = clik.newPhoto({"id":7351484,"src":"DSCN1833wm_thumb.jpg","galleries_id":79585,"server_id":15,"link":"photo_7351484.html","width":130,"caption":"Aegean Landfall","height":96});
															thumbnails[7599071] = clik.newPhoto({"id":7599071,"src":"_DSC0042_copy_thumb.jpg","galleries_id":79573,"server_id":15,"link":"photo_7599071.html","width":130,"caption":"French Superyacht","height":87});
															thumbnails[5021019] = clik.newPhoto({"id":5021019,"src":"DSC0394wm_thumb.jpg","galleries_id":79573,"server_id":15,"link":"photo_5021019.html","width":130,"caption":"HMS Warrior","height":87});
															thumbnails[4793976] = clik.newPhoto({"id":4793976,"src":"_DSC0071clik_thumb.jpg","galleries_id":79573,"server_id":15,"link":"photo_4793976.html","width":130,"caption":"M\/Y Savarona","height":87});
															thumbnails[1086087] = clik.newPhoto({"id":1086087,"src":"DSC0118wm2_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_1086087.html","width":130,"caption":"Quaint Harbour","height":87});
															thumbnails[4813019] = clik.newPhoto({"id":4813019,"src":"_DSC0087-1_thumb.jpg","galleries_id":273723,"server_id":15,"link":"photo_4813019.html","width":130,"caption":"Extreme 40","height":194});
															thumbnails[1086076] = clik.newPhoto({"id":1086076,"src":"DSC0037wm1_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_1086076.html","width":130,"caption":"Golden Hour","height":82});
															thumbnails[4806664] = clik.newPhoto({"id":4806664,"src":"_DSC0120_thumb.jpg","galleries_id":273723,"server_id":15,"link":"photo_4806664.html","width":130,"caption":"Spinnaker run","height":194});
															thumbnails[5022279] = clik.newPhoto({"id":5022279,"src":"DSCN3979clik_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_5022279.html","width":130,"caption":"Trinity House 1945","height":173});
															thumbnails[7247783] = clik.newPhoto({"id":7247783,"src":"_DSC1138_clik_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_7247783.html","width":130,"caption":"Ferry Leaving Hook of Holland","height":196});
															thumbnails[1085919] = clik.newPhoto({"id":1085919,"src":"DSC0195wm_thumb.jpg","galleries_id":79573,"server_id":15,"link":"photo_1085919.html","width":130,"caption":"Brig Leaving Port","height":87});
															thumbnails[1088878] = clik.newPhoto({"id":1088878,"src":"DSC0053wm2_thumb.jpg","galleries_id":273723,"server_id":15,"link":"photo_1088878.html","width":130,"caption":"Single Handed","height":188});
															thumbnails[1271843] = clik.newPhoto({"id":1271843,"src":"_DSC0107clik_thumb.jpg","galleries_id":79573,"server_id":15,"link":"photo_1271843.html","width":130,"caption":"M\/Y Halas","height":87});
															thumbnails[4804697] = clik.newPhoto({"id":4804697,"src":"DSC_0039_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_4804697.html","width":130,"caption":"Storico Navale","height":194});
															thumbnails[4972174] = clik.newPhoto({"id":4972174,"src":"DSC0054wm_thumb.jpg","galleries_id":273723,"server_id":15,"link":"photo_4972174.html","width":130,"caption":"Close Hauled","height":194});
															thumbnails[1088688] = clik.newPhoto({"id":1088688,"src":"DSC0206wm1_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_1088688.html","width":130,"caption":"Island Dream","height":87});
															thumbnails[1219578] = clik.newPhoto({"id":1219578,"src":"_DSC0076wm_thumb.jpg","galleries_id":273723,"server_id":15,"link":"photo_1219578.html","width":130,"caption":"Fine Reach","height":194});
															thumbnails[5020763] = clik.newPhoto({"id":5020763,"src":"_DSC0001clik_ABA9BE13-1D09-001F-99193C22A1A538DF_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_5020763.html","width":130,"caption":"Bow spirit","height":194});
															thumbnails[5022264] = clik.newPhoto({"id":5022264,"src":"_DSC0052clik_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_5022264.html","width":130,"caption":"South Harbour","height":87});
															thumbnails[4793584] = clik.newPhoto({"id":4793584,"src":"_DSC0034copy_thumb.jpg","galleries_id":273723,"server_id":15,"link":"photo_4793584.html","width":130,"caption":"Downwind leg","height":87});
															thumbnails[7286890] = clik.newPhoto({"id":7286890,"src":"DSC0125_clik_thumb.jpg","galleries_id":273723,"server_id":15,"link":"photo_7286890.html","width":130,"caption":"Venetian Sail","height":69});
															thumbnails[1216867] = clik.newPhoto({"id":1216867,"src":"_DSC0105wm_thumb.jpg","galleries_id":79585,"server_id":15,"link":"photo_1216867.html","width":130,"caption":"Thro' the Chanel","height":87});
															thumbnails[1460099] = clik.newPhoto({"id":1460099,"src":"_DSC0066_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_1460099.html","width":130,"caption":"Dawn at Anchor","height":87});
															thumbnails[1218154] = clik.newPhoto({"id":1218154,"src":"_DSC0017wm_thumb.jpg","galleries_id":274329,"server_id":15,"link":"photo_1218154.html","width":130,"caption":"Sun Set West","height":87});
															thumbnails[1088942] = clik.newPhoto({"id":1088942,"src":"DSC0049wm2_thumb.jpg","galleries_id":79585,"server_id":15,"link":"photo_1088942.html","width":130,"caption":"H2O World","height":87});
															thumbnails[4826741] = clik.newPhoto({"id":4826741,"src":"_DSC0102_clik_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_4826741.html","width":130,"caption":"Depression on H2O","height":87});
															thumbnails[1092859] = clik.newPhoto({"id":1092859,"src":"DSC0015wm_thumb.jpg","galleries_id":79546,"server_id":15,"link":"photo_1092859.html","width":130,"caption":"Deep Blue","height":85});
															thumbnails[8687322] = clik.newPhoto({"id":8687322,"src":"_DSC5621_thumb.jpg","galleries_id":273723,"server_id":15,"link":"photo_8687322.html","width":130,"caption":"Americas Cup","height":78});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[273723] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"H2O Action","link":"gallery_273723.html","maxRecords":0.0,"photoIDs":[4813019.0,4806664.0,1088878.0,4972174.0,1219578.0,4793584.0,7286890.0,8687322.0],"skipIndex":0,"section_code":"gallery","featured_images":7286890.0,"id":273723,"singleSection":false});				  						galleries[79585] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Yachting World","link":"gallery_79585.html","maxRecords":0.0,"photoIDs":[7231160.0,7214894.0,7247598.0,4804594.0,7351361.0,7351484.0,1216867.0,1088942.0],"skipIndex":0,"section_code":"gallery","featured_images":"7351484,7351361,7231160,4804594,1216867,1088942","id":79585,"singleSection":false});				  						galleries[79546] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Seascapes","link":"gallery_79546.html","maxRecords":0.0,"photoIDs":[7203670.0,7247793.0,4787857.0,4787934.0,4840861.0,7351394.0,1086087.0,1086076.0,1088688.0,1460099.0,4826741.0,1092859.0],"skipIndex":0,"section_code":"gallery","featured_images":"7351394,7203670,4840861,4826741,4787934,4787857,1460099,1092859,1088688,1086087,1086076","id":79546,"singleSection":false});				  						galleries[274329] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nautical ","link":"gallery_274329.html","maxRecords":0.0,"photoIDs":[4793576.0,4793580.0,7349950.0,7349977.0,5022279.0,7247783.0,4804697.0,5020763.0,5022264.0,1218154.0],"skipIndex":0,"section_code":"gallery","featured_images":"7349977,7349950,5022264,4793576,1218154","id":274329,"singleSection":false});				  						galleries[79573] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Boats","link":"gallery_79573.html","maxRecords":0.0,"photoIDs":[7599071.0,5021019.0,4793976.0,1085919.0,1271843.0],"skipIndex":0,"section_code":"gallery","featured_images":"5021019,4793976,1271843,1085919","id":79573,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8687322';
imageSets[2] = '7351484,7351394,7351361,7349977,7349950,7247878,7231160,7203670,5329199,5329171,5329131,5326221,4840861,4804594,4793576,4787934,4787857,5021019,5345272,4793976,1092332,1086087,5339336,1086076,5339372,1085919,5339381,1271843,5022264,1088688,7286890,1746532,1749490,1216867,1460099,1218154,1088942,4826741,1092859';
imageSets[3] = '7247793';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/Teleman/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/Teleman/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/Teleman/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/Teleman/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/Teleman/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/Teleman/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/Teleman/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:'',$detailContainer:'',
                    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 (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'H2O Images: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		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.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			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', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		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 += '<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({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* 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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

