window.thumbnails = {};
															thumbnails[5437836] = clik.newPhoto({"id":5437836,"src":"STA74351_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5438666] = clik.newPhoto({"id":5438666,"src":"STA74321_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5438669] = clik.newPhoto({"id":5438669,"src":"STA74318_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5438671] = clik.newPhoto({"id":5438671,"src":"STA74314_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5438725] = clik.newPhoto({"id":5438725,"src":"STA74248_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5438751] = clik.newPhoto({"id":5438751,"src":"STA742241_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5581280] = clik.newPhoto({"id":5581280,"src":"STA744691_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":98});
															thumbnails[5419675] = clik.newPhoto({"id":5419675,"src":"STA74122_thumb.JPG","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Solid Silver Heart Pendant   £39.50","height":98});
															thumbnails[5419715] = clik.newPhoto({"id":5419715,"src":"STA74201_thumb.JPG","galleries_id":305033,"server_id":18,"link":"photo_5419715.html","width":130,"caption":"Magnetic Haematite Bead Necklace   £29.50  ","height":98});
															thumbnails[5437838] = clik.newPhoto({"id":5437838,"src":"STA74343_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5437838.html","width":130,"caption":"Pink Pearl 'Zig Zag' Necklace  £39.50","height":98});
															thumbnails[5438703] = clik.newPhoto({"id":5438703,"src":"STA74270_thumb.JPG","galleries_id":307618,"server_id":18,"link":"photo_5438703.html","width":130,"caption":"Haematite Oval Twist Necklace  £21","height":98});
															thumbnails[5419716] = clik.newPhoto({"id":5419716,"src":"STA74218_thumb.JPG","galleries_id":305033,"server_id":18,"link":"photo_5419716.html","width":130,"caption":"Magnetic Haematite Bead Bracelet  £15 ","height":98});
															thumbnails[5437839] = clik.newPhoto({"id":5437839,"src":"STA74336_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5437839.html","width":130,"caption":"Pink and Natural Pearl Earrings  £10","height":98});
															thumbnails[5438839] = clik.newPhoto({"id":5438839,"src":"STA74278_thumb.JPG","galleries_id":307618,"server_id":18,"link":"photo_5438839.html","width":130,"caption":"Haematite Oval Twist Bracelet  £11","height":98});
															thumbnails[5419719] = clik.newPhoto({"id":5419719,"src":"STA74219_thumb.JPG","galleries_id":305033,"server_id":18,"link":"photo_5419719.html","width":130,"caption":"Magnetic Haematite Bead Earrings  £9","height":98});
															thumbnails[5437837] = clik.newPhoto({"id":5437837,"src":"STA74348_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5437837.html","width":130,"caption":"Pink Pearl 'Zig Zag' Set  £47.50","height":98});
															thumbnails[5476581] = clik.newPhoto({"id":5476581,"src":"STA74279_thumb.JPG","galleries_id":307618,"server_id":18,"link":"photo_5476581.html","width":130,"caption":"Haematite Oval Twist Earrings  £8.50","height":98});
															thumbnails[5419720] = clik.newPhoto({"id":5419720,"src":"STA74224_thumb.JPG","galleries_id":305033,"server_id":18,"link":"photo_5419720.html","width":130,"caption":"Magnetic Haematite Bead Set      £50","height":98});
															thumbnails[5438677] = clik.newPhoto({"id":5438677,"src":"STA74274_thumb.JPG","galleries_id":307618,"server_id":18,"link":"photo_5438677.html","width":130,"caption":"Haematite Oval Twist Set £37.50","height":98});
															thumbnails[5539916] = clik.newPhoto({"id":5539916,"src":"STA74404_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5539916.html","width":130,"caption":"Green Pearl 'Zig Zag' Necklace  £39.50","height":98});
															thumbnails[5540103] = clik.newPhoto({"id":5540103,"src":"STA74406_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5540103.html","width":130,"caption":"Green Pearl Earrings  £10","height":98});
															thumbnails[5540124] = clik.newPhoto({"id":5540124,"src":"STA74351_F2121366-24E8-5EC4-4FE4C29506EBFE51_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5540124.html","width":130,"caption":"Green Pearl 'Zig Zag' Set  £47.50","height":98});
															thumbnails[5438707] = clik.newPhoto({"id":5438707,"src":"STA74267_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5438707.html","width":130,"caption":"Blue Abalone Pendant  £18.50","height":98});
															thumbnails[5438675] = clik.newPhoto({"id":5438675,"src":"STA74290_thumb.JPG","galleries_id":307618,"server_id":18,"link":"photo_5438675.html","width":130,"caption":"Haematite Cube and Tube Set  £40","height":98});
															thumbnails[5438713] = clik.newPhoto({"id":5438713,"src":"STA74258_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5438713.html","width":130,"caption":"Blue Abalone Earrings  £10","height":98});
															thumbnails[5438673] = clik.newPhoto({"id":5438673,"src":"STA74300_thumb.JPG","galleries_id":307618,"server_id":18,"link":"photo_5438673.html","width":130,"caption":"Haematite Cube and Tube Earrings  £8.50","height":98});
															thumbnails[5438712] = clik.newPhoto({"id":5438712,"src":"STA74265_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5438712.html","width":130,"caption":"Blue Abalone Set  £25","height":98});
															thumbnails[5438729] = clik.newPhoto({"id":5438729,"src":"STA74243_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5438729.html","width":130,"caption":"Abalone Pendant  £17.50","height":98});
															thumbnails[5540211] = clik.newPhoto({"id":5540211,"src":"STA74410_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5540211.html","width":130,"caption":"Small Abalone Earrings  £9","height":98});
															thumbnails[5639464] = clik.newPhoto({"id":5639464,"src":"STA74414_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5639464.html","width":130,"caption":"Large Abalone Earrings  £12.50","height":98});
															thumbnails[5639347] = clik.newPhoto({"id":5639347,"src":"STA74453_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5639347.html","width":130,"caption":"Abalone Taper Necklace  £27.50","height":98});
															thumbnails[5639508] = clik.newPhoto({"id":5639508,"src":"STA74374_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5639508.html","width":130,"caption":"Black Lip Mother of Pearl Necklace  £25","height":98});
															thumbnails[5639892] = clik.newPhoto({"id":5639892,"src":"STA74384_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5639892.html","width":130,"caption":"Black Lip Mother of Pearl Earrings  £9.50","height":98});
															thumbnails[5639963] = clik.newPhoto({"id":5639963,"src":"STA74375_thumb.JPG","galleries_id":307620,"server_id":18,"link":"photo_5639963.html","width":130,"caption":"Black Lip Mother of Pearl Set £32.50","height":98});
															thumbnails[5438858] = clik.newPhoto({"id":5438858,"src":"STA74073_thumb.JPG","galleries_id":306347,"server_id":18,"link":"photo_5438858.html","width":130,"caption":"Opalite Bead Necklace  £45.00","height":98});
															thumbnails[5438661] = clik.newPhoto({"id":5438661,"src":"STA74332_thumb.JPG","galleries_id":306347,"server_id":18,"link":"photo_5438661.html","width":130,"caption":"Opalite Bead Earrings  £12.50","height":98});
															thumbnails[5438717] = clik.newPhoto({"id":5438717,"src":"STA74254_thumb.JPG","galleries_id":306347,"server_id":18,"link":"photo_5438717.html","width":130,"caption":"Opalite Set  £55","height":98});
															thumbnails[5419671] = clik.newPhoto({"id":5419671,"src":"STA74092_thumb.JPG","galleries_id":308062,"server_id":18,"link":"photo_5419671.html","width":130,"caption":"Lime Ceramic Bead Necklace  £39.50","height":98});
															thumbnails[5419673] = clik.newPhoto({"id":5419673,"src":"STA74107_thumb.JPG","galleries_id":308062,"server_id":18,"link":"photo_5419673.html","width":130,"caption":"Lime Ceramic Bead Bracelet  £35","height":98});
															thumbnails[5419674] = clik.newPhoto({"id":5419674,"src":"STA74115_thumb.JPG","galleries_id":308062,"server_id":18,"link":"photo_5419674.html","width":130,"caption":"Lime Ceramic Bead Earrings  £18.50","height":98});
															thumbnails[5419672] = clik.newPhoto({"id":5419672,"src":"STA74103_thumb.JPG","galleries_id":308062,"server_id":18,"link":"photo_5419672.html","width":130,"caption":"Lime Ceramic Bead Set  £85","height":98});
															thumbnails[5419668] = clik.newPhoto({"id":5419668,"src":"STA74086_thumb.JPG","galleries_id":308062,"server_id":18,"link":"photo_5419668.html","width":130,"caption":"Blue Ceramic Bead Bracelet  £35","height":98});
															thumbnails[5419676] = clik.newPhoto({"id":5419676,"src":"STA74127_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419676.html","width":130,"caption":"Satin Silver Wave Necklace  £35","height":98});
															thumbnails[5419677] = clik.newPhoto({"id":5419677,"src":"STA74138_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419677.html","width":130,"caption":"Satin Silver Wave Earrings  £17.50","height":98});
															thumbnails[5419681] = clik.newPhoto({"id":5419681,"src":"STA74158_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419681.html","width":130,"caption":"Satin Silver Wave Set  £50","height":98});
															thumbnails[5419690] = clik.newPhoto({"id":5419690,"src":"STA74179_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419690.html","width":130,"caption":"Silver Heart Plaque  £37.50","height":98});
															thumbnails[5419687] = clik.newPhoto({"id":5419687,"src":"STA74170_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419687.html","width":130,"caption":"Oxidised silver Wave Pendant  £35","height":98});
															thumbnails[5419679] = clik.newPhoto({"id":5419679,"src":"STA74145_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419679.html","width":130,"caption":"Oxidised Silver Wave Earrings  £21.50","height":98});
															thumbnails[5419680] = clik.newPhoto({"id":5419680,"src":"STA74155_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419680.html","width":130,"caption":"Oxidised Silver Wave Set  £47.50","height":98});
															thumbnails[5419691] = clik.newPhoto({"id":5419691,"src":"STA74180_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419691.html","width":130,"caption":"Enameled Silver Cushion Pendant  £39.50","height":98});
															thumbnails[5419697] = clik.newPhoto({"id":5419697,"src":"STA74187_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419697.html","width":130,"caption":"Silver Zig-Zag Necklace  £35","height":98});
															thumbnails[5419713] = clik.newPhoto({"id":5419713,"src":"STA74200_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419713.html","width":130,"caption":"Silver Zig-Zag Earrings  £17.50","height":98});
															thumbnails[5419698] = clik.newPhoto({"id":5419698,"src":"STA74193_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419698.html","width":130,"caption":"Silver Zig-Zag Set  £50","height":98});
															thumbnails[5438722] = clik.newPhoto({"id":5438722,"src":"STA74249_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5438722.html","width":130,"caption":"Silver Flower Plaque  £35","height":98});
															thumbnails[5419683] = clik.newPhoto({"id":5419683,"src":"STA74163_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419683.html","width":130,"caption":"Silver Flower Earrings  £15","height":98});
															thumbnails[5419684] = clik.newPhoto({"id":5419684,"src":"STA74166_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5419684.html","width":130,"caption":"Silver Flower Plaque Set  £47.50","height":98});
															thumbnails[5438746] = clik.newPhoto({"id":5438746,"src":"STA74229_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5438746.html","width":130,"caption":"Oxidised Silver Heart  £39.50","height":98});
															thumbnails[5438842] = clik.newPhoto({"id":5438842,"src":"STA742391_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5438842.html","width":130,"caption":"Oxidised Silver Heart Earrings  £17.50","height":98});
															thumbnails[5438736] = clik.newPhoto({"id":5438736,"src":"STA74230_thumb.JPG","galleries_id":305034,"server_id":18,"link":"photo_5438736.html","width":130,"caption":"Oxidised Silver Heart Set  £55","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[308062] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ceramic","link":"section365143_308062.html","maxRecords":0.0,"photoIDs":[5419671.0,5419673.0,5419674.0,5419672.0,5419668.0],"skipIndex":0,"section_code":"section365143","featured_images":5419672.0,"id":308062,"singleSection":false});				  						galleries[307618] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Haematite","link":"gallery_307618.html","maxRecords":0.0,"photoIDs":[5438703.0,5438839.0,5476581.0,5438677.0,5438675.0,5438673.0],"skipIndex":0,"section_code":"gallery","featured_images":"5438677,5438675","id":307618,"singleSection":false});				  						galleries[305033] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Magnetic Haematite ","link":"gallery_305033.html","maxRecords":0.0,"photoIDs":[5419715.0,5419716.0,5419719.0,5419720.0],"skipIndex":0,"section_code":"gallery","featured_images":5419720.0,"id":305033,"singleSection":false});				  						galleries[306347] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Opalite","link":"section365143_306347.html","maxRecords":0.0,"photoIDs":[5438858.0,5438661.0,5438717.0],"skipIndex":0,"section_code":"section365143","featured_images":5438717.0,"id":306347,"singleSection":false});				  						galleries[307620] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Shell and pearl","link":"gallery_307620.html","maxRecords":0.0,"photoIDs":[5437838.0,5437839.0,5437837.0,5539916.0,5540103.0,5540124.0,5438707.0,5438713.0,5438712.0,5438729.0,5540211.0,5639464.0,5639347.0,5639508.0,5639892.0,5639963.0],"skipIndex":0,"section_code":"gallery","featured_images":"5540124,5438712,5437837","id":307620,"singleSection":false});				  						galleries[305034] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Silverwork","link":"section365144.html","maxRecords":0.0,"photoIDs":[5419676.0,5419677.0,5419681.0,5419690.0,5419687.0,5419679.0,5419680.0,5419691.0,5419697.0,5419713.0,5419698.0,5438722.0,5419683.0,5419684.0,5438746.0,5438842.0,5438736.0],"skipIndex":0,"section_code":"section365144","featured_images":"5438736,5419698,5419684,5419681,5419680","id":305034,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '5581280,5438751,5438725,5438671,5438669,5438666,5437836,5438858,5438703,5437838,5419715,5419676,5438839,5438661,5437839,5419716,5419677,5438717,5437837,5419719,5419681,5539916,5438677,5419720,5419690,5540103,5419675,5419671,5540124,5419687,5419673,5438707,5419679,5419674,5438713,5438675,5419680,5419672,5438712,5438673,5419691,5419668,5438729,5419697,5540211,5419698,5639347,5438722,5639508,5419683,5639892,5419684,5639963,5438746,5438842,5438736';
imageSets[2] = '5438751,5438671,5437836,5438717,5437837,5419681,5438677,5419720,5540124,5438675,5419680,5419672,5438712,5419698,5419684,5438736';
imageSets[3] = '5581280,5438751,5438725,5438671,5438669,5438666,5437836,5438858,5438703,5437838,5419715,5419676,5438839,5438661,5437839,5419716,5419677,5437837,5419719,5419681,5539916,5419690,5540103,5419675,5419671,5540124,5419687,5419673,5438707,5419679,5419674,5438713,5419680,5419672,5438712,5438673,5419691,5419668,5438729,5419697,5540211,5419713,5419698,5639347,5438722,5639508,5419683,5639892,5419684,5639963,5438746,5438842,5438736';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/AmandaHollinger/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/AmandaHollinger/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 = 'Wireworks Jewellery: ' + 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else if (this.payment_groups_id !== '') {
		temp += '<p>Buy online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="AMANDAHOLLINGER">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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;
	}
}

			

