window.thumbnails = {};
															thumbnails[7204631] = clik.newPhoto({"id":7204631,"src":"Rivrside_Boy_lrg_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7204631.html","width":130,"caption":"Riverside Boy             30x32''","height":98});
															thumbnails[7445315] = clik.newPhoto({"id":7445315,"src":"owen_large_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_7445315.html","width":130,"caption":"'Owen'                      40''x50''","height":173});
															thumbnails[7445322] = clik.newPhoto({"id":7445322,"src":"Party_In_My_Head_L_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7445322.html","width":130,"caption":"'Party in my Head'               40x42","height":124});
															thumbnails[7445325] = clik.newPhoto({"id":7445325,"src":"Thinking_Cap_L_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7445325.html","width":130,"caption":"'Thinking Cap'    32x32''","height":173});
															thumbnails[7445330] = clik.newPhoto({"id":7445330,"src":"Victoria_large_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_7445330.html","width":130,"caption":"'Correspondence'   37x38''","height":129});
															thumbnails[7445381] = clik.newPhoto({"id":7445381,"src":"The_Penitant_large_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_7445381.html","width":130,"caption":"'The Penitant' 30x32''","height":130});
															thumbnails[7445385] = clik.newPhoto({"id":7445385,"src":"Favourite_Jumper_large_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_7445385.html","width":130,"caption":"'Favourite Jumper' 20x22''","height":173});
															thumbnails[7445387] = clik.newPhoto({"id":7445387,"src":"springburn_hopes_large_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_7445387.html","width":130,"caption":"'Springburn Hopes'","height":167});
															thumbnails[7546847] = clik.newPhoto({"id":7546847,"src":"188687_10150435794440602_886000601_17657252_5676317_n_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_7546847.html","width":130,"caption":"Theresa 12x12''","height":134});
															thumbnails[7546851] = clik.newPhoto({"id":7546851,"src":"197040_10150435790855602_886000601_17657227_169139_n_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_7546851.html","width":130,"caption":"'Day Break' 16x16''","height":133});
															thumbnails[7546853] = clik.newPhoto({"id":7546853,"src":"188686_10150435800170602_886000601_17657304_3087825_n_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7546853.html","width":130,"caption":"'Race of Life' 30x20''","height":98});
															thumbnails[7546856] = clik.newPhoto({"id":7546856,"src":"200612_10150435792305602_886000601_17657241_5009481_n_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_7546856.html","width":130,"caption":"'Pavel 1' 8x8","height":128});
															thumbnails[7546857] = clik.newPhoto({"id":7546857,"src":"190040_10150436746105602_886000601_17666411_5070128_n_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7546857.html","width":130,"caption":"'Pavel 2' 8x8''","height":130});
															thumbnails[7546858] = clik.newPhoto({"id":7546858,"src":"The_Walker_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7546858.html","width":130,"caption":"'The Walker' 20x22''","height":120});
															thumbnails[7546860] = clik.newPhoto({"id":7546860,"src":"200612_10150435792280602_886000601_17657237_7333561_n_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7546860.html","width":130,"caption":"'Immeresed' 20x36''","height":88});
															thumbnails[7547281] = clik.newPhoto({"id":7547281,"src":"197040_10150435790850602_886000601_17657226_2198004_n_thumb.jpg","galleries_id":465501,"server_id":32,"link":"photo_7547281.html","width":130,"caption":"'Coo's Lick' 20x26''","height":195});
															thumbnails[7547312] = clik.newPhoto({"id":7547312,"src":"197578_10150435804490602_886000601_17657330_7292058_n_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7547312.html","width":130,"caption":"'Roll Model' 12x16''","height":96});
															thumbnails[7547315] = clik.newPhoto({"id":7547315,"src":"197578_10150435804480602_886000601_17657328_1938762_n_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7547315.html","width":130,"caption":"'Pavel 3' 8x8''","height":131});
															thumbnails[7547317] = clik.newPhoto({"id":7547317,"src":"197040_10150435790860602_886000601_17657228_4908063_n_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7547317.html","width":130,"caption":"'Girl in Puddle' 10x16''","height":212});
															thumbnails[7547319] = clik.newPhoto({"id":7547319,"src":"200612_10150435792285602_886000601_17657238_67807_n_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7547319.html","width":130,"caption":"'Indesicion' 12x12''","height":130});
															thumbnails[7547379] = clik.newPhoto({"id":7547379,"src":"190310_10150435797070602_886000601_17657284_2919537_n_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7547379.html","width":130,"caption":"'Riverside Boy' 30x32''","height":98});
															thumbnails[7547410] = clik.newPhoto({"id":7547410,"src":"Billy_and_Peter_thumb.jpg","galleries_id":357379,"server_id":32,"link":"photo_7547410.html","width":130,"caption":"'Billy and Peter' 24x30''","height":98});
															thumbnails[7595437] = clik.newPhoto({"id":7595437,"src":"on20time20in20time_JPG_thumb.jpg","galleries_id":409259,"server_id":32,"link":"photo_7595437.html","width":130,"caption":"'On time in Time'","height":98});
															thumbnails[7595439] = clik.newPhoto({"id":7595439,"src":"berlin20tram_JPG_thumb.jpg","galleries_id":409259,"server_id":32,"link":"photo_7595439.html","width":130,"caption":"'Retro Tram'","height":98});
															thumbnails[7595441] = clik.newPhoto({"id":7595441,"src":"carriage2048205m_jpg_thumb.jpg","galleries_id":409259,"server_id":32,"link":"photo_7595441.html","width":130,"caption":"'Carriage 48'","height":98});
															thumbnails[7595443] = clik.newPhoto({"id":7595443,"src":"Pepsi20Bus20Colour_thumb.jpg","galleries_id":409259,"server_id":32,"link":"photo_7595443.html","width":130,"caption":"'Pepsi Bus'","height":98});
															thumbnails[7595445] = clik.newPhoto({"id":7595445,"src":"berlin20tram202_JPG_thumb.jpg","galleries_id":409259,"server_id":32,"link":"photo_7595445.html","width":130,"caption":"'Berlin Tram'","height":98});
															thumbnails[7595446] = clik.newPhoto({"id":7595446,"src":"Progressive20Retro_thumb.jpg","galleries_id":409259,"server_id":32,"link":"photo_7595446.html","width":130,"caption":"'Progressive Retro'","height":99});
															thumbnails[7595456] = clik.newPhoto({"id":7595456,"src":"Glasgow20Cathedral_thumb.jpg","galleries_id":409259,"server_id":32,"link":"photo_7595456.html","width":130,"caption":"'Glasgow Cathedral'","height":98});
															thumbnails[7595460] = clik.newPhoto({"id":7595460,"src":"Inner20Circles20L_thumb.jpg","galleries_id":409257,"server_id":32,"link":"photo_7595460.html","width":130,"caption":"'Inner Circles' 48x58''","height":103});
															thumbnails[8207280] = clik.newPhoto({"id":8207280,"src":"IMG_6775_thumb.JPG","galleries_id":357378,"server_id":32,"link":"photo_8207280.html","width":130,"caption":"A Greek Holiday 36x36''","height":131});
															thumbnails[8381064] = clik.newPhoto({"id":8381064,"src":"allmine_thumb.jpg","galleries_id":465501,"server_id":32,"link":"photo_8381064.html","width":130,"caption":"","height":186});
															thumbnails[8381066] = clik.newPhoto({"id":8381066,"src":"coldinghambay_thumb.jpg","galleries_id":465501,"server_id":32,"link":"photo_8381066.html","width":130,"caption":"","height":185});
															thumbnails[8381069] = clik.newPhoto({"id":8381069,"src":"ghostsoftrongate_thumb.jpg","galleries_id":409257,"server_id":32,"link":"photo_8381069.html","width":130,"caption":"","height":103});
															thumbnails[8381071] = clik.newPhoto({"id":8381071,"src":"baesystems_thumb.jpg","galleries_id":409257,"server_id":32,"link":"photo_8381071.html","width":130,"caption":"","height":168});
															thumbnails[8678586] = clik.newPhoto({"id":8678586,"src":"Odd_Socks_thumb.JPG","galleries_id":357379,"server_id":32,"link":"photo_8678586.html","width":130,"caption":"'Odd Socks'","height":174});
															thumbnails[8678682] = clik.newPhoto({"id":8678682,"src":"IMG_7702_thumb.JPG","galleries_id":357378,"server_id":32,"link":"photo_8678682.html","width":130,"caption":"'Gregor' 30x36''","height":180});
															thumbnails[8678692] = clik.newPhoto({"id":8678692,"src":"St_Abbs_54_thumb.JPG","galleries_id":465501,"server_id":32,"link":"photo_8678692.html","width":130,"caption":"","height":141});
															thumbnails[8678734] = clik.newPhoto({"id":8678734,"src":"Jimmie_RGI_2011_thumb.JPG","galleries_id":357378,"server_id":32,"link":"photo_8678734.html","width":130,"caption":"'Jimmie'","height":170});
															thumbnails[8678743] = clik.newPhoto({"id":8678743,"src":"Absent__RGI_2011_thumb.JPG","galleries_id":357379,"server_id":32,"link":"photo_8678743.html","width":130,"caption":"'Absent'","height":171});
															thumbnails[8678903] = clik.newPhoto({"id":8678903,"src":"Magic_Spinner__20x39_-_Copy_thumb.JPG","galleries_id":465501,"server_id":32,"link":"photo_8678903.html","width":130,"caption":"'Magic Spinner'","height":202});
															thumbnails[8852198] = clik.newPhoto({"id":8852198,"src":"The_Kings_Visit_thumb.JPG","galleries_id":465501,"server_id":32,"link":"photo_8852198.html","width":130,"caption":"'The Kings Visit'","height":229});
															thumbnails[8852236] = clik.newPhoto({"id":8852236,"src":"Coney_Island_Life_Guard_thumb.JPG","galleries_id":357379,"server_id":32,"link":"photo_8852236.html","width":130,"caption":"'Coney Island Life Guard'","height":118});
															thumbnails[8852241] = clik.newPhoto({"id":8852241,"src":"First_Puncture_thumb.JPG","galleries_id":465501,"server_id":32,"link":"photo_8852241.html","width":130,"caption":"'First Puncture'","height":147});
															thumbnails[8852243] = clik.newPhoto({"id":8852243,"src":"Little_Treat_thumb.JPG","galleries_id":465501,"server_id":32,"link":"photo_8852243.html","width":130,"caption":"'Little Treat'","height":129});
															thumbnails[8852248] = clik.newPhoto({"id":8852248,"src":"374607_10150987009305602_886000601_21939826_660702942_n_thumb.jpg","galleries_id":357378,"server_id":32,"link":"photo_8852248.html","width":130,"caption":"'Emma'","height":190});
															thumbnails[8856609] = clik.newPhoto({"id":8856609,"src":"King_of_the_Castle_thumb.JPG","galleries_id":465501,"server_id":32,"link":"photo_8856609.html","width":130,"caption":"'King of the Castle' 18x24''","height":182});
															thumbnails[8856647] = clik.newPhoto({"id":8856647,"src":"Rubble_Rabbit_thumb.JPG","galleries_id":465501,"server_id":32,"link":"photo_8856647.html","width":130,"caption":"'Rubble Rabbit' 10x12''","height":179});
															thumbnails[8856649] = clik.newPhoto({"id":8856649,"src":"Lucky_Number_thumb.JPG","galleries_id":465501,"server_id":32,"link":"photo_8856649.html","width":130,"caption":"'Lucky Number' 18x20''","height":163});
															thumbnails[9019789] = clik.newPhoto({"id":9019789,"src":"Down_to_earth_18x19_inches_thumb.JPG","galleries_id":357379,"server_id":32,"link":"photo_9019789.html","width":130,"caption":"'Down to Earth'","height":136});
															thumbnails[9019792] = clik.newPhoto({"id":9019792,"src":"Over_and_Over_21x21_inches_thumb.JPG","galleries_id":357379,"server_id":32,"link":"photo_9019792.html","width":130,"caption":"'Over and Over'","height":127});
															thumbnails[9019794] = clik.newPhoto({"id":9019794,"src":"Unbreakable_24x32_inches_thumb.JPG","galleries_id":357379,"server_id":32,"link":"photo_9019794.html","width":130,"caption":"'Unbreakable'","height":175});
															thumbnails[9019798] = clik.newPhoto({"id":9019798,"src":"Taking_Flight_26x26_inches_thumb.JPG","galleries_id":357379,"server_id":32,"link":"photo_9019798.html","width":130,"caption":"'Taking Flight'","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[357378] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraiture","link":"gallery_357378.html","maxRecords":0.0,"photoIDs":[7445315.0,7445330.0,7445381.0,7445385.0,7445387.0,7546847.0,7546851.0,7546856.0,8207280.0,8678682.0,8678734.0,8852248.0],"skipIndex":0,"section_code":"gallery","featured_images":"8852248,8678734,8678682,8207280,7546856,7546851,7546847,7445387,7445385,7445381","id":357378,"singleSection":false});				  						galleries[357379] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Figurative","link":"gallery_357379.html","maxRecords":0.0,"photoIDs":[7204631.0,7445322.0,7445325.0,7546853.0,7546857.0,7546858.0,7546860.0,7547312.0,7547315.0,7547317.0,7547319.0,7547379.0,7547410.0,8678586.0,8678743.0,8852236.0,9019789.0,9019792.0,9019794.0,9019798.0],"skipIndex":0,"section_code":"gallery","featured_images":"9019798,9019794,9019792,9019789,8852236,8678743,8678586,7547410,7547379,7547319","id":357379,"singleSection":false});				  						galleries[465501] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nostalgic Figurative","link":"gallery_465501.html","maxRecords":0.0,"photoIDs":[7547281.0,8381064.0,8381066.0,8678692.0,8678903.0,8852198.0,8852241.0,8852243.0,8856609.0,8856647.0,8856649.0],"skipIndex":0,"section_code":"gallery","featured_images":"8856649,8856647,8856609,8852243,8852241,8852198,8678903,8678692,8381066,8381064","id":465501,"singleSection":false});				  						galleries[409257] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscape","link":"gallery_409257.html","maxRecords":0.0,"photoIDs":[7595460.0,8381069.0,8381071.0],"skipIndex":0,"section_code":"gallery","featured_images":"8381071,8381069,7595460","id":409257,"singleSection":false});				  						galleries[409259] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Prints","link":"gallery_409259.html","maxRecords":0.0,"photoIDs":[7595437.0,7595439.0,7595441.0,7595443.0,7595445.0,7595446.0,7595456.0],"skipIndex":0,"section_code":"gallery","featured_images":"7595456,7595446,7595445,7595443,7595441,7595439,7595437","id":409259,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7445330,7445325,7445315,7204631';
imageSets[3] = '8207280,7204631';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/pauleuan/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/pauleuan/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 = 'www.paulkennedyart.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;
	}
}

			

