window.thumbnails = {};
															thumbnails[8605360] = clik.newPhoto({"id":8605360,"src":"Picture_008_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":128,"caption":"Silver Riding","height":130});
															thumbnails[7471698] = clik.newPhoto({"id":7471698,"src":"Blue_Belonging_small_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":128,"caption":"Blue Belonging","height":130});
															thumbnails[7490102] = clik.newPhoto({"id":7490102,"src":"IMG_2603_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Illumination 7","height":128});
															thumbnails[7490109] = clik.newPhoto({"id":7490109,"src":"IMG_2585_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Illumination 8","height":130});
															thumbnails[3813697] = clik.newPhoto({"id":3813697,"src":"Illumination_11_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":129,"caption":"Illumination 20","height":130});
															thumbnails[8605178] = clik.newPhoto({"id":8605178,"src":"Lanyon_-Tinstone_framed_007_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":98,"caption":"Seaping Orange","height":130});
															thumbnails[3813885] = clik.newPhoto({"id":3813885,"src":"Sea_Fair_small_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":97,"caption":"Sea Fair","height":130});
															thumbnails[7490095] = clik.newPhoto({"id":7490095,"src":"IMG_2614_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":99,"caption":"Illumination 10","height":130});
															thumbnails[7490101] = clik.newPhoto({"id":7490101,"src":"IMG_2610_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":97,"caption":"Illumination 17","height":130});
															thumbnails[8605182] = clik.newPhoto({"id":8605182,"src":"Picture_001_F7B70F2B-24E8-5EC4-4FBC8D66C1B6B1EC_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":97,"caption":"Millers Blue ","height":130});
															thumbnails[8134508] = clik.newPhoto({"id":8134508,"src":"IMG_2954_thumb.JPG","galleries_id":"","server_id":5,"link":"#","width":101,"caption":"Mossie Fountains","height":130});
															thumbnails[4850072] = clik.newPhoto({"id":4850072,"src":"IMG_3455_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":95,"caption":"Haze of Yellow","height":130});
															thumbnails[8605357] = clik.newPhoto({"id":8605357,"src":"Picture_003_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"The Highway Man","height":129});
															thumbnails[8605175] = clik.newPhoto({"id":8605175,"src":"IMG_5052_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"Red Relief","height":97});
															thumbnails[3813699] = clik.newPhoto({"id":3813699,"src":"IMG_2624_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":97,"caption":"Illumination 1","height":130});
															thumbnails[7681918] = clik.newPhoto({"id":7681918,"src":"Untitled_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":98,"caption":"Hazy Whisper","height":130});
															thumbnails[3846162] = clik.newPhoto({"id":3846162,"src":"new_110_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":110,"caption":"Portrait of Toby","height":130});
															thumbnails[8605359] = clik.newPhoto({"id":8605359,"src":"Picture_007_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_8605359.html","width":130,"caption":"Ignite the Gable","height":130});
															thumbnails[9061299] = clik.newPhoto({"id":9061299,"src":"Lanyon_-Tinstone_framed_005_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_9061299.html","width":130,"caption":"Body is Earthward Press'd","height":96});
															thumbnails[9061393] = clik.newPhoto({"id":9061393,"src":"Katkin_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_9061393.html","width":130,"caption":"Thoroughfare for all thoughts","height":130});
															thumbnails[3813874] = clik.newPhoto({"id":3813874,"src":"Illumination13_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_3813874.html","width":130,"caption":"Illumination 13","height":129});
															thumbnails[3813901] = clik.newPhoto({"id":3813901,"src":"Illumination3_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_3813901.html","width":130,"caption":"Illumination 3","height":127});
															thumbnails[3846654] = clik.newPhoto({"id":3846654,"src":"art_019_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_3846654.html","width":95,"caption":"Nature Finding Space","height":130});
															thumbnails[4113804] = clik.newPhoto({"id":4113804,"src":"IMG_2930_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_4113804.html","width":98,"caption":"Caught in Blue","height":130});
															thumbnails[7490105] = clik.newPhoto({"id":7490105,"src":"Illumination_13_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_7490105.html","width":127,"caption":"Illumination 6","height":130});
															thumbnails[3846271] = clik.newPhoto({"id":3846271,"src":"IMG_2955_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_3846271.html","width":98,"caption":"White Rust","height":130});
															thumbnails[3971056] = clik.newPhoto({"id":3971056,"src":"IMG_2882_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_3971056.html","width":98,"caption":"Delphic Reed","height":130});
															thumbnails[4850006] = clik.newPhoto({"id":4850006,"src":"IMG_3473_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_4850006.html","width":130,"caption":"Capture of Blue","height":130});
															thumbnails[7471635] = clik.newPhoto({"id":7471635,"src":"Whisky_Mist_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_7471635.html","width":130,"caption":"Sweet Unheard Melodies","height":130});
															thumbnails[8214841] = clik.newPhoto({"id":8214841,"src":"Yellow_eleven_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_8214841.html","width":128,"caption":"Yellow Eleven","height":130});
															thumbnails[8570186] = clik.newPhoto({"id":8570186,"src":"Picture_001_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_8570186.html","width":126,"caption":"Pear's Green","height":130});
															thumbnails[3813671] = clik.newPhoto({"id":3813671,"src":"IMG_25931_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_3813671.html","width":97,"caption":"Illumination 14","height":130});
															thumbnails[3813677] = clik.newPhoto({"id":3813677,"src":"IMG_26191_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_3813677.html","width":95,"caption":"Illumination 18","height":130});
															thumbnails[3842389] = clik.newPhoto({"id":3842389,"src":"hopital_proposal_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_3842389.html","width":96,"caption":"Illumination 22","height":130});
															thumbnails[7490097] = clik.newPhoto({"id":7490097,"src":"IMG_2582_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_7490097.html","width":100,"caption":"Illumination 5","height":130});
															thumbnails[4113820] = clik.newPhoto({"id":4113820,"src":"IMG_2934_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_4113820.html","width":97,"caption":"Peaceful","height":130});
															thumbnails[7471959] = clik.newPhoto({"id":7471959,"src":"Prussian_Glory_small_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_7471959.html","width":129,"caption":"Prussian Glory","height":130});
															thumbnails[4113799] = clik.newPhoto({"id":4113799,"src":"IMG_2922_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_4113799.html","width":97,"caption":"Indian Illumination","height":130});
															thumbnails[4850094] = clik.newPhoto({"id":4850094,"src":"IMG_2937_thumb.jpg","galleries_id":405057,"server_id":5,"link":"photo_4850094.html","width":95,"caption":"Illumination 21","height":130});
															thumbnails[8605189] = clik.newPhoto({"id":8605189,"src":"Picture_004_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_8605189.html","width":130,"caption":"Melancholy Storm","height":129});
															thumbnails[6886503] = clik.newPhoto({"id":6886503,"src":"Born_in_Blue1_thumb.jpg","galleries_id":185188,"server_id":5,"link":"photo_6886503.html","width":130,"caption":"Born In Blue","height":130});
															thumbnails[4850332] = clik.newPhoto({"id":4850332,"src":"art_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_4850332.html","width":92,"caption":"Untitled 3","height":130});
															thumbnails[4850357] = clik.newPhoto({"id":4850357,"src":"art_021_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_4850357.html","width":97,"caption":"Untitled 10","height":130});
															thumbnails[4850361] = clik.newPhoto({"id":4850361,"src":"art_019_1_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_4850361.html","width":95,"caption":"Untitled 4","height":130});
															thumbnails[3685998] = clik.newPhoto({"id":3685998,"src":"IMG_1376_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_3685998.html","width":97,"caption":"Untitled 5","height":130});
															thumbnails[3686002] = clik.newPhoto({"id":3686002,"src":"IMG_1378_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_3686002.html","width":96,"caption":"Untitled 9","height":130});
															thumbnails[3686005] = clik.newPhoto({"id":3686005,"src":"IMG_1379_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_3686005.html","width":95,"caption":"Untitled 7","height":130});
															thumbnails[3686009] = clik.newPhoto({"id":3686009,"src":"IMG_1375_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_3686009.html","width":97,"caption":"Untitled 11","height":130});
															thumbnails[3686012] = clik.newPhoto({"id":3686012,"src":"IMG_1381_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_3686012.html","width":96,"caption":"Untitled 8","height":130});
															thumbnails[3686017] = clik.newPhoto({"id":3686017,"src":"art_017_thumb.jpg","galleries_id":185189,"server_id":5,"link":"photo_3686017.html","width":83,"caption":"Untitled 1","height":130});
															thumbnails[3846247] = clik.newPhoto({"id":3846247,"src":"Katkin_Pringle_40_thumb.jpg","galleries_id":234041,"server_id":5,"link":"photo_3846247.html","width":93,"caption":"Song of Rust","height":130});
															thumbnails[4240626] = clik.newPhoto({"id":4240626,"src":"IMG_3048_2_thumb.jpg","galleries_id":234041,"server_id":5,"link":"photo_4240626.html","width":99,"caption":"Subtle Rust","height":130});
															thumbnails[4240710] = clik.newPhoto({"id":4240710,"src":"IMG_3049_thumb.jpg","galleries_id":234041,"server_id":5,"link":"photo_4240710.html","width":94,"caption":"Amongst rust","height":130});
															thumbnails[4850371] = clik.newPhoto({"id":4850371,"src":"IMG_3051_thumb.jpg","galleries_id":234041,"server_id":5,"link":"photo_4850371.html","width":98,"caption":"Across the Teaboard","height":130});
															thumbnails[3733660] = clik.newPhoto({"id":3733660,"src":"figures_33_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_3733660.html","width":97,"caption":"Untitled","height":130});
															thumbnails[3733691] = clik.newPhoto({"id":3733691,"src":"figures_32_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_3733691.html","width":98,"caption":"Untitled","height":130});
															thumbnails[3733791] = clik.newPhoto({"id":3733791,"src":"figures_60_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_3733791.html","width":122,"caption":"Life Drawing","height":130});
															thumbnails[3733800] = clik.newPhoto({"id":3733800,"src":"figures_26_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_3733800.html","width":119,"caption":"Life Drawing","height":130});
															thumbnails[3733804] = clik.newPhoto({"id":3733804,"src":"figures_30_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_3733804.html","width":130,"caption":"Life Drawing","height":112});
															thumbnails[4850288] = clik.newPhoto({"id":4850288,"src":"figures_72_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_4850288.html","width":102,"caption":"Jim","height":130});
															thumbnails[3846128] = clik.newPhoto({"id":3846128,"src":"figures_29_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_3846128.html","width":89,"caption":"Life Drawing","height":130});
															thumbnails[3846157] = clik.newPhoto({"id":3846157,"src":"figures_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_3846157.html","width":85,"caption":"Jorg","height":130});
															thumbnails[3846166] = clik.newPhoto({"id":3846166,"src":"figures_2_thumb.jpg","galleries_id":225019,"server_id":5,"link":"photo_3846166.html","width":130,"caption":"Untitled","height":96});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[185188] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Paint","link":"gallery_185188.html","maxRecords":0.0,"photoIDs":[8605359.0,9061299.0,9061393.0,4113804.0,3846271.0,3971056.0,7471959.0,8605189.0,6886503.0],"skipIndex":0,"section_code":"gallery","featured_images":"7471959,6886503","id":185188,"singleSection":false});				  						galleries[405057] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sold Paintings","link":"gallery_405057.html","maxRecords":0.0,"photoIDs":[3813874.0,3813901.0,7490105.0,4850006.0,7471635.0,8214841.0,8570186.0,3813671.0,3813677.0,3842389.0,7490097.0,4113820.0,4113799.0,4850094.0],"skipIndex":0,"section_code":"gallery","featured_images":"8570186,8214841,7490105,7490097,7471635,4850094,4850006,4113820,4113799,3842389","id":405057,"singleSection":false});				  						galleries[185189] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Print","link":"gallery_185189.html","maxRecords":0.0,"photoIDs":[3846654.0,4850332.0,4850357.0,4850361.0,3685998.0,3686002.0,3686005.0,3686009.0,3686012.0,3686017.0],"skipIndex":0,"section_code":"gallery","featured_images":3685998.0,"id":185189,"singleSection":false});				  						galleries[234041] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Mixed Media","link":"gallery_234041.html","maxRecords":0.0,"photoIDs":[3846247.0,4240626.0,4240710.0,4850371.0],"skipIndex":0,"section_code":"gallery","featured_images":4240710.0,"id":234041,"singleSection":false});				  						galleries[225019] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Figurative","link":"gallery_225019.html","maxRecords":0.0,"photoIDs":[3733660.0,3733691.0,3733791.0,3733800.0,3733804.0,4850288.0,3846128.0,3846157.0,3846166.0],"skipIndex":0,"section_code":"gallery","featured_images":3733791.0,"id":225019,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8134508';
imageSets[2] = '7471959,6886503,3685998,4240710,3733791';
imageSets[3] = '9061393,9061299,8605360,8605359,8605357,8605189,8605182,8605178,8605175,8570186,8214841,8134508,7681918,7490109,7490105,7490102,7490101,7490097,7490095,7471959,7471698,7471635,6886503,4850371,4850361,4850357,4850332,4850288,4850094,4850072,4850006,4240710,4240626,4113820,4113804,4113799,3971056,3846654,3846271,3846247,3846166,3846162,3846157,3846128,3842389,3813901,3813885,3813874,3813699,3813697';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/katkimp/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/katkimp/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/katkimp/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/katkimp/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/katkimp/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/katkimp/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/katkimp/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/katkimp/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 = 'Katkin Pringle: ' + 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.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>Artist: </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.item_price !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="katkinpringle@hotmail.com">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="katkinpringle@hotmail.com">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

