window.thumbnails = {};
															thumbnails[418460] = clik.newPhoto({"id":418460,"src":"morocco2_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":97,"caption":"My daughter in the Sahara Desert","height":130});
															thumbnails[1235255] = clik.newPhoto({"id":1235255,"src":"IMG_2381_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_1235255.html","width":130,"caption":"Sweet Peas Necklace!   ","height":98});
															thumbnails[1235323] = clik.newPhoto({"id":1235323,"src":"IMG_2385_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_1235323.html","width":130,"caption":"A close-up of the sweet peas","height":98});
															thumbnails[1235334] = clik.newPhoto({"id":1235334,"src":"IMG_2426_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_1235334.html","width":130,"caption":"Elegant in Pink!","height":98});
															thumbnails[1235337] = clik.newPhoto({"id":1235337,"src":"IMG_2427_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_1235337.html","width":130,"caption":"The entire necklace","height":98});
															thumbnails[2124653] = clik.newPhoto({"id":2124653,"src":"IMG_3134_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_2124653.html","width":130,"caption":"Pink Floral Necklace","height":106});
															thumbnails[2124654] = clik.newPhoto({"id":2124654,"src":"IMG_3140_2_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_2124654.html","width":130,"caption":"Another view of the bead and findings","height":85});
															thumbnails[2124655] = clik.newPhoto({"id":2124655,"src":"IMG_3140_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_2124655.html","width":130,"caption":"A close-up photo of the bead","height":128});
															thumbnails[3331906] = clik.newPhoto({"id":3331906,"src":"IMG_3537_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_3331906.html","width":130,"caption":"Another view","height":98});
															thumbnails[3331913] = clik.newPhoto({"id":3331913,"src":"IMG_3511_2_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_3331913.html","width":130,"caption":"Sweet Peas","height":120});
															thumbnails[444473] = clik.newPhoto({"id":444473,"src":"IMG_3530_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_444473.html","width":130,"caption":"Foxgloves, a new version","height":98});
															thumbnails[444474] = clik.newPhoto({"id":444474,"src":"foxgloves2_thumb.jpg","galleries_id":33797,"server_id":15,"link":"photo_444474.html","width":130,"caption":"Foxgloves detail","height":98});
															thumbnails[619923] = clik.newPhoto({"id":619923,"src":"silvered-florals-bracelet_thumb.jpg","galleries_id":33799,"server_id":15,"link":"photo_619923.html","width":130,"caption":"Silvered flowers","height":98});
															thumbnails[423031] = clik.newPhoto({"id":423031,"src":"peonies_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_423031.html","width":100,"caption":"Peonies","height":130});
															thumbnails[1235435] = clik.newPhoto({"id":1235435,"src":"IMG_2482a_thumb.jpg","galleries_id":33812,"server_id":15,"link":"photo_1235435.html","width":117,"caption":"Metallics","height":130});
															thumbnails[1235439] = clik.newPhoto({"id":1235439,"src":"IMG_2481a_thumb.jpg","galleries_id":33812,"server_id":15,"link":"photo_1235439.html","width":117,"caption":"Another view of Metallics","height":130});
															thumbnails[2140849] = clik.newPhoto({"id":2140849,"src":"IMG_3181_2_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140849.html","width":97,"caption":"Jellyfish in its Garden","height":130});
															thumbnails[2140851] = clik.newPhoto({"id":2140851,"src":"IMG_3182_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140851.html","width":130,"caption":"Detail of Jellyfish in its Garden","height":130});
															thumbnails[2140854] = clik.newPhoto({"id":2140854,"src":"IMG_3181_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140854.html","width":110,"caption":"Detail of Jellyfish in its Garden","height":130});
															thumbnails[2140891] = clik.newPhoto({"id":2140891,"src":"IMG_3189_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140891.html","width":107,"caption":"Jellyfish Beauty","height":130});
															thumbnails[2140900] = clik.newPhoto({"id":2140900,"src":"IMG_3187_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140900.html","width":130,"caption":"Diving Jelly","height":130});
															thumbnails[2140915] = clik.newPhoto({"id":2140915,"src":"IMG_3185_2_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140915.html","width":126,"caption":"Another blue jelly","height":130});
															thumbnails[2140929] = clik.newPhoto({"id":2140929,"src":"IMG_3168_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140929.html","width":125,"caption":"Jelly in a garden of pink","height":130});
															thumbnails[2140950] = clik.newPhoto({"id":2140950,"src":"IMG_3167_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140950.html","width":102,"caption":"Jelly Deep Down","height":130});
															thumbnails[2140954] = clik.newPhoto({"id":2140954,"src":"IMG_3149_thumb.jpg","galleries_id":142188,"server_id":15,"link":"photo_2140954.html","width":110,"caption":"Sea Plants","height":130});
															thumbnails[3331937] = clik.newPhoto({"id":3331937,"src":"IMG_3563_2_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3331937.html","width":125,"caption":"Bouquet","height":130});
															thumbnails[3331994] = clik.newPhoto({"id":3331994,"src":"IMG_3569_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3331994.html","width":128,"caption":"Roses with tiny bluettes","height":130});
															thumbnails[3332006] = clik.newPhoto({"id":3332006,"src":"IMG_3574_2_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332006.html","width":117,"caption":"Roses and white flowers","height":130});
															thumbnails[3332011] = clik.newPhoto({"id":3332011,"src":"IMG_3574_2_2_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332011.html","width":130,"caption":"Close-up of roses with white flowers","height":106});
															thumbnails[3332047] = clik.newPhoto({"id":3332047,"src":"IMG_3596_2_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332047.html","width":96,"caption":"Roses and Violets","height":130});
															thumbnails[3332067] = clik.newPhoto({"id":3332067,"src":"IMG_3570_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332067.html","width":107,"caption":"White ","height":130});
															thumbnails[3332072] = clik.newPhoto({"id":3332072,"src":"IMG_3603_2_2_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332072.html","width":130,"caption":"A close-up of White","height":110});
															thumbnails[3332110] = clik.newPhoto({"id":3332110,"src":"IMG_3607_3_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332110.html","width":130,"caption":"Roses with Lily of the Valley","height":130});
															thumbnails[3332115] = clik.newPhoto({"id":3332115,"src":"IMG_3607_2_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332115.html","width":130,"caption":"Roses and Lily of the Valley","height":127});
															thumbnails[3332143] = clik.newPhoto({"id":3332143,"src":"IMG_3624_2_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332143.html","width":126,"caption":"Four White Flowers","height":130});
															thumbnails[3332154] = clik.newPhoto({"id":3332154,"src":"IMG_3625_2_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332154.html","width":130,"caption":"detail of Four White Flowers","height":126});
															thumbnails[3332188] = clik.newPhoto({"id":3332188,"src":"IMG_3615_thumb.jpg","galleries_id":58264,"server_id":15,"link":"photo_3332188.html","width":106,"caption":"Yellow Roses and Pink Cascading Flowers","height":130});
															thumbnails[753809] = clik.newPhoto({"id":753809,"src":"IMG_1905_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_753809.html","width":130,"caption":"Voila..Pink flowers!","height":128});
															thumbnails[753808] = clik.newPhoto({"id":753808,"src":"IMG_1889_thumb.jpg","galleries_id":33812,"server_id":15,"link":"photo_753808.html","width":106,"caption":"Heart!","height":130});
															thumbnails[418501] = clik.newPhoto({"id":418501,"src":"shell1_thumb.jpg","galleries_id":33803,"server_id":15,"link":"photo_418501.html","width":114,"caption":"Gold fumed shell","height":130});
															thumbnails[816969] = clik.newPhoto({"id":816969,"src":"IMG_2047_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_816969.html","width":128,"caption":"paperweight floral","height":130});
															thumbnails[444472] = clik.newPhoto({"id":444472,"src":"Shellgoldfumed_thumb.jpg","galleries_id":33803,"server_id":15,"link":"photo_444472.html","width":115,"caption":"Shell, another view","height":130});
															thumbnails[816975] = clik.newPhoto({"id":816975,"src":"IMG_2067_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_816975.html","width":119,"caption":"White floral cane murinni","height":130});
															thumbnails[1796522] = clik.newPhoto({"id":1796522,"src":"IMG_2746_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_1796522.html","width":85,"caption":"NEW FLORALS","height":130});
															thumbnails[1796523] = clik.newPhoto({"id":1796523,"src":"IMG_2747_2_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_1796523.html","width":76,"caption":"DETAIL OF NEW FLORAL","height":130});
															thumbnails[1796525] = clik.newPhoto({"id":1796525,"src":"IMG_2786_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_1796525.html","width":83,"caption":"NEW FLORAL","height":130});
															thumbnails[1796539] = clik.newPhoto({"id":1796539,"src":"IMG_2787_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_1796539.html","width":86,"caption":"NEW FLORAL DETAIL","height":130});
															thumbnails[1796552] = clik.newPhoto({"id":1796552,"src":"IMG_2789_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_1796552.html","width":92,"caption":"EVENING FLORAL","height":130});
															thumbnails[1796565] = clik.newPhoto({"id":1796565,"src":"IMG_2788_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_1796565.html","width":85,"caption":"SOFT MAY BLOOMS","height":130});
															thumbnails[1796584] = clik.newPhoto({"id":1796584,"src":"IMG_2797_thumb.jpg","galleries_id":33801,"server_id":15,"link":"photo_1796584.html","width":72,"caption":"DEEP PINK","height":130});
															thumbnails[423038] = clik.newPhoto({"id":423038,"src":"coral-bells_thumb.jpg","galleries_id":33813,"server_id":15,"link":"photo_423038.html","width":130,"caption":"Coral bells","height":97});
															thumbnails[423058] = clik.newPhoto({"id":423058,"src":"William-studio-dog1_thumb.jpg","galleries_id":33813,"server_id":15,"link":"photo_423058.html","width":112,"caption":"William the Studio Dog","height":130});
															thumbnails[423064] = clik.newPhoto({"id":423064,"src":"IMG_1514_thumb.JPG","galleries_id":33813,"server_id":15,"link":"photo_423064.html","width":130,"caption":"Lovely shapes...olives","height":98});
															thumbnails[423066] = clik.newPhoto({"id":423066,"src":"IMG_1570_thumb.JPG","galleries_id":33813,"server_id":15,"link":"photo_423066.html","width":130,"caption":"Stones","height":117});
															thumbnails[817031] = clik.newPhoto({"id":817031,"src":"IMG_2136_thumb.jpg","galleries_id":33813,"server_id":15,"link":"photo_817031.html","width":101,"caption":"Flowers on the Vine","height":130});
															thumbnails[817062] = clik.newPhoto({"id":817062,"src":"56435-IMG_2145_thumb.jpg","galleries_id":33813,"server_id":15,"link":"photo_817062.html","width":107,"caption":"Tuscan Spring  ","height":130});
															thumbnails[915072] = clik.newPhoto({"id":915072,"src":"IMG_2167_thumb.JPG","galleries_id":33813,"server_id":15,"link":"photo_915072.html","width":107,"caption":"Delicate Flowers","height":130});
															thumbnails[1796602] = clik.newPhoto({"id":1796602,"src":"IMG_2721_thumb.jpg","galleries_id":33814,"server_id":15,"link":"photo_1796602.html","width":92,"caption":"PROTOTYPES","height":130});
															thumbnails[1796609] = clik.newPhoto({"id":1796609,"src":"IMG_2723_thumb.jpg","galleries_id":33814,"server_id":15,"link":"photo_1796609.html","width":85,"caption":"ANOTHER OF THE PROTOTYPES","height":130});
															thumbnails[424492] = clik.newPhoto({"id":424492,"src":"111NewSRAlogo_thumb.jpg","galleries_id":33814,"server_id":15,"link":"photo_424492.html","width":130,"caption":"Member G35","height":69});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[33800] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Earrings","link":"section53925_33800.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"section53925","featured_images":"","id":33800,"singleSection":false});				  						galleries[58264] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"ROSES ROSES ROSES","link":"section53941_58264.html","maxRecords":0.0,"photoIDs":[3331937.0,3331994.0,3332006.0,3332011.0,3332047.0,3332067.0,3332072.0,3332110.0,3332115.0,3332143.0,3332154.0,3332188.0],"skipIndex":0,"section_code":"section53941","featured_images":"3332188,3332154,3332143,3332115,3332110,3332072,3332067,3332047,3332011,3332006","id":58264,"singleSection":false});				  						galleries[142188] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sea Life","link":"section53941_142188.html","maxRecords":0.0,"photoIDs":[2140849.0,2140851.0,2140854.0,2140891.0,2140900.0,2140915.0,2140929.0,2140950.0,2140954.0],"skipIndex":0,"section_code":"section53941","featured_images":"2140954,2140950,2140929,2140915,2140900,2140891,2140854,2140851,2140849","id":142188,"singleSection":false});				  						galleries[33803] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Shells","link":"section53941_33803.html","maxRecords":0.0,"photoIDs":[418501.0,444472.0],"skipIndex":0,"section_code":"section53941","featured_images":"444472,418501","id":33803,"singleSection":false});				  						galleries[33813] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery","link":"section53943.html","maxRecords":0.0,"photoIDs":[423038.0,423058.0,423064.0,423066.0,817031.0,817062.0,915072.0],"skipIndex":0,"section_code":"section53943","featured_images":"915072,817062,817031,423066,423064,423058,423038","id":33813,"singleSection":true});				  						galleries[33797] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Necklaces","link":"section53925_33797.html","maxRecords":0.0,"photoIDs":[1235255.0,1235323.0,1235334.0,1235337.0,2124653.0,2124654.0,2124655.0,3331906.0,3331913.0,444473.0,444474.0],"skipIndex":0,"section_code":"section53925","featured_images":"3331913,3331906,2124655,2124654,2124653,1235337,1235334,1235323,1235255,444474","id":33797,"singleSection":false});				  						galleries[33799] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Bracelets","link":"section53925_33799.html","maxRecords":0.0,"photoIDs":[619923.0],"skipIndex":0,"section_code":"section53925","featured_images":619923.0,"id":33799,"singleSection":false});				  						galleries[33801] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Florals","link":"section53941_33801.html","maxRecords":0.0,"photoIDs":[423031.0,753809.0,816969.0,816975.0,1796522.0,1796523.0,1796525.0,1796539.0,1796552.0,1796565.0,1796584.0],"skipIndex":0,"section_code":"section53941","featured_images":423031.0,"id":33801,"singleSection":false});				  						galleries[33812] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Organics","link":"section53941_33812.html","maxRecords":0.0,"photoIDs":[1235435.0,1235439.0,753808.0],"skipIndex":0,"section_code":"section53941","featured_images":"1235439,1235435,753808","id":33812,"singleSection":false});				  						galleries[33814] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Bead sets","link":"section53946.html","maxRecords":0.0,"photoIDs":[1796602.0,1796609.0,424492.0],"skipIndex":0,"section_code":"section53946","featured_images":"1796609,1796602,424492","id":33814,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '418460';
imageSets[2] = '423031';
imageSets[3] = '3332188,3332154,3332143,3332115,3332110,3332072,3332067,3332047,3332011,3332006,3331994,3331937,3331913,3331906,2140954,2140950,2140929,2140915,2140900,2140891,2140854,2140851,2140849,2124655,2124654,2124653,1796609,1796602,1796584,1796565,1796552,1796539,1796525,1796523,1796522,1235439,1235435,1235337,1235334,1235323,1235255,915072,817062,817031,816975,816969,753809,753808,619923,444474';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/pennyg/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/pennyg/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/pennyg/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/pennyg/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/pennyg/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/pennyg/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/pennyg/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 += 'section53925.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 && 'section53925' != '') {
					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 = 'Penny Gentle Art Glass: ' + 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> $' + (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="pennygentle@hotmail.com">';
					temp += '<input type="hidden" name="currency_code" value="USD">';
					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="pennygentle@hotmail.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;
	}
}

			

