window.thumbnails = {};
															thumbnails[2179003] = clik.newPhoto({"id":2179003,"src":"swpp 250 wide_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":174});
															thumbnails[7901244] = clik.newPhoto({"id":7901244,"src":"1_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"Album Cover","height":93});
															thumbnails[7901249] = clik.newPhoto({"id":7901249,"src":"2_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":93});
															thumbnails[7901252] = clik.newPhoto({"id":7901252,"src":"3_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":93});
															thumbnails[7901253] = clik.newPhoto({"id":7901253,"src":"4_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":93});
															thumbnails[7901254] = clik.newPhoto({"id":7901254,"src":"5_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":93});
															thumbnails[7901257] = clik.newPhoto({"id":7901257,"src":"6_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":93});
															thumbnails[1340571] = clik.newPhoto({"id":1340571,"src":"_CFT3475_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1340571.html","width":130,"caption":"","height":98});
															thumbnails[1282095] = clik.newPhoto({"id":1282095,"src":"PBOX 015_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1282095.html","width":130,"caption":"","height":94});
															thumbnails[1281808] = clik.newPhoto({"id":1281808,"src":"15x10 Lucca 1_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1281808.html","width":130,"caption":"","height":87});
															thumbnails[1281501] = clik.newPhoto({"id":1281501,"src":"Jonathan 1bedge 3_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1281501.html","width":130,"caption":"","height":130});
															thumbnails[1340569] = clik.newPhoto({"id":1340569,"src":"_CFT3464_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1340569.html","width":130,"caption":"","height":93});
															thumbnails[1340576] = clik.newPhoto({"id":1340576,"src":"_CFT3552_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1340576.html","width":130,"caption":"","height":93});
															thumbnails[2760806] = clik.newPhoto({"id":2760806,"src":"kieran lewis_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_2760806.html","width":130,"caption":"","height":93});
															thumbnails[1340564] = clik.newPhoto({"id":1340564,"src":"_CFT3446_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1340564.html","width":130,"caption":"","height":98});
															thumbnails[1340577] = clik.newPhoto({"id":1340577,"src":"_CFT3553_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1340577.html","width":130,"caption":"","height":98});
															thumbnails[1282097] = clik.newPhoto({"id":1282097,"src":"Ryan 025_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1282097.html","width":130,"caption":"Frame Example","height":130});
															thumbnails[1791786] = clik.newPhoto({"id":1791786,"src":"_CFT3384_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1791786.html","width":130,"caption":"","height":163});
															thumbnails[1281522] = clik.newPhoto({"id":1281522,"src":"Richard1_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1281522.html","width":130,"caption":"","height":94});
															thumbnails[1281512] = clik.newPhoto({"id":1281512,"src":"Martin's family 21_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_1281512.html","width":130,"caption":"Frame Example","height":70});
															thumbnails[2001471] = clik.newPhoto({"id":2001471,"src":"024_thumb.jpg","galleries_id":91005,"server_id":1,"link":"photo_2001471.html","width":130,"caption":"Author's book cover","height":111});
															thumbnails[1668903] = clik.newPhoto({"id":1668903,"src":"W&M 001_thumb.jpg","galleries_id":22184,"server_id":1,"link":"photo_1668903.html","width":130,"caption":"","height":191});
															thumbnails[1668904] = clik.newPhoto({"id":1668904,"src":"W&M 007_thumb.jpg","galleries_id":22184,"server_id":1,"link":"photo_1668904.html","width":130,"caption":"","height":184});
															thumbnails[1668905] = clik.newPhoto({"id":1668905,"src":"W&M 009_thumb.jpg","galleries_id":22184,"server_id":1,"link":"photo_1668905.html","width":130,"caption":"","height":173});
															thumbnails[1668907] = clik.newPhoto({"id":1668907,"src":"W&M 010_thumb.jpg","galleries_id":22184,"server_id":1,"link":"photo_1668907.html","width":130,"caption":"","height":184});
															thumbnails[1668908] = clik.newPhoto({"id":1668908,"src":"W&M 015_thumb.jpg","galleries_id":22184,"server_id":1,"link":"photo_1668908.html","width":130,"caption":"","height":194});
															thumbnails[1668910] = clik.newPhoto({"id":1668910,"src":"W&M 017_thumb.jpg","galleries_id":22184,"server_id":1,"link":"photo_1668910.html","width":130,"caption":"","height":130});
															thumbnails[1668912] = clik.newPhoto({"id":1668912,"src":"W&M 020_thumb.jpg","galleries_id":22184,"server_id":1,"link":"photo_1668912.html","width":130,"caption":"","height":187});
															thumbnails[1668914] = clik.newPhoto({"id":1668914,"src":"W&M 021_thumb.jpg","galleries_id":22184,"server_id":1,"link":"photo_1668914.html","width":130,"caption":"","height":104});
															thumbnails[1668916] = clik.newPhoto({"id":1668916,"src":"W&M 022_thumb.jpg","galleries_id":22839,"server_id":1,"link":"photo_1668916.html","width":130,"caption":"","height":87});
															thumbnails[1668961] = clik.newPhoto({"id":1668961,"src":"W&M 023_thumb.jpg","galleries_id":22839,"server_id":1,"link":"photo_1668961.html","width":130,"caption":"","height":87});
															thumbnails[1668962] = clik.newPhoto({"id":1668962,"src":"W&M 024_thumb.jpg","galleries_id":22839,"server_id":1,"link":"photo_1668962.html","width":130,"caption":"","height":87});
															thumbnails[1668968] = clik.newPhoto({"id":1668968,"src":"W&M 027_thumb.jpg","galleries_id":22839,"server_id":1,"link":"photo_1668968.html","width":130,"caption":"","height":195});
															thumbnails[1668973] = clik.newPhoto({"id":1668973,"src":"W&M 044_thumb.jpg","galleries_id":22839,"server_id":1,"link":"photo_1668973.html","width":130,"caption":"","height":87});
															thumbnails[1668975] = clik.newPhoto({"id":1668975,"src":"W&M 046_thumb.jpg","galleries_id":22839,"server_id":1,"link":"photo_1668975.html","width":130,"caption":"","height":104});
															thumbnails[1668990] = clik.newPhoto({"id":1668990,"src":"W&M 068_thumb.jpg","galleries_id":426420,"server_id":1,"link":"photo_1668990.html","width":130,"caption":"","height":98});
															thumbnails[1668996] = clik.newPhoto({"id":1668996,"src":"W&M 069_thumb.jpg","galleries_id":426420,"server_id":1,"link":"photo_1668996.html","width":130,"caption":"","height":173});
															thumbnails[1668991] = clik.newPhoto({"id":1668991,"src":"W&M 071_thumb.jpg","galleries_id":426420,"server_id":1,"link":"photo_1668991.html","width":130,"caption":"","height":182});
															thumbnails[1668997] = clik.newPhoto({"id":1668997,"src":"W&M 070_thumb.jpg","galleries_id":426420,"server_id":1,"link":"photo_1668997.html","width":130,"caption":"","height":86});
															thumbnails[1668998] = clik.newPhoto({"id":1668998,"src":"W&M 075_thumb.jpg","galleries_id":426420,"server_id":1,"link":"photo_1668998.html","width":130,"caption":"","height":87});
															thumbnails[1669000] = clik.newPhoto({"id":1669000,"src":"W&M 078_thumb.jpg","galleries_id":23776,"server_id":1,"link":"photo_1669000.html","width":130,"caption":"","height":194});
															thumbnails[1669001] = clik.newPhoto({"id":1669001,"src":"W&M 079_thumb.jpg","galleries_id":23776,"server_id":1,"link":"photo_1669001.html","width":130,"caption":"","height":182});
															thumbnails[1669003] = clik.newPhoto({"id":1669003,"src":"W&M 081_thumb.jpg","galleries_id":23776,"server_id":1,"link":"photo_1669003.html","width":130,"caption":"","height":163});
															thumbnails[1614380] = clik.newPhoto({"id":1614380,"src":"_CFT7769 email_thumb.jpg","galleries_id":110334,"server_id":1,"link":"photo_1614380.html","width":130,"caption":"Moonrise over Bodmin Moor","height":165});
															thumbnails[2179810] = clik.newPhoto({"id":2179810,"src":"Gordon 17 original2_thumb.jpg","galleries_id":144356,"server_id":1,"link":"photo_2179810.html","width":130,"caption":"Gordon 1 original","height":195});
															thumbnails[2179812] = clik.newPhoto({"id":2179812,"src":"Gordon 17 done2_thumb.jpg","galleries_id":144356,"server_id":1,"link":"photo_2179812.html","width":130,"caption":"Gordon 1 done","height":195});
															thumbnails[2179814] = clik.newPhoto({"id":2179814,"src":"Sharon 1 original1_thumb.jpg","galleries_id":144356,"server_id":1,"link":"photo_2179814.html","width":130,"caption":"Sharon 1 original","height":183});
															thumbnails[2179816] = clik.newPhoto({"id":2179816,"src":"Sharon 1 done_thumb.jpg","galleries_id":144356,"server_id":1,"link":"photo_2179816.html","width":130,"caption":"Sharon 1 done","height":173});
															thumbnails[2179821] = clik.newPhoto({"id":2179821,"src":"David 1 original_thumb.jpg","galleries_id":144356,"server_id":1,"link":"photo_2179821.html","width":130,"caption":"David 1 original","height":180});
															thumbnails[2179824] = clik.newPhoto({"id":2179824,"src":"David 1 done_thumb.jpg","galleries_id":144356,"server_id":1,"link":"photo_2179824.html","width":130,"caption":"David 1 done","height":182});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[110322] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Chris's Portfolio","link":"section145463.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section145463","featured_images":"","id":110322,"singleSection":true});				  						galleries[110334] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Newsletter","link":"section145468.html","maxRecords":0.0,"photoIDs":[1614380.0],"skipIndex":0,"section_code":"section145468","featured_images":1614380.0,"id":110334,"singleSection":true});				  						galleries[144356] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"PHOTO RESTORATION","link":"section185625.html","maxRecords":0.0,"photoIDs":[2179810.0,2179812.0,2179814.0,2179816.0,2179821.0,2179824.0],"skipIndex":0,"section_code":"section185625","featured_images":"2179824,2179821,2179816,2179814,2179812,2179810","id":144356,"singleSection":true});				  						galleries[91005] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_91005.html","maxRecords":0.0,"photoIDs":[1340571.0,1282095.0,1281808.0,1281501.0,1340569.0,1340576.0,2760806.0,1340564.0,1340577.0,1282097.0,1791786.0,1281522.0,1281512.0,2001471.0],"skipIndex":0,"section_code":"gallery","featured_images":1340571.0,"id":91005,"singleSection":false});				  						galleries[69505] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_69505.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":1668990.0,"id":69505,"singleSection":false});				  						galleries[22184] = clik.newGallery({"parentGallery":69505,"usePopups":false,"title":"Getting Ready","link":"gallery_22184.html","maxRecords":0.0,"photoIDs":[1668903.0,1668904.0,1668905.0,1668907.0,1668908.0,1668910.0,1668912.0,1668914.0],"skipIndex":0,"section_code":"gallery","featured_images":"1668914,1668912,1668910,1668908,1668907,1668905,1668904,1668903","id":22184,"singleSection":false});				  						galleries[22839] = clik.newGallery({"parentGallery":69505,"usePopups":false,"title":"The Ceremony","link":"gallery_22839.html","maxRecords":0.0,"photoIDs":[1668916.0,1668961.0,1668962.0,1668968.0,1668973.0,1668975.0],"skipIndex":0,"section_code":"gallery","featured_images":"1668975,1668973,1668968,1668962,1668961,1668916","id":22839,"singleSection":false});				  						galleries[23773] = clik.newGallery({"parentGallery":69505,"usePopups":false,"title":"The Wedding Party","link":"gallery_23773.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":23773,"singleSection":false});				  						galleries[23776] = clik.newGallery({"parentGallery":69505,"usePopups":false,"title":"The Reception","link":"gallery_23776.html","maxRecords":0.0,"photoIDs":[1669000.0,1669001.0,1669003.0],"skipIndex":0,"section_code":"gallery","featured_images":"1669003,1669001,1669000","id":23776,"singleSection":false});				  						galleries[426420] = clik.newGallery({"parentGallery":69505,"usePopups":false,"title":"Bride & Groom","link":"gallery_426420.html","maxRecords":0.0,"photoIDs":[1668990.0,1668996.0,1668991.0,1668997.0,1668998.0],"skipIndex":0,"section_code":"gallery","featured_images":1668990.0,"id":426420,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '1668996';
imageSets[2] = '7901244,1614380,1340571,1668990';
imageSets[3] = '7901257,7901254,7901253,7901252,7901249,7901244,2760806,2179824,2179821,2179816,2179814,2179812,2179810,2179003,2001471,1791786,1669003,1669001,1669000,1668998,1668997,1668996,1668991,1668990,1668975,1668973,1668968,1668962,1668961,1668916,1668914,1668912,1668910,1668908,1668907,1668905,1668904,1668903,1614380,1340577,1340576,1340571,1340569,1340564,1282097,1282095,1281808,1281522,1281512,1281501';
imageSets[49984] = '1668903,1668904,1668907,1668910,1668912,1668914';
imageSets[102424] = '2179810,2179812,2179814,7901253,2179816,2179821,2179824';
imageSets[50870] = '1614380';
imageSets[49982] = '1340571,1282095,1281808,1281501,1340569,1340576,2760806,1340564,1340577,1282097,1791786,1281522,1281512,2001471';
imageSets[50006] = '2179003';
imageSets[49985] = '1668916,1668961,1668962,1668968,1668975,1668973';
imageSets[49987] = '1669000,1669001,1669003';
imageSets[49988] = '7901244,7901249,7901252,7901254,7901257';
imageSets[242584] = '1668996,1668990,1668991,1668997,1668998';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/thunderbird1/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/thunderbird1/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'creative moments photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					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;
	}
}

			

