window.thumbnails = {};
															thumbnails[5428060] = clik.newPhoto({"id":5428060,"src":"wedding_bouqeut_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":81});
															thumbnails[5428061] = clik.newPhoto({"id":5428061,"src":"Wedding_rings_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":86});
															thumbnails[5431593] = clik.newPhoto({"id":5431593,"src":"wedding_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":90});
															thumbnails[6583143] = clik.newPhoto({"id":6583143,"src":"wedding_album_trad1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":229});
															thumbnails[7871134] = clik.newPhoto({"id":7871134,"src":"Nige__Marisa_edited-21_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":86});
															thumbnails[7871136] = clik.newPhoto({"id":7871136,"src":"39_edited-11_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[7871462] = clik.newPhoto({"id":7871462,"src":"2010_05_21_4885_edited-1_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":163});
															thumbnails[8986462] = clik.newPhoto({"id":8986462,"src":"dad_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":161});
															thumbnails[6222218] = clik.newPhoto({"id":6222218,"src":"2010_05_30_5091_BW_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222218.html","width":130,"caption":"","height":195});
															thumbnails[6222273] = clik.newPhoto({"id":6222273,"src":"2010_05_30_5125_BW1_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222273.html","width":130,"caption":"","height":86});
															thumbnails[6222284] = clik.newPhoto({"id":6222284,"src":"2010_05_30_5236_copy_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222284.html","width":130,"caption":"","height":163});
															thumbnails[6222287] = clik.newPhoto({"id":6222287,"src":"2010_05_30_5256_BW1_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222287.html","width":130,"caption":"","height":163});
															thumbnails[6222289] = clik.newPhoto({"id":6222289,"src":"2010_05_30_5307_BW1_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222289.html","width":130,"caption":"","height":104});
															thumbnails[6222292] = clik.newPhoto({"id":6222292,"src":"2010_05_30_5315_BW_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222292.html","width":130,"caption":"","height":104});
															thumbnails[6222294] = clik.newPhoto({"id":6222294,"src":"2010_05_30_5355_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222294.html","width":130,"caption":"","height":104});
															thumbnails[6222296] = clik.newPhoto({"id":6222296,"src":"2010_05_30_5532_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222296.html","width":130,"caption":"","height":104});
															thumbnails[6222298] = clik.newPhoto({"id":6222298,"src":"2010_05_30_5558_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222298.html","width":130,"caption":"","height":86});
															thumbnails[6222299] = clik.newPhoto({"id":6222299,"src":"2010_05_30_5573_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222299.html","width":130,"caption":"","height":163});
															thumbnails[6222302] = clik.newPhoto({"id":6222302,"src":"2010_05_30_5618_BW_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6222302.html","width":130,"caption":"","height":104});
															thumbnails[6855483] = clik.newPhoto({"id":6855483,"src":"2010_08_27_6351_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6855483.html","width":130,"caption":"","height":104});
															thumbnails[6855500] = clik.newPhoto({"id":6855500,"src":"2010_08_27_6382_BW_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6855500.html","width":130,"caption":"","height":104});
															thumbnails[6855507] = clik.newPhoto({"id":6855507,"src":"2010_08_27_6398_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6855507.html","width":130,"caption":"","height":163});
															thumbnails[6855512] = clik.newPhoto({"id":6855512,"src":"2010_08_27_6595_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6855512.html","width":130,"caption":"","height":163});
															thumbnails[6855520] = clik.newPhoto({"id":6855520,"src":"2010_08_27_6670_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6855520.html","width":130,"caption":"","height":163});
															thumbnails[6855527] = clik.newPhoto({"id":6855527,"src":"2010_08_27_6865_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6855527.html","width":130,"caption":"","height":86});
															thumbnails[6855530] = clik.newPhoto({"id":6855530,"src":"2010_08_27_6889_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6855530.html","width":130,"caption":"","height":163});
															thumbnails[6855535] = clik.newPhoto({"id":6855535,"src":"2010_08_27_6914_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6855535.html","width":130,"caption":"","height":104});
															thumbnails[6881515] = clik.newPhoto({"id":6881515,"src":"2010_10_09_7580_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881515.html","width":130,"caption":"","height":104});
															thumbnails[6881516] = clik.newPhoto({"id":6881516,"src":"2010_10_09_7612_copy_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881516.html","width":130,"caption":"","height":104});
															thumbnails[6881517] = clik.newPhoto({"id":6881517,"src":"2010_10_09_7659_copy_1_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881517.html","width":130,"caption":"","height":163});
															thumbnails[6881518] = clik.newPhoto({"id":6881518,"src":"2010_10_09_7686_BW_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881518.html","width":130,"caption":"","height":86});
															thumbnails[6881519] = clik.newPhoto({"id":6881519,"src":"2010_10_09_7757_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881519.html","width":130,"caption":"","height":86});
															thumbnails[6881520] = clik.newPhoto({"id":6881520,"src":"2010_10_09_7843_colour_popped_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881520.html","width":130,"caption":"","height":163});
															thumbnails[6881521] = clik.newPhoto({"id":6881521,"src":"2010_10_09_7860_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881521.html","width":130,"caption":"","height":163});
															thumbnails[6881524] = clik.newPhoto({"id":6881524,"src":"2010_10_09_7866_BW_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881524.html","width":130,"caption":"","height":163});
															thumbnails[6881525] = clik.newPhoto({"id":6881525,"src":"2010_10_09_7871_BW_copy_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_6881525.html","width":130,"caption":"","height":104});
															thumbnails[7325583] = clik.newPhoto({"id":7325583,"src":"MM_0022_edited-4_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7325583.html","width":130,"caption":"","height":104});
															thumbnails[7325584] = clik.newPhoto({"id":7325584,"src":"MM_0170_edited-5_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7325584.html","width":130,"caption":"","height":104});
															thumbnails[7325587] = clik.newPhoto({"id":7325587,"src":"MM_0184_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7325587.html","width":130,"caption":"","height":86});
															thumbnails[7325588] = clik.newPhoto({"id":7325588,"src":"MM_0173_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7325588.html","width":130,"caption":"","height":104});
															thumbnails[7325612] = clik.newPhoto({"id":7325612,"src":"MM1_0222_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7325612.html","width":130,"caption":"","height":104});
															thumbnails[7871018] = clik.newPhoto({"id":7871018,"src":"_APP7404_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871018.html","width":130,"caption":"","height":104});
															thumbnails[7871019] = clik.newPhoto({"id":7871019,"src":"_APP7485_edited-4_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871019.html","width":130,"caption":"","height":158});
															thumbnails[7871021] = clik.newPhoto({"id":7871021,"src":"_APP7744_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871021.html","width":130,"caption":"","height":163});
															thumbnails[7871022] = clik.newPhoto({"id":7871022,"src":"_APP7756_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871022.html","width":130,"caption":"","height":104});
															thumbnails[7871024] = clik.newPhoto({"id":7871024,"src":"_APP7935_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871024.html","width":130,"caption":"","height":163});
															thumbnails[7871025] = clik.newPhoto({"id":7871025,"src":"_APP7959_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871025.html","width":130,"caption":"","height":104});
															thumbnails[7871026] = clik.newPhoto({"id":7871026,"src":"_APP7968_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871026.html","width":130,"caption":"","height":163});
															thumbnails[7871042] = clik.newPhoto({"id":7871042,"src":"_APP8054_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871042.html","width":130,"caption":"","height":163});
															thumbnails[7871043] = clik.newPhoto({"id":7871043,"src":"_APP8334_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871043.html","width":130,"caption":"","height":163});
															thumbnails[7871317] = clik.newPhoto({"id":7871317,"src":"_APP7698_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_7871317.html","width":130,"caption":"","height":104});
															thumbnails[8589581] = clik.newPhoto({"id":8589581,"src":"2011_09_16_2913_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589581.html","width":130,"caption":"","height":163});
															thumbnails[8589582] = clik.newPhoto({"id":8589582,"src":"2011_09_16_2926_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589582.html","width":130,"caption":"","height":86});
															thumbnails[8589583] = clik.newPhoto({"id":8589583,"src":"2011_09_16_2958_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589583.html","width":130,"caption":"","height":163});
															thumbnails[8589586] = clik.newPhoto({"id":8589586,"src":"2011_09_16_3056_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589586.html","width":130,"caption":"","height":163});
															thumbnails[8589588] = clik.newPhoto({"id":8589588,"src":"2011_09_16_3273_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589588.html","width":130,"caption":"","height":163});
															thumbnails[8589590] = clik.newPhoto({"id":8589590,"src":"2011_09_16_3384_edited-4_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589590.html","width":130,"caption":"","height":104});
															thumbnails[8589649] = clik.newPhoto({"id":8589649,"src":"2011_09_16_3395_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589649.html","width":130,"caption":"","height":163});
															thumbnails[8589653] = clik.newPhoto({"id":8589653,"src":"2011_09_16_3431_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589653.html","width":130,"caption":"","height":104});
															thumbnails[8589654] = clik.newPhoto({"id":8589654,"src":"2011_09_16_3640_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_8589654.html","width":130,"caption":"","height":86});
															thumbnails[9057947] = clik.newPhoto({"id":9057947,"src":"_APP2048_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_9057947.html","width":130,"caption":"","height":163});
															thumbnails[9057988] = clik.newPhoto({"id":9057988,"src":"_APP2109_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_9057988.html","width":130,"caption":"","height":163});
															thumbnails[9057991] = clik.newPhoto({"id":9057991,"src":"_APP2130_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_9057991.html","width":130,"caption":"","height":104});
															thumbnails[9057992] = clik.newPhoto({"id":9057992,"src":"_APP2204_edited-2_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_9057992.html","width":130,"caption":"","height":195});
															thumbnails[9057993] = clik.newPhoto({"id":9057993,"src":"_APP2133_edited-3_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_9057993.html","width":130,"caption":"","height":163});
															thumbnails[9057995] = clik.newPhoto({"id":9057995,"src":"asasa_thumb.jpg","galleries_id":346720,"server_id":32,"link":"photo_9057995.html","width":130,"caption":"","height":163});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[346720] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery.html","maxRecords":0.0,"photoIDs":[6222218.0,6222273.0,6222284.0,6222287.0,6222289.0,6222292.0,6222294.0,6222296.0,6222298.0,6222299.0,6222302.0,6855483.0,6855500.0,6855507.0,6855512.0,6855520.0,6855527.0,6855530.0,6855535.0,6881515.0,6881516.0,6881517.0,6881518.0,6881519.0,6881520.0,6881521.0,6881524.0,6881525.0,7325583.0,7325584.0,7325587.0,7325588.0,7325612.0,7871018.0,7871019.0,7871021.0,7871022.0,7871024.0,7871025.0,7871026.0,7871042.0,7871043.0,7871317.0,8589581.0,8589582.0,8589583.0,8589586.0,8589588.0,8589590.0,8589649.0,8589653.0,8589654.0,9057947.0,9057988.0,9057991.0,9057992.0,9057993.0,9057995.0],"skipIndex":0,"section_code":"gallery","featured_images":6881525.0,"id":346720,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9057995,9057993,9057992,9057991,9057988,9057947,8589654,8589653,8589649,8589590,8589588,8589586,8589583,8589582,8589581,7871462,7871317,7871043,7871042,7871026,7871025,7871024,7871022,7871021,7871019,7871018,7325612,7325588,7325587,7325584,7325583,6881525,6881524,6881521,6881520,6881519,6881518,6881517,6881516,6881515,6855535,6855530,6855527,6855520,6855512,6855507,6855500,6855483,6222302,6222299,6222298,6222296,6222294,6222292,6222289,6222287,6222284,6222273,6222218';
imageSets[2] = '6881525';
imageSets[3] = '9057995,9057993,9057992,9057991,9057988,9057947,8589654,8589653,8589649,8589590,8589588,8589586,8589583,8589582,8589581,7871462,7871317,7871043,7871042,7871026,7871025,7871024,7871022,7871021,7871019,7871018,7325612,7325588,7325587,7325584,7325583,6881525,6881524,6881521,6881520,6881519,6881518,6881517,6881516,6881515,6855535,6855530,6855527,6855520,6855512,6855507,6855500,6855483,6222302,6222299,6222298,6222296,6222294,6222292,6222289,6222287,6222284,6222273,6222218';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/parryade/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/parryade/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/parryade/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/parryade/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/parryade/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/parryade/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/parryade/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/parryade/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 = 'Alex Parry 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.item_price !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

