window.thumbnails = {};
															thumbnails[1332015] = clik.newPhoto({"id":1332015,"src":"finishedfullinside_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1332015.html","width":130,"caption":"Glass Panel above Front door.Commission.","height":85});
															thumbnails[868580] = clik.newPhoto({"id":868580,"src":"141 Tulips part2_thumb.jpg","galleries_id":66759,"server_id":1,"link":"photo_868580.html","width":86,"caption":"Two Tulips","height":130});
															thumbnails[868592] = clik.newPhoto({"id":868592,"src":"bathroom door stained glass_thumb.JPG","galleries_id":66663,"server_id":1,"link":"photo_868592.html","width":98,"caption":"Door Panels","height":130});
															thumbnails[1111071] = clik.newPhoto({"id":1111071,"src":"red lily closeup_thumb.jpg","galleries_id":66662,"server_id":1,"link":"photo_1111071.html","width":129,"caption":"Red Lily","height":130});
															thumbnails[1111353] = clik.newPhoto({"id":1111353,"src":"Tulips_thumb.jpg","galleries_id":66662,"server_id":1,"link":"photo_1111353.html","width":104,"caption":"Tulips","height":130});
															thumbnails[1111400] = clik.newPhoto({"id":1111400,"src":"Bubbles_thumb.JPG","galleries_id":66661,"server_id":1,"link":"photo_1111400.html","width":95,"caption":"Bubbles","height":130});
															thumbnails[1111415] = clik.newPhoto({"id":1111415,"src":"100_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1111415.html","width":102,"caption":100.0,"height":130});
															thumbnails[1111427] = clik.newPhoto({"id":1111427,"src":"fireworks_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1111427.html","width":102,"caption":"Fireworks","height":130});
															thumbnails[1111431] = clik.newPhoto({"id":1111431,"src":"Lilies_thumb.jpg","galleries_id":66662,"server_id":1,"link":"photo_1111431.html","width":111,"caption":"Lilies","height":130});
															thumbnails[1111432] = clik.newPhoto({"id":1111432,"src":"Vortex_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1111432.html","width":93,"caption":"Vortex","height":130});
															thumbnails[1504458] = clik.newPhoto({"id":1504458,"src":"card170_thumb.jpg","galleries_id":66759,"server_id":1,"link":"photo_1504458.html","width":98,"caption":"","height":130});
															thumbnails[1504469] = clik.newPhoto({"id":1504469,"src":"card172_thumb.jpg","galleries_id":66759,"server_id":1,"link":"photo_1504469.html","width":98,"caption":"","height":130});
															thumbnails[1504470] = clik.newPhoto({"id":1504470,"src":"card187_thumb.jpg","galleries_id":66759,"server_id":1,"link":"photo_1504470.html","width":94,"caption":"","height":130});
															thumbnails[1504478] = clik.newPhoto({"id":1504478,"src":"card177_thumb.jpg","galleries_id":66759,"server_id":1,"link":"photo_1504478.html","width":94,"caption":"","height":130});
															thumbnails[1526156] = clik.newPhoto({"id":1526156,"src":"S3700004_thumb.JPG","galleries_id":66663,"server_id":1,"link":"photo_1526156.html","width":98,"caption":"Glass panel in Serving Hatch.Commission.","height":130});
															thumbnails[1526161] = clik.newPhoto({"id":1526161,"src":"89_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1526161.html","width":130,"caption":"Untitled","height":129});
															thumbnails[1526163] = clik.newPhoto({"id":1526163,"src":"OrangeLilies_thumb.jpg","galleries_id":66662,"server_id":1,"link":"photo_1526163.html","width":120,"caption":"Orange Lilies","height":130});
															thumbnails[1526164] = clik.newPhoto({"id":1526164,"src":"ShapesinPurple_thumb.JPG","galleries_id":66661,"server_id":1,"link":"photo_1526164.html","width":84,"caption":"Shapes in Purple","height":130});
															thumbnails[1526221] = clik.newPhoto({"id":1526221,"src":"Yellow Lillies_thumb.jpg","galleries_id":66662,"server_id":1,"link":"photo_1526221.html","width":91,"caption":"Yellow Lilies","height":130});
															thumbnails[1538574] = clik.newPhoto({"id":1538574,"src":"fanlight no_thumb.16.jpg","galleries_id":66663,"server_id":1,"link":"photo_1538574.html","width":130,"caption":"Fanlight for Front door","height":78});
															thumbnails[1538582] = clik.newPhoto({"id":1538582,"src":"Number 6_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1538582.html","width":130,"caption":"Front door fanlight Number 6","height":90});
															thumbnails[1538585] = clik.newPhoto({"id":1538585,"src":"David P panel 7_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1538585.html","width":130,"caption":"Door panel","height":98});
															thumbnails[1538589] = clik.newPhoto({"id":1538589,"src":"fanlight 1_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1538589.html","width":130,"caption":"Fanlight panel","height":73});
															thumbnails[1538593] = clik.newPhoto({"id":1538593,"src":"Tulips1_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1538593.html","width":91,"caption":"Tulips Light Catcher","height":130});
															thumbnails[1618433] = clik.newPhoto({"id":1618433,"src":"pictureframe3_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1618433.html","width":103,"caption":"Stained Glass Picture Frame","height":130});
															thumbnails[1618439] = clik.newPhoto({"id":1618439,"src":"mirror3_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1618439.html","width":87,"caption":"Mirror","height":130});
															thumbnails[1618442] = clik.newPhoto({"id":1618442,"src":"mirror21_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1618442.html","width":128,"caption":"Blue Square mirror","height":130});
															thumbnails[1734291] = clik.newPhoto({"id":1734291,"src":"bluehorizonsdetail_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1734291.html","width":130,"caption":"Blue Horizons","height":129});
															thumbnails[1734296] = clik.newPhoto({"id":1734296,"src":"rainbowdetail_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1734296.html","width":130,"caption":"Rainbow","height":130});
															thumbnails[1734298] = clik.newPhoto({"id":1734298,"src":"redstripe1detail_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1734298.html","width":129,"caption":"Red Stripe","height":130});
															thumbnails[1766427] = clik.newPhoto({"id":1766427,"src":"bluensilverdetail_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1766427.html","width":88,"caption":"Blue & Silver","height":130});
															thumbnails[1766429] = clik.newPhoto({"id":1766429,"src":"red tulips detail_thumb.jpg","galleries_id":66662,"server_id":1,"link":"photo_1766429.html","width":80,"caption":"","height":130});
															thumbnails[1766430] = clik.newPhoto({"id":1766430,"src":"shapes in blue&red detail_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1766430.html","width":103,"caption":"","height":130});
															thumbnails[1799646] = clik.newPhoto({"id":1799646,"src":"S3700007_1_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_1799646.html","width":62,"caption":"Shoreline","height":130});
															thumbnails[1833618] = clik.newPhoto({"id":1833618,"src":"S3700456sparky600_thumb.jpg","galleries_id":123357,"server_id":1,"link":"photo_1833618.html","width":130,"caption":"Feethams Flyer","height":85});
															thumbnails[1915682] = clik.newPhoto({"id":1915682,"src":"mirror_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1915682.html","width":98,"caption":"Round stained glass mirror.","height":130});
															thumbnails[1915695] = clik.newPhoto({"id":1915695,"src":"mirror22_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_1915695.html","width":123,"caption":"Round mirror wirh red flowers.","height":130});
															thumbnails[2001577] = clik.newPhoto({"id":2001577,"src":"S3700015_thumb.JPG","galleries_id":66663,"server_id":1,"link":"photo_2001577.html","width":98,"caption":"Mirror","height":130});
															thumbnails[2152428] = clik.newPhoto({"id":2152428,"src":"red flower mirror_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2152428.html","width":128,"caption":"Red Flower Mirror","height":130});
															thumbnails[2152442] = clik.newPhoto({"id":2152442,"src":"mirror41_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2152442.html","width":126,"caption":"Square Pink and blue textured galss mirror.","height":130});
															thumbnails[2216903] = clik.newPhoto({"id":2216903,"src":"CirclesinPink_thumb.jpg","galleries_id":66661,"server_id":1,"link":"photo_2216903.html","width":91,"caption":"Circles in Pink","height":130});
															thumbnails[2216905] = clik.newPhoto({"id":2216905,"src":"card 111 MG crop border_thumb.jpg","galleries_id":66759,"server_id":1,"link":"photo_2216905.html","width":87,"caption":"Abstract art card","height":130});
															thumbnails[2343903] = clik.newPhoto({"id":2343903,"src":"blue light catcher_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2343903.html","width":56,"caption":"Blue Light Catcher","height":130});
															thumbnails[2343905] = clik.newPhoto({"id":2343905,"src":"light catcher 1_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2343905.html","width":46,"caption":"Leaded Light Catcher","height":130});
															thumbnails[2343907] = clik.newPhoto({"id":2343907,"src":"mo's frame_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2343907.html","width":97,"caption":"Commissioned Stained Glass Photo Frame ","height":130});
															thumbnails[2343910] = clik.newPhoto({"id":2343910,"src":"light catcher 2_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2343910.html","width":46,"caption":"Leaded Light Catcher<br>\r\n","height":130});
															thumbnails[2343922] = clik.newPhoto({"id":2343922,"src":"Tuliplightcatcher_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2343922.html","width":72,"caption":"Tulip Light Catcher","height":130});
															thumbnails[2402841] = clik.newPhoto({"id":2402841,"src":"greenphotoframe1_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2402841.html","width":97,"caption":"Green Stained Glass Photo Frame","height":130});
															thumbnails[2535395] = clik.newPhoto({"id":2535395,"src":"blackandwhiteframe1front_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2535395.html","width":126,"caption":"Black and White stained glass photo frame.","height":130});
															thumbnails[2621805] = clik.newPhoto({"id":2621805,"src":"bluesquareframe_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_2621805.html","width":130,"caption":"Blue stained glass photo frame","height":123});
															thumbnails[2698547] = clik.newPhoto({"id":2698547,"src":"set of 3 swirlcards_thumb.jpg","galleries_id":66759,"server_id":1,"link":"photo_2698547.html","width":130,"caption":"Set of three swirly  art cards","height":68});
															thumbnails[4142498] = clik.newPhoto({"id":4142498,"src":"blue_square_mirror_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_4142498.html","width":121,"caption":"Blue Square Stained Glass Mirror","height":130});
															thumbnails[4143066] = clik.newPhoto({"id":4143066,"src":"flowerlightcatcher_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_4143066.html","width":98,"caption":"Red Flower Stained Glass Light Catcher","height":130});
															thumbnails[7614973] = clik.newPhoto({"id":7614973,"src":"Greenleafmirror_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_7614973.html","width":98,"caption":"Green Leaf Mirror","height":130});
															thumbnails[7812214] = clik.newPhoto({"id":7812214,"src":"blueredmirror_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_7812214.html","width":124,"caption":"Stained Glass Mirror","height":130});
															thumbnails[7812251] = clik.newPhoto({"id":7812251,"src":"redwhitebluemirror_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_7812251.html","width":98,"caption":"Stained Glass Mirror","height":130});
															thumbnails[7812261] = clik.newPhoto({"id":7812261,"src":"blackwhitemirror_thumb.jpg","galleries_id":66663,"server_id":1,"link":"photo_7812261.html","width":122,"caption":"Stained Glass Mirror","height":130});
															thumbnails[1177306] = clik.newPhoto({"id":1177306,"src":"katyheartview_thumb.jpg","galleries_id":81531,"server_id":1,"link":"photo_1177306.html","width":130,"caption":"More glass has been cut out for the design.","height":98});
															thumbnails[1177303] = clik.newPhoto({"id":1177303,"src":"katycutglass_thumb.jpg","galleries_id":81531,"server_id":1,"link":"photo_1177303.html","width":130,"caption":"","height":98});
															thumbnails[1177315] = clik.newPhoto({"id":1177315,"src":"katyviewleft_thumb.jpg","galleries_id":81531,"server_id":1,"link":"photo_1177315.html","width":130,"caption":"Close up of left hand side.","height":98});
															thumbnails[1177309] = clik.newPhoto({"id":1177309,"src":"katyrightview_thumb.jpg","galleries_id":81531,"server_id":1,"link":"photo_1177309.html","width":130,"caption":"Glass with lead work. Coming together.","height":98});
															thumbnails[1238456] = clik.newPhoto({"id":1238456,"src":"S3700001_thumb.jpg","galleries_id":81531,"server_id":1,"link":"photo_1238456.html","width":130,"caption":"Finished panel.","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[66661] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Abstracts","link":"gallery_66661.html","maxRecords":0.0,"photoIDs":[1111400.0,1111415.0,1111427.0,1111432.0,1526161.0,1526164.0,1734291.0,1734296.0,1734298.0,1766427.0,1766430.0,1799646.0,2216903.0],"skipIndex":0,"section_code":"gallery","featured_images":"2216903,1799646,1766430,1766427,1734298,1734296,1734291,1526164,1526161,1111432","id":66661,"singleSection":false});				  						galleries[66759] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Art Cards","link":"gallery_66759.html","maxRecords":0.0,"photoIDs":[868580.0,1504458.0,1504469.0,1504470.0,1504478.0,2216905.0,2698547.0],"skipIndex":0,"section_code":"gallery","featured_images":2216905.0,"id":66759,"singleSection":false});				  						galleries[66662] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Florals","link":"gallery_66662.html","maxRecords":0.0,"photoIDs":[1111071.0,1111353.0,1111431.0,1526163.0,1526221.0,1766429.0],"skipIndex":0,"section_code":"gallery","featured_images":1111353.0,"id":66662,"singleSection":false});				  						galleries[123357] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Other Artwork","link":"gallery_123357.html","maxRecords":0.0,"photoIDs":[1833618.0],"skipIndex":0,"section_code":"gallery","featured_images":1833618.0,"id":123357,"singleSection":false});				  						galleries[66663] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Stained Glass","link":"gallery_66663.html","maxRecords":0.0,"photoIDs":[1332015.0,868592.0,1526156.0,1538574.0,1538582.0,1538585.0,1538589.0,1538593.0,1618433.0,1618439.0,1618442.0,1915682.0,1915695.0,2001577.0,2152428.0,2152442.0,2343903.0,2343905.0,2343907.0,2343910.0,2343922.0,2402841.0,2535395.0,2621805.0,4142498.0,4143066.0,7614973.0,7812214.0,7812251.0,7812261.0],"skipIndex":0,"section_code":"gallery","featured_images":"7812261,7812251,7812214,7614973,4143066,4142498,2621805,2535395,2402841,2343922","id":66663,"singleSection":false});				  						galleries[81531] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Work in progress","link":"gallery_81531.html","maxRecords":0.0,"photoIDs":[1177306.0,1177303.0,1177315.0,1177309.0,1238456.0],"skipIndex":0,"section_code":"gallery","featured_images":"1238456,1177315,1177309,1177306,1177303","id":81531,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7812261,7812251,7812214,7614973,4142498,2621805,2535395,2343907,2343903,2216905,2216903,2001577,1833618,1618442,1618439,1538589,1538582,1538574,1526163,1526156,1332015,1111431,1111400,1111353,868592';
imageSets[2] = '2216905,1833618,1111353';
imageSets[3] = '7812261,7812251,7812214,7614973,4143066,4142498,2698547,2621805,2535395,2402841,2343922,2343910,2343907,2343905,2343903,2216905,2216903,2152442,2152428,2001577,1915695,1915682,1833618,1799646,1766430,1766429,1766427,1734298,1734296,1734291,1618442,1618439,1618433,1538593,1538589,1538585,1538582,1538574,1526221,1526164,1526163,1526161,1526156,1504478,1504470,1504469,1504458,1332015,1238456,1177315';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/susanjeff/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/susanjeff/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 = 'Art by Susan Jefferson: ' + 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="susanjefferson@hotmail.co.uk">';
					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="susanjefferson@hotmail.co.uk">';
				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;
	}
}

			

