window.thumbnails = {};
															thumbnails[8321027] = clik.newPhoto({"id":8321027,"src":"Lynne_thumb.jpg","galleries_id":"","server_id":38,"link":"#","width":130,"caption":"Lynne","height":154});
															thumbnails[5006120] = clik.newPhoto({"id":5006120,"src":"Red_Jacket_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5006120.html","width":130,"caption":"Red Jacket<br>\r\n","height":182});
															thumbnails[5047525] = clik.newPhoto({"id":5047525,"src":"Clock_Shop_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5047525.html","width":130,"caption":"Clock Shop","height":86});
															thumbnails[5047529] = clik.newPhoto({"id":5047529,"src":"Enchanted_Wood_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_5047529.html","width":130,"caption":"Enchanted Tree","height":102});
															thumbnails[5047531] = clik.newPhoto({"id":5047531,"src":"The_Tell_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5047531.html","width":130,"caption":"The Tell","height":183});
															thumbnails[5119189] = clik.newPhoto({"id":5119189,"src":"Coffee_Teller_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5119189.html","width":130,"caption":"Coffee Teller","height":168});
															thumbnails[5119217] = clik.newPhoto({"id":5119217,"src":"Oasis_Rhythm_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5119217.html","width":130,"caption":"Oasis Rhythm","height":156});
															thumbnails[5119218] = clik.newPhoto({"id":5119218,"src":"Raffia_Bow_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5119218.html","width":130,"caption":"Raffia Bow","height":157});
															thumbnails[5119236] = clik.newPhoto({"id":5119236,"src":"Reverie_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5119236.html","width":130,"caption":"Reverie","height":134});
															thumbnails[5119237] = clik.newPhoto({"id":5119237,"src":"Siblings_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5119237.html","width":130,"caption":"Siblings","height":156});
															thumbnails[5119239] = clik.newPhoto({"id":5119239,"src":"Waiting_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5119239.html","width":130,"caption":"Waiting","height":190});
															thumbnails[5119240] = clik.newPhoto({"id":5119240,"src":"White_Handkerchief_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5119240.html","width":130,"caption":"White Handkerchief","height":171});
															thumbnails[5177133] = clik.newPhoto({"id":5177133,"src":"Lynne001web_thumb.jpg","galleries_id":297485,"server_id":18,"link":"photo_5177133.html","width":130,"caption":"Lynne at Joun, above Sidon","height":171});
															thumbnails[5208639] = clik.newPhoto({"id":5208639,"src":"Africa001_thumb.jpg","galleries_id":293961,"server_id":18,"link":"photo_5208639.html","width":130,"caption":"Young Masai Woman","height":98});
															thumbnails[5288670] = clik.newPhoto({"id":5288670,"src":"Penny_thumb.jpg","galleries_id":297485,"server_id":18,"link":"photo_5288670.html","width":130,"caption":"Penny at Joun, above Sidon","height":173});
															thumbnails[5342426] = clik.newPhoto({"id":5342426,"src":"Lynne_on_North_Beach_thumb.jpg","galleries_id":300705,"server_id":18,"link":"photo_5342426.html","width":130,"caption":"Lynne on North Beach, Gallipoli - April 2001","height":98});
															thumbnails[5343489] = clik.newPhoto({"id":5343489,"src":"Bird_over_Rescue_Site_thumb.jpg","galleries_id":300705,"server_id":18,"link":"photo_5343489.html","width":130,"caption":"Bird over Rescue Site","height":100});
															thumbnails[5360544] = clik.newPhoto({"id":5360544,"src":"Sarajevo_House_1_thumb.jpg","galleries_id":298800,"server_id":18,"link":"photo_5360544.html","width":130,"caption":"Sarajevo House","height":101});
															thumbnails[5360640] = clik.newPhoto({"id":5360640,"src":"Dolls_thumb.jpg","galleries_id":298800,"server_id":18,"link":"photo_5360640.html","width":130,"caption":"Turkish Doll with Bosnian Friends","height":76});
															thumbnails[5367627] = clik.newPhoto({"id":5367627,"src":"Mona_Trad001_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5367627.html","width":130,"caption":"Mona Trad and the Wall for Lebanon","height":86});
															thumbnails[5367681] = clik.newPhoto({"id":5367681,"src":"My_Tree001_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5367681.html","width":130,"caption":"My Giant Tree shouting for Lebanon","height":196});
															thumbnails[5367687] = clik.newPhoto({"id":5367687,"src":"Painting_the_Wall001_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5367687.html","width":130,"caption":"Painting the Wall for Lebanon - 2005","height":90});
															thumbnails[5367699] = clik.newPhoto({"id":5367699,"src":"Devi_and_Maurice001_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5367699.html","width":130,"caption":"Devi and Bradley with Maurice at Harissa","height":193});
															thumbnails[5367726] = clik.newPhoto({"id":5367726,"src":"Bradley001_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5367726.html","width":130,"caption":"Bradley at Byblos","height":87});
															thumbnails[5367848] = clik.newPhoto({"id":5367848,"src":"Devi_and_friends002_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5367848.html","width":130,"caption":"Devi, Maurice and friends at Byblos","height":79});
															thumbnails[5434650] = clik.newPhoto({"id":5434650,"src":"Threshold_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5434650.html","width":130,"caption":"Threshold","height":184});
															thumbnails[5177084] = clik.newPhoto({"id":5177084,"src":"Leaving_Lebanon_thumb.jpg","galleries_id":283118,"server_id":18,"link":"photo_5177084.html","width":130,"caption":"Leaving Lebanon","height":87});
															thumbnails[5310259] = clik.newPhoto({"id":5310259,"src":"Ottoman_Echoes_thumb.jpg","galleries_id":283117,"server_id":18,"link":"photo_5310259.html","width":130,"caption":"Ottoman Echoes","height":173});
															thumbnails[5310279] = clik.newPhoto({"id":5310279,"src":"Reconciliation_thumb.jpg","galleries_id":298800,"server_id":18,"link":"photo_5310279.html","width":130,"caption":"Reconciliation","height":92});
															thumbnails[5340299] = clik.newPhoto({"id":5340299,"src":"Turkish_Doll_thumb.jpg","galleries_id":300705,"server_id":18,"link":"photo_5340299.html","width":130,"caption":"Turkish Doll","height":127});
															thumbnails[5438533] = clik.newPhoto({"id":5438533,"src":"Historical_Costume_13th_century_copy_thumb.jpg","galleries_id":307466,"server_id":18,"link":"photo_5438533.html","width":130,"caption":"Historical costume (male) - 13th century","height":202});
															thumbnails[6612159] = clik.newPhoto({"id":6612159,"src":"Kitchen_Sink_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6612159.html","width":130,"caption":"Kitchen Sink","height":155});
															thumbnails[6934782] = clik.newPhoto({"id":6934782,"src":"Maternity-2_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6934782.html","width":130,"caption":"Maternity","height":168});
															thumbnails[7863168] = clik.newPhoto({"id":7863168,"src":"Daffodils_at_Stanley_Cottage_thumb.jpg","galleries_id":424360,"server_id":18,"link":"photo_7863168.html","width":130,"caption":"Daffodils at Stanley Cottage","height":104});
															thumbnails[5188373] = clik.newPhoto({"id":5188373,"src":"Moonflower_thumb.jpg","galleries_id":283118,"server_id":18,"link":"photo_5188373.html","width":130,"caption":"Moonflowers","height":105});
															thumbnails[5205358] = clik.newPhoto({"id":5205358,"src":"Bridget_thumb.jpg","galleries_id":283118,"server_id":18,"link":"photo_5205358.html","width":130,"caption":"AJ and Bridget","height":87});
															thumbnails[5310447] = clik.newPhoto({"id":5310447,"src":"Samburu_thumb.jpg","galleries_id":293961,"server_id":18,"link":"photo_5310447.html","width":130,"caption":"Samburu","height":105});
															thumbnails[5438608] = clik.newPhoto({"id":5438608,"src":"Female_costume_13th_century_copy_thumb.jpg","galleries_id":307466,"server_id":18,"link":"photo_5438608.html","width":130,"caption":"Female Costume 13th Century","height":208});
															thumbnails[6612166] = clik.newPhoto({"id":6612166,"src":"Ball_of_Wool_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6612166.html","width":130,"caption":"Ball of Wool","height":159});
															thumbnails[6934784] = clik.newPhoto({"id":6934784,"src":"Pebbles_and_Weeds_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6934784.html","width":130,"caption":"Pebbles and weeds","height":92});
															thumbnails[5205367] = clik.newPhoto({"id":5205367,"src":"Balcony_moonflowers_thumb.jpg","galleries_id":283118,"server_id":18,"link":"photo_5205367.html","width":130,"caption":"Moonflowers on the Beirut balcony","height":87});
															thumbnails[5318283] = clik.newPhoto({"id":5318283,"src":"Masai_child_thumb.jpg","galleries_id":293961,"server_id":18,"link":"photo_5318283.html","width":130,"caption":"Masai child","height":182});
															thumbnails[5438601] = clik.newPhoto({"id":5438601,"src":"Enchanted_Garden_copy_thumb.jpg","galleries_id":307466,"server_id":18,"link":"photo_5438601.html","width":130,"caption":"Enchanted Garden","height":189});
															thumbnails[6612194] = clik.newPhoto({"id":6612194,"src":"Samburu_AEA70903-1D09-001F-99415D39E2A815DA_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6612194.html","width":130,"caption":"Samburu","height":104});
															thumbnails[6934785] = clik.newPhoto({"id":6934785,"src":"Sarajevo_Boy_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6934785.html","width":130,"caption":"Sarajevo Boy","height":186});
															thumbnails[5318294] = clik.newPhoto({"id":5318294,"src":"Samburu_woman_thumb.jpg","galleries_id":293961,"server_id":18,"link":"photo_5318294.html","width":130,"caption":"Young Samburu girl","height":172});
															thumbnails[5438605] = clik.newPhoto({"id":5438605,"src":"Dancing_Girl_copy_thumb.jpg","galleries_id":307466,"server_id":18,"link":"photo_5438605.html","width":130,"caption":"Dancing Girl","height":171});
															thumbnails[6612197] = clik.newPhoto({"id":6612197,"src":"African_Woman_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6612197.html","width":130,"caption":"Turkana Woman","height":155});
															thumbnails[5318300] = clik.newPhoto({"id":5318300,"src":"Young_Masai_Girl_thumb.jpg","galleries_id":293961,"server_id":18,"link":"photo_5318300.html","width":130,"caption":"Young Masai girl","height":173});
															thumbnails[5438610] = clik.newPhoto({"id":5438610,"src":"Portrait_of_a_Friend_copy_thumb.jpg","galleries_id":307466,"server_id":18,"link":"photo_5438610.html","width":130,"caption":"Portrait of a friend","height":167});
															thumbnails[6612202] = clik.newPhoto({"id":6612202,"src":"Hubble_Bubble_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6612202.html","width":130,"caption":"Hubble Bubble","height":97});
															thumbnails[5318318] = clik.newPhoto({"id":5318318,"src":"Rendille_Vitality_thumb.jpg","galleries_id":293961,"server_id":18,"link":"photo_5318318.html","width":130,"caption":"Rendille Vitality","height":163});
															thumbnails[6612206] = clik.newPhoto({"id":6612206,"src":"Beirut_Smoke_thumb.jpg","galleries_id":400403,"server_id":18,"link":"photo_6612206.html","width":130,"caption":"Beirut Smoke","height":131});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[400403] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Bartestree Gallery","link":"gallery_400403.html","maxRecords":0.0,"photoIDs":[5047529.0,6612159.0,6934782.0,6612166.0,6934784.0,6612194.0,6934785.0,6612197.0,6612202.0,6612206.0],"skipIndex":0,"section_code":"gallery","featured_images":"6934785,6934784,6934782,6612206,6612202,6612197,6612194,6612166,6612159,5047529","id":400403,"singleSection":false});				  						galleries[424360] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"New Works","link":"gallery_424360.html","maxRecords":0.0,"photoIDs":[7863168.0],"skipIndex":0,"section_code":"gallery","featured_images":7863168.0,"id":424360,"singleSection":false});				  						galleries[297485] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Travels in Lebanon with Penny","link":"gallery_297485.html","maxRecords":0.0,"photoIDs":[5177133.0,5288670.0],"skipIndex":0,"section_code":"gallery","featured_images":"5288670,5177133","id":297485,"singleSection":false});				  						galleries[283118] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Leaving the Levant","link":"gallery_283118.html","maxRecords":0.0,"photoIDs":[5177084.0,5188373.0,5205358.0,5205367.0],"skipIndex":0,"section_code":"gallery","featured_images":"5205367,5205358,5188373,5177084","id":283118,"singleSection":false});				  						galleries[298800] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The Balkans","link":"gallery_298800.html","maxRecords":0.0,"photoIDs":[5360544.0,5360640.0,5310279.0],"skipIndex":0,"section_code":"gallery","featured_images":"5360640,5360544,5310279","id":298800,"singleSection":false});				  						galleries[300705] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Turkey","link":"gallery_300705.html","maxRecords":0.0,"photoIDs":[5342426.0,5343489.0,5340299.0],"skipIndex":0,"section_code":"gallery","featured_images":"5343489,5342426,5340299","id":300705,"singleSection":false});				  						galleries[293961] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Africa","link":"gallery_293961.html","maxRecords":0.0,"photoIDs":[5208639.0,5310447.0,5318283.0,5318294.0,5318300.0,5318318.0],"skipIndex":0,"section_code":"gallery","featured_images":"5318318,5318300,5318294,5318283,5310447,5208639","id":293961,"singleSection":false});				  						galleries[307466] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"The Early Years","link":"gallery_307466.html","maxRecords":0.0,"photoIDs":[5438533.0,5438608.0,5438601.0,5438605.0,5438610.0],"skipIndex":0,"section_code":"gallery","featured_images":"5438610,5438608,5438605,5438601,5438533","id":307466,"singleSection":false});				  						galleries[283117] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Lebanon and Syria","link":"gallery_283117.html","maxRecords":0.0,"photoIDs":[5006120.0,5047525.0,5047531.0,5119189.0,5119217.0,5119218.0,5119236.0,5119237.0,5119239.0,5119240.0,5367627.0,5367681.0,5367687.0,5367699.0,5367726.0,5367848.0,5434650.0,5310259.0],"skipIndex":0,"section_code":"gallery","featured_images":"5434650,5367848,5367726,5367699,5367687,5367681,5367627,5310259,5119240,5119239","id":283117,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8321027';
imageSets[3] = '8321027,7863168,6934785,6934784,6934782,6612206,6612202,6612197,6612194,6612166,6612159,5438610,5438608,5438605,5438601,5438533,5434650,5367848,5367726,5367699,5367687,5367681,5367627,5360640,5360544,5343489,5342426,5340299,5318318,5318300,5318294,5318283,5310447,5310279,5310259,5288670,5208639,5205367,5205358,5188373,5177133,5177084,5119240,5119239,5119237,5119236,5119218,5119217,5119189,5047531';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lynnepoole/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/lynnepoole/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 = 'Lynne Poole 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> ' + (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({					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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

