window.thumbnails = {};
															thumbnails[7607721] = clik.newPhoto({"id":7607721,"src":"Blue-Canvas_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_7607721.html","width":130,"caption":"Summer Painting II","height":114});
															thumbnails[7608174] = clik.newPhoto({"id":7608174,"src":"Lane_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_7608174.html","width":130,"caption":"Summer Lane","height":98});
															thumbnails[8792359] = clik.newPhoto({"id":8792359,"src":"Early-morning_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_8792359.html","width":130,"caption":"Untitled Blue Landscape ","height":87});
															thumbnails[3744109] = clik.newPhoto({"id":3744109,"src":"Dune_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_3744109.html","width":130,"caption":"Dune","height":99});
															thumbnails[1643626] = clik.newPhoto({"id":1643626,"src":"December-Rotation_thumb.jpg","galleries_id":110984,"server_id":18,"link":"photo_1643626.html","width":93,"caption":"December Rotation","height":130});
															thumbnails[1643650] = clik.newPhoto({"id":1643650,"src":"Shadow-Passing_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1643650.html","width":130,"caption":"Shadow Passing","height":98});
															thumbnails[1644870] = clik.newPhoto({"id":1644870,"src":"X88-X_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1644870.html","width":98,"caption":"XX88","height":130});
															thumbnails[1718647] = clik.newPhoto({"id":1718647,"src":"4-Bars1_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1718647.html","width":130,"caption":"Four Bars","height":87});
															thumbnails[1658392] = clik.newPhoto({"id":1658392,"src":"Grid-I_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1658392.html","width":130,"caption":"Grid I","height":99});
															thumbnails[1646743] = clik.newPhoto({"id":1646743,"src":"Grid-III-x_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1646743.html","width":123,"caption":"Grid III","height":130});
															thumbnails[7608208] = clik.newPhoto({"id":7608208,"src":"Mapscape_Coastal_II1_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_7608208.html","width":129,"caption":"Mapscape Coastal II","height":130});
															thumbnails[1639695] = clik.newPhoto({"id":1639695,"src":"EarthFigure_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1639695.html","width":130,"caption":"Earth Figure","height":98});
															thumbnails[1644833] = clik.newPhoto({"id":1644833,"src":"Link_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1644833.html","width":87,"caption":"Link","height":130});
															thumbnails[1658492] = clik.newPhoto({"id":1658492,"src":"April-Rotation_thumb.jpg","galleries_id":110984,"server_id":18,"link":"photo_1658492.html","width":91,"caption":"April Rotation","height":130});
															thumbnails[1718567] = clik.newPhoto({"id":1718567,"src":"CornDrills1_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1718567.html","width":130,"caption":"Scorch","height":81});
															thumbnails[1643645] = clik.newPhoto({"id":1643645,"src":"Rotation Ploughed_thumb.jpg","galleries_id":110984,"server_id":18,"link":"photo_1643645.html","width":93,"caption":"Ploughed Rotation","height":130});
															thumbnails[1643653] = clik.newPhoto({"id":1643653,"src":"Cross-Tracks_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1643653.html","width":130,"caption":"Cross Tracks","height":97});
															thumbnails[1644932] = clik.newPhoto({"id":1644932,"src":"Parade4_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1644932.html","width":104,"caption":"Parade","height":130});
															thumbnails[1649724] = clik.newPhoto({"id":1649724,"src":"Frag_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1649724.html","width":130,"caption":"Fragment","height":78});
															thumbnails[3139889] = clik.newPhoto({"id":3139889,"src":"Echo-II_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_3139889.html","width":130,"caption":"Echo II","height":99});
															thumbnails[1643571] = clik.newPhoto({"id":1643571,"src":"Floating-Figure_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1643571.html","width":130,"caption":"Floating Figure","height":87});
															thumbnails[1643648] = clik.newPhoto({"id":1643648,"src":"Shadow-Pathway_thumb.jpg","galleries_id":110984,"server_id":18,"link":"photo_1643648.html","width":130,"caption":"Shadow Pathway","height":54});
															thumbnails[1645037] = clik.newPhoto({"id":1645037,"src":"Spring-Lines-22_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1645037.html","width":130,"caption":"Spring Lines II","height":98});
															thumbnails[3139898] = clik.newPhoto({"id":3139898,"src":"Paper Work I_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_3139898.html","width":130,"caption":"Old Barn","height":90});
															thumbnails[1639696] = clik.newPhoto({"id":1639696,"src":"Fibre-Figure_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1639696.html","width":130,"caption":"Fibre Figure","height":96});
															thumbnails[1643628] = clik.newPhoto({"id":1643628,"src":"Harvest-Field_thumb.JPG","galleries_id":110984,"server_id":18,"link":"photo_1643628.html","width":95,"caption":"Harvest Field Series","height":130});
															thumbnails[1645034] = clik.newPhoto({"id":1645034,"src":"Spring-Lines-12_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1645034.html","width":130,"caption":"Spring Lines I","height":98});
															thumbnails[1643613] = clik.newPhoto({"id":1643613,"src":"Reclining-Figure_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1643613.html","width":130,"caption":"Reclinging Figure","height":86});
															thumbnails[1643651] = clik.newPhoto({"id":1643651,"src":"Shadow-Absorbed_thumb.JPG","galleries_id":110984,"server_id":18,"link":"photo_1643651.html","width":130,"caption":"Shadow Absorbed","height":56});
															thumbnails[1644871] = clik.newPhoto({"id":1644871,"src":"Field-Lines2_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1644871.html","width":130,"caption":"Field Lines I","height":98});
															thumbnails[1718601] = clik.newPhoto({"id":1718601,"src":"Plantation1_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1718601.html","width":130,"caption":"Plantation","height":87});
															thumbnails[1643646] = clik.newPhoto({"id":1643646,"src":"Green-Heart_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1643646.html","width":86,"caption":"Green Heart","height":130});
															thumbnails[1645030] = clik.newPhoto({"id":1645030,"src":"Line-Day-13_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1645030.html","width":130,"caption":"Line: Day 1","height":77});
															thumbnails[1646746] = clik.newPhoto({"id":1646746,"src":"Grid-V-x_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1646746.html","width":130,"caption":"Grid V","height":93});
															thumbnails[1726735] = clik.newPhoto({"id":1726735,"src":"Yard-August-07_thumb.jpg","galleries_id":110984,"server_id":18,"link":"photo_1726735.html","width":130,"caption":"Yard Wave August 07","height":96});
															thumbnails[3742310] = clik.newPhoto({"id":3742310,"src":"Cart1b_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_3742310.html","width":130,"caption":"Cartograph I","height":98});
															thumbnails[1643616] = clik.newPhoto({"id":1643616,"src":"Water-Figure_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1643616.html","width":87,"caption":"Water Figure","height":130});
															thumbnails[1644844] = clik.newPhoto({"id":1644844,"src":"DodnashCircles1_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1644844.html","width":130,"caption":"Farm Circles IV","height":95});
															thumbnails[1721618] = clik.newPhoto({"id":1721618,"src":"Rotation-(April)_thumb.jpg","galleries_id":110984,"server_id":18,"link":"photo_1721618.html","width":130,"caption":"Rotation One 2007","height":88});
															thumbnails[3742344] = clik.newPhoto({"id":3742344,"src":"Cart2b_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_3742344.html","width":130,"caption":"Plantation","height":99});
															thumbnails[3742348] = clik.newPhoto({"id":3742348,"src":"Earth-Drawing-a_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_3742348.html","width":130,"caption":"Earth Drawing","height":98});
															thumbnails[6549511] = clik.newPhoto({"id":6549511,"src":"Coastal-Field_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_6549511.html","width":130,"caption":"Beachmark","height":98});
															thumbnails[6549717] = clik.newPhoto({"id":6549717,"src":"Stepney-Lanes_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_6549717.html","width":130,"caption":"Stepney Lanes","height":99});
															thumbnails[6550105] = clik.newPhoto({"id":6550105,"src":"Inlet-yyt1_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_6550105.html","width":130,"caption":"Offshore","height":97});
															thumbnails[1643622] = clik.newPhoto({"id":1643622,"src":"Blue-heart_thumb.JPG","galleries_id":110985,"server_id":18,"link":"photo_1643622.html","width":88,"caption":"Blue Heart","height":130});
															thumbnails[1643968] = clik.newPhoto({"id":1643968,"src":"Harbour_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1643968.html","width":130,"caption":"Harbour","height":103});
															thumbnails[1646755] = clik.newPhoto({"id":1646755,"src":"Sentinel-x_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1646755.html","width":130,"caption":"Sentinel","height":72});
															thumbnails[1726730] = clik.newPhoto({"id":1726730,"src":"land-surfer1_thumb.jpg","galleries_id":110984,"server_id":18,"link":"photo_1726730.html","width":130,"caption":"Rotation Two 2007","height":98});
															thumbnails[6549961] = clik.newPhoto({"id":6549961,"src":"Mapscape-Moor1_thumb.jpg","galleries_id":192570,"server_id":18,"link":"photo_6549961.html","width":130,"caption":"Mapscape: Moor","height":116});
															thumbnails[1639664] = clik.newPhoto({"id":1639664,"src":"Archival_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1639664.html","width":100,"caption":"Archival  ","height":130});
															thumbnails[1643647] = clik.newPhoto({"id":1643647,"src":"Wrapped-Figure_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1643647.html","width":87,"caption":"Wrapped Figure","height":130});
															thumbnails[1646821] = clik.newPhoto({"id":1646821,"src":"Maize-3-Leaf_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1646821.html","width":95,"caption":"Wind drawing I","height":130});
															thumbnails[1643621] = clik.newPhoto({"id":1643621,"src":"Filament-Figure_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_1643621.html","width":87,"caption":"Filament Figure","height":130});
															thumbnails[1688656] = clik.newPhoto({"id":1688656,"src":"Territorial-1_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1688656.html","width":130,"caption":"Grid VIII","height":121});
															thumbnails[3742353] = clik.newPhoto({"id":3742353,"src":"MGb_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_3742353.html","width":130,"caption":"Marked Ground","height":100});
															thumbnails[7608179] = clik.newPhoto({"id":7608179,"src":"Echo_III1_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_7608179.html","width":126,"caption":"Echo III","height":130});
															thumbnails[1639672] = clik.newPhoto({"id":1639672,"src":"Archival-II_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1639672.html","width":112,"caption":"Archival II  ","height":130});
															thumbnails[1646827] = clik.newPhoto({"id":1646827,"src":"Wind-Drawing-61_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1646827.html","width":130,"caption":"Wind drawing II","height":92});
															thumbnails[2574109] = clik.newPhoto({"id":2574109,"src":"Split-Figure-ii2_thumb.jpg","galleries_id":110985,"server_id":18,"link":"photo_2574109.html","width":90,"caption":"Split Figure","height":130});
															thumbnails[1646822] = clik.newPhoto({"id":1646822,"src":"Wind-Drawing-3_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1646822.html","width":130,"caption":"Wind drawing III","height":93});
															thumbnails[1644845] = clik.newPhoto({"id":1644845,"src":"Earthworks1_thumb.jpg","galleries_id":111127,"server_id":18,"link":"photo_1644845.html","width":64,"caption":"Earthworks","height":130});
															thumbnails[1646741] = clik.newPhoto({"id":1646741,"src":"Echo-x_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1646741.html","width":130,"caption":"Echo","height":129});
															thumbnails[1704451] = clik.newPhoto({"id":1704451,"src":"NY_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_1704451.html","width":130,"caption":"Street Site","height":130});
															thumbnails[7608150] = clik.newPhoto({"id":7608150,"src":"Spring_Evening_NF_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_7608150.html","width":129,"caption":"North Field Spring","height":130});
															thumbnails[2572653] = clik.newPhoto({"id":2572653,"src":"Untitled-1_thumb.jpg","galleries_id":110982,"server_id":18,"link":"photo_2572653.html","width":130,"caption":"Summer Painting","height":116});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[110982] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Paintings","link":"gallery_110982.html","maxRecords":0.0,"photoIDs":[7607721.0,8792359.0,1718647.0,1658392.0,1646743.0,7608208.0,1718567.0,1649724.0,1718601.0,1646746.0,1643968.0,1639664.0,1688656.0,3742353.0,7608179.0,1639672.0,1646741.0,1704451.0,7608150.0,2572653.0],"skipIndex":0,"section_code":"gallery","featured_images":"8792359,1649724,1639664","id":110982,"singleSection":false});				  						galleries[192570] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Smaller paintings","link":"gallery_192570.html","maxRecords":0.0,"photoIDs":[7608174.0,3744109.0,3139889.0,3139898.0,3742310.0,3742344.0,3742348.0,6549511.0,6549717.0,6550105.0,6549961.0],"skipIndex":0,"section_code":"gallery","featured_images":"7608174,6550105,6549961,6549717,6549511,3744109,3742348,3742344,3742310,3139898","id":192570,"singleSection":false});				  						galleries[110985] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Figures","link":"gallery_110985.html","maxRecords":0.0,"photoIDs":[1643650.0,1639695.0,1643653.0,1643571.0,1639696.0,1643613.0,1643646.0,1643616.0,1643622.0,1643647.0,1643621.0,2574109.0],"skipIndex":0,"section_code":"gallery","featured_images":1643622.0,"id":110985,"singleSection":false});				  						galleries[111127] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landworks","link":"gallery_111127.html","maxRecords":0.0,"photoIDs":[1644870.0,1644833.0,1644932.0,1645037.0,1645034.0,1644871.0,1645030.0,1644844.0,1646755.0,1646821.0,1646827.0,1646822.0,1644845.0],"skipIndex":0,"section_code":"gallery","featured_images":1645034.0,"id":111127,"singleSection":false});				  						galleries[110984] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Shadows ","link":"gallery_110984.html","maxRecords":0.0,"photoIDs":[1643626.0,1658492.0,1643645.0,1643648.0,1643628.0,1643651.0,1726735.0,1721618.0,1726730.0],"skipIndex":0,"section_code":"gallery","featured_images":1658492.0,"id":110984,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8792359,7608150';
imageSets[2] = '8792359,1658492,1649724,1645034,1643622,1639664';
imageSets[3] = '8792359,3744109,1718647,1644870,1643650,1658392,1718567,1658492,1644833,3139889,1649724,1644932,1643653,1643645,3139898,1645037,1643648,1645034,1643628,1718601,1644871,1643651,3742310,1726735,1646746,1645030,1643646,3742344,1721618,1644844,3742348,6549511,6549717,1726730,1646755,1643968,6549961,1646821,1643647,1688656';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/JuliaGiles/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/JuliaGiles/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 = 'Julia Giles Artwork: ' + 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 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 += '<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="juliagiles59@googlemail.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="juliagiles59@googlemail.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;
	}
}

			

