window.thumbnails = {};
															thumbnails[9008427] = clik.newPhoto({"id":9008427,"src":"IMG_0192_thumb.jpg","galleries_id":221215,"server_id":32,"link":"photo_9008427.html","width":160,"caption":"Conques","height":160});
															thumbnails[9008441] = clik.newPhoto({"id":9008441,"src":"IMG_0877_thumb.jpg","galleries_id":221215,"server_id":32,"link":"photo_9008441.html","width":160,"caption":"Rannoch Moor - Glencoe","height":160});
															thumbnails[9008465] = clik.newPhoto({"id":9008465,"src":"IMG_0910_thumb.jpg","galleries_id":221215,"server_id":32,"link":"photo_9008465.html","width":160,"caption":"Rannoch Moor - Glencoe","height":160});
															thumbnails[9008505] = clik.newPhoto({"id":9008505,"src":"IMG_0760_thumb.jpg","galleries_id":221215,"server_id":32,"link":"photo_9008505.html","width":160,"caption":"Loch Lomond - South","height":160});
															thumbnails[9018248] = clik.newPhoto({"id":9018248,"src":"IMG_9468_thumb_13443FC9-1EC9-DFB6-09ACC5F78FBC0253.jpg","galleries_id":474367,"server_id":32,"link":"photo_9018248.html","width":160,"caption":"","height":160});
															thumbnails[5142302] = clik.newPhoto({"id":5142302,"src":"face2_thumb_9823F290-1EC9-D45B-1C9B762FDA7DBD20.jpg","galleries_id":221215,"server_id":32,"link":"photo_5142302.html","width":160,"caption":"Sgwd Gwladys Waterfall","height":160});
															thumbnails[9008414] = clik.newPhoto({"id":9008414,"src":"IMG_0195_thumb.jpg","galleries_id":221215,"server_id":32,"link":"photo_9008414.html","width":160,"caption":"Conques","height":160});
															thumbnails[9008750] = clik.newPhoto({"id":9008750,"src":"IMG_0601_thumb.jpg","galleries_id":221215,"server_id":32,"link":"photo_9008750.html","width":160,"caption":"Carding Mill Valley","height":160});
															thumbnails[9018946] = clik.newPhoto({"id":9018946,"src":"IMG_0036_thumb_159F2C6C-1EC9-DFB6-09D79C299FAEC5CE.JPG","galleries_id":191440,"server_id":32,"link":"photo_9018946.html","width":160,"caption":"Zumba Fitness","height":160});
															thumbnails[9019016] = clik.newPhoto({"id":9019016,"src":"IMG_0064_thumb.JPG","galleries_id":191440,"server_id":32,"link":"photo_9019016.html","width":160,"caption":"Zumba Fitness","height":160});
															thumbnails[9019048] = clik.newPhoto({"id":9019048,"src":"IMG_5002_thumb_165B8E86-24E8-5EC4-4F3A0D30BCF9596F.JPG","galleries_id":290597,"server_id":32,"link":"photo_9019048.html","width":160,"caption":"Guitarist","height":160});
															thumbnails[3125148] = clik.newPhoto({"id":3125148,"src":"millie_thumb.jpg","galleries_id":191440,"server_id":32,"link":"photo_3125148.html","width":130,"caption":"Joys of Motherhoood","height":73});
															thumbnails[3125762] = clik.newPhoto({"id":3125762,"src":"IMG_1752_thumb_135D1A93-1EC9-DFB6-09577C86D18F3658.jpg","galleries_id":474367,"server_id":32,"link":"photo_3125762.html","width":160,"caption":"","height":160});
															thumbnails[3125980] = clik.newPhoto({"id":3125980,"src":"IMG_1761_thumb_1362464E-1EC9-DFB6-09383A0BAC8AD86F.jpg","galleries_id":474367,"server_id":32,"link":"photo_3125980.html","width":160,"caption":"","height":160});
															thumbnails[3125986] = clik.newPhoto({"id":3125986,"src":"IMG_1751a_thumb_13671371-1EC9-DFB6-096ABB7293C9143E.jpg","galleries_id":474367,"server_id":32,"link":"photo_3125986.html","width":160,"caption":"","height":160});
															thumbnails[3125997] = clik.newPhoto({"id":3125997,"src":"IMG_1765_thumb_136AE27C-1EC9-DFB6-09642B5EDCF2E943.jpg","galleries_id":474367,"server_id":32,"link":"photo_3125997.html","width":160,"caption":"","height":160});
															thumbnails[3130177] = clik.newPhoto({"id":3130177,"src":"IMG_1143a_thumb_136E5145-1EC9-DFB6-09C414405C228D7B.jpg","galleries_id":474367,"server_id":32,"link":"photo_3130177.html","width":160,"caption":"","height":160});
															thumbnails[3130215] = clik.newPhoto({"id":3130215,"src":"IMG_11424a_thumb_1371E9BE-1EC9-DFB6-09708C34D842F364.jpg","galleries_id":474367,"server_id":32,"link":"photo_3130215.html","width":160,"caption":"","height":160});
															thumbnails[3137843] = clik.newPhoto({"id":3137843,"src":"kez1_thumb_13759EF2-1EC9-DFB6-093817E35B9C115A.jpg","galleries_id":474367,"server_id":32,"link":"photo_3137843.html","width":160,"caption":"","height":160});
															thumbnails[3149369] = clik.newPhoto({"id":3149369,"src":"IMG_1438_thumb_98D65F95-1EC9-D45B-1CC775D914813A0B.JPG","galleries_id":191440,"server_id":32,"link":"photo_3149369.html","width":160,"caption":"","height":160});
															thumbnails[3149854] = clik.newPhoto({"id":3149854,"src":"WAA2_thumb_1388ED98-1EC9-DFB6-09AA9C37154A531F.jpg","galleries_id":474367,"server_id":32,"link":"photo_3149854.html","width":160,"caption":"","height":160});
															thumbnails[3297140] = clik.newPhoto({"id":3297140,"src":"IMG_1410_thumb.JPG","galleries_id":191440,"server_id":32,"link":"photo_3297140.html","width":130,"caption":"","height":87});
															thumbnails[3297158] = clik.newPhoto({"id":3297158,"src":"IMG_1422_thumb.JPG","galleries_id":191440,"server_id":32,"link":"photo_3297158.html","width":130,"caption":"","height":184});
															thumbnails[3375696] = clik.newPhoto({"id":3375696,"src":"IMG_1315_thumb.JPG","galleries_id":191440,"server_id":32,"link":"photo_3375696.html","width":130,"caption":"","height":87});
															thumbnails[3545429] = clik.newPhoto({"id":3545429,"src":"hjg_thumb_138C9F86-1EC9-DFB6-0936B12740D655AE.jpg","galleries_id":474367,"server_id":32,"link":"photo_3545429.html","width":160,"caption":"","height":160});
															thumbnails[3569903] = clik.newPhoto({"id":3569903,"src":"prom3_thumb.jpg","galleries_id":191440,"server_id":32,"link":"photo_3569903.html","width":130,"caption":"","height":195});
															thumbnails[3569911] = clik.newPhoto({"id":3569911,"src":"prom2_thumb.jpg","galleries_id":191440,"server_id":32,"link":"photo_3569911.html","width":130,"caption":"","height":195});
															thumbnails[3579720] = clik.newPhoto({"id":3579720,"src":"rw2_thumb_138FC885-1EC9-DFB6-09FCD60618127DAE.jpg","galleries_id":474367,"server_id":32,"link":"photo_3579720.html","width":160,"caption":"","height":160});
															thumbnails[3580614] = clik.newPhoto({"id":3580614,"src":"IMG_1742_thumb_1394730E-1EC9-DFB6-099ACC2722E617A1.JPG","galleries_id":474367,"server_id":32,"link":"photo_3580614.html","width":160,"caption":"","height":160});
															thumbnails[3615038] = clik.newPhoto({"id":3615038,"src":"IMG_0532_thumb_13980407-1EC9-DFB6-09A4DF90BD0D4E8B.JPG","galleries_id":474367,"server_id":32,"link":"photo_3615038.html","width":160,"caption":"","height":160});
															thumbnails[3615182] = clik.newPhoto({"id":3615182,"src":"IMG_6532_thumb.JPG","galleries_id":191440,"server_id":32,"link":"photo_3615182.html","width":130,"caption":"","height":87});
															thumbnails[4722631] = clik.newPhoto({"id":4722631,"src":"IMG_3987a_thumb_139FCCDF-1EC9-DFB6-0947345F02A19747.jpg","galleries_id":474367,"server_id":32,"link":"photo_4722631.html","width":160,"caption":"","height":160});
															thumbnails[4722712] = clik.newPhoto({"id":4722712,"src":"IMG_7132_thumb_139BE19E-1EC9-DFB6-09DA0279466A6269.JPG","galleries_id":474367,"server_id":32,"link":"photo_4722712.html","width":160,"caption":"","height":160});
															thumbnails[5141719] = clik.newPhoto({"id":5141719,"src":"ab1_thumb_13A3B623-1EC9-DFB6-0917F1CEA81DD456.jpg","galleries_id":474367,"server_id":32,"link":"photo_5141719.html","width":160,"caption":"","height":160});
															thumbnails[5141915] = clik.newPhoto({"id":5141915,"src":"ab3_thumb_13A7941E-1EC9-DFB6-098A53F7DFA9812B.jpg","galleries_id":474367,"server_id":32,"link":"photo_5141915.html","width":160,"caption":"","height":160});
															thumbnails[5142008] = clik.newPhoto({"id":5142008,"src":"concert1_thumb_9AAC1168-1EC9-D45B-1CFA1F01202C23BB.jpg","galleries_id":290597,"server_id":32,"link":"photo_5142008.html","width":160,"caption":"Pink","height":160});
															thumbnails[6760449] = clik.newPhoto({"id":6760449,"src":"IMG_6107_thumb_13AB4EC6-1EC9-DFB6-09EEAA3928692E7A.JPG","galleries_id":474367,"server_id":32,"link":"photo_6760449.html","width":160,"caption":"","height":160});
															thumbnails[6760472] = clik.newPhoto({"id":6760472,"src":"IMG_6112_thumb_13AF411F-1EC9-DFB6-09F3C48F9F810263.JPG","galleries_id":474367,"server_id":32,"link":"photo_6760472.html","width":160,"caption":"","height":160});
															thumbnails[6760589] = clik.newPhoto({"id":6760589,"src":"IMG_6114_thumb_13B3A992-1EC9-DFB6-094A205C681038AA.JPG","galleries_id":474367,"server_id":32,"link":"photo_6760589.html","width":160,"caption":"","height":160});
															thumbnails[7348622] = clik.newPhoto({"id":7348622,"src":"IMG_62491_thumb_13B7B71B-1EC9-DFB6-09CB49AA9941D09A.JPG","galleries_id":474367,"server_id":32,"link":"photo_7348622.html","width":160,"caption":"","height":160});
															thumbnails[7348667] = clik.newPhoto({"id":7348667,"src":"IMG_8385_thumb_984015EE-1EC9-D45B-1CA85C1048BEA24D.JPG","galleries_id":474367,"server_id":32,"link":"photo_7348667.html","width":160,"caption":"","height":160});
															thumbnails[7348721] = clik.newPhoto({"id":7348721,"src":"IMG_8408_thumb_13BBCEE0-1EC9-DFB6-09F0F714C58D7B25.JPG","galleries_id":474367,"server_id":32,"link":"photo_7348721.html","width":160,"caption":"","height":160});
															thumbnails[7348891] = clik.newPhoto({"id":7348891,"src":"IMG_8703_thumb_13BFE950-1EC9-DFB6-090507196AADA12B.JPG","galleries_id":474367,"server_id":32,"link":"photo_7348891.html","width":160,"caption":"","height":160});
															thumbnails[7350432] = clik.newPhoto({"id":7350432,"src":"IMG_5042_thumb_9AF03061-1EC9-D45B-1C753427DEE21F9A.JPG","galleries_id":290597,"server_id":32,"link":"photo_7350432.html","width":160,"caption":"Follow The Fallen","height":160});
															thumbnails[7350862] = clik.newPhoto({"id":7350862,"src":"IMG_5039_thumb_9ADF620A-1EC9-D45B-1C15ED5FCD482F2A.JPG","galleries_id":290597,"server_id":32,"link":"photo_7350862.html","width":160,"caption":"Jack","height":160});
															thumbnails[7351477] = clik.newPhoto({"id":7351477,"src":"IMG_6760_thumb_13C59522-1EC9-DFB6-092734309F885328.JPG","galleries_id":474367,"server_id":32,"link":"photo_7351477.html","width":160,"caption":"","height":160});
															thumbnails[7351629] = clik.newPhoto({"id":7351629,"src":"P1030353_thumb_9AB9DADD-1EC9-D45B-1C4EFA35859B80F1.JPG","galleries_id":290597,"server_id":32,"link":"photo_7351629.html","width":160,"caption":"Jon Bon Jovi and Richie Sambora","height":160});
															thumbnails[7360512] = clik.newPhoto({"id":7360512,"src":"IMG_4965_thumb_9AFBE1E4-1EC9-D45B-1C999827F84C2B6D.JPG","galleries_id":290597,"server_id":32,"link":"photo_7360512.html","width":160,"caption":"Jonny","height":160});
															thumbnails[7360625] = clik.newPhoto({"id":7360625,"src":"IMG_3975_thumb_13C96521-1EC9-DFB6-093D985DB0C8A5F6.JPG","galleries_id":474367,"server_id":32,"link":"photo_7360625.html","width":160,"caption":"","height":160});
															thumbnails[7360768] = clik.newPhoto({"id":7360768,"src":"IMG_8467_thumb_13CDB0B1-1EC9-DFB6-095165F49B07DCB4.JPG","galleries_id":474367,"server_id":32,"link":"photo_7360768.html","width":160,"caption":"","height":160});
															thumbnails[7360787] = clik.newPhoto({"id":7360787,"src":"IMG_4106_thumb_13D23897-1EC9-DFB6-0906CD4B9597F931.JPG","galleries_id":474367,"server_id":32,"link":"photo_7360787.html","width":160,"caption":"","height":160});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[474406] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstract and Urban","link":"gallery_474406.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":474406,"singleSection":false});				  						galleries[290597] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Concerts","link":"gallery_290597.html","maxRecords":0.0,"photoIDs":[9019048.0,5142008.0,7350432.0,7350862.0,7351629.0,7360512.0],"skipIndex":0,"section_code":"gallery","featured_images":5142008.0,"id":290597,"singleSection":false});				  						galleries[221215] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes","link":"gallery_221215.html","maxRecords":0.0,"photoIDs":[9008427.0,9008441.0,9008465.0,9008505.0,5142302.0,9008414.0,9008750.0],"skipIndex":0,"section_code":"gallery","featured_images":"9008750,9008505,9008465,9008441,9008427,9008414,5142302","id":221215,"singleSection":false});				  						galleries[474367] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_474367.html","maxRecords":0.0,"photoIDs":[9018248.0,3125762.0,3125980.0,3125986.0,3125997.0,3130177.0,3130215.0,3137843.0,3149854.0,3545429.0,3579720.0,3580614.0,3615038.0,4722631.0,4722712.0,5141719.0,5141915.0,6760449.0,6760472.0,6760589.0,7348622.0,7348667.0,7348721.0,7348891.0,7351477.0,7360625.0,7360768.0,7360787.0],"skipIndex":0,"section_code":"gallery","featured_images":"9018248,7348667","id":474367,"singleSection":false});				  						galleries[191440] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_191440.html","maxRecords":0.0,"photoIDs":[9018946.0,9019016.0,3125148.0,3149369.0,3297140.0,3297158.0,3375696.0,3569903.0,3569911.0,3615182.0],"skipIndex":0,"section_code":"gallery","featured_images":3149369.0,"id":191440,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9008505';
imageSets[2] = '9018248,7348667,5142008,3149369';
imageSets[3] = '9019048,9019016,9018946,9018248,9008750,9008505,9008465,9008441,9008427,9008414,7360787,7360768,7360625,7360512,7351629,7351477,7350862,7350432,7348891,7348721,7348667,7348622,6760589,6760472,6760449,5142302,5142008,5141915,5141719,4722712,4722631,3615182,3615038,3580614,3579720,3569911,3569903,3545429,3375696,3297158,3297140,3149854,3149369,3137843,3130215,3130177,3125997,3125986,3125980,3125762';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/lynnette/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/lynnette/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/lynnette/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/lynnette/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/lynnette/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/lynnette/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/lynnette/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/lynnette/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 || photos || {})[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 = 'aphoto4life.com: ' + 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.item_price !== '') {
			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;
	}
}

			

