window.thumbnails = {};
															thumbnails[3001577] = clik.newPhoto({"id":3001577,"src":"Jane_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":130,"caption":"","height":195});
															thumbnails[2796971] = clik.newPhoto({"id":2796971,"src":"And the Mist Engulfed_thumb.jpg","galleries_id":174168,"server_id":5,"link":"photo_2796971.html","width":100,"caption":"","height":100});
															thumbnails[2796987] = clik.newPhoto({"id":2796987,"src":"Intertwining Geometries_thumb.jpg","galleries_id":174168,"server_id":5,"link":"photo_2796987.html","width":100,"caption":"","height":100});
															thumbnails[2796993] = clik.newPhoto({"id":2796993,"src":"On the Road to Menara_thumb.jpg","galleries_id":174168,"server_id":5,"link":"photo_2796993.html","width":100,"caption":"","height":100});
															thumbnails[2796994] = clik.newPhoto({"id":2796994,"src":"Paraty Drinks at Six_thumb.jpg","galleries_id":174167,"server_id":5,"link":"photo_2796994.html","width":100,"caption":"","height":100});
															thumbnails[2796998] = clik.newPhoto({"id":2796998,"src":"Paraty Dusk_thumb.jpg","galleries_id":174167,"server_id":5,"link":"photo_2796998.html","width":100,"caption":"","height":100});
															thumbnails[2796999] = clik.newPhoto({"id":2796999,"src":"Paraty Fishing Nets_thumb.jpg","galleries_id":174167,"server_id":5,"link":"photo_2796999.html","width":100,"caption":"","height":100});
															thumbnails[2797000] = clik.newPhoto({"id":2797000,"src":"Paraty Nudity_thumb.jpg","galleries_id":174167,"server_id":5,"link":"photo_2797000.html","width":100,"caption":"","height":100});
															thumbnails[2797005] = clik.newPhoto({"id":2797005,"src":"Paraty Palm Hearts_thumb.jpg","galleries_id":174167,"server_id":5,"link":"photo_2797005.html","width":100,"caption":"","height":100});
															thumbnails[2797011] = clik.newPhoto({"id":2797011,"src":"Paraty Red Skies_thumb.jpg","galleries_id":174167,"server_id":5,"link":"photo_2797011.html","width":100,"caption":"","height":100});
															thumbnails[2797012] = clik.newPhoto({"id":2797012,"src":"Paraty Sunshine After Rain_thumb.jpg","galleries_id":174167,"server_id":5,"link":"photo_2797012.html","width":100,"caption":"","height":100});
															thumbnails[2797014] = clik.newPhoto({"id":2797014,"src":"Paraty the Green Door_thumb.jpg","galleries_id":174167,"server_id":5,"link":"photo_2797014.html","width":100,"caption":"","height":100});
															thumbnails[2797015] = clik.newPhoto({"id":2797015,"src":"Ramadan Dates_thumb.jpg","galleries_id":174168,"server_id":5,"link":"photo_2797015.html","width":100,"caption":"","height":100});
															thumbnails[2797019] = clik.newPhoto({"id":2797019,"src":"Shifting Sands_thumb.jpg","galleries_id":174168,"server_id":5,"link":"photo_2797019.html","width":100,"caption":"","height":100});
															thumbnails[2797021] = clik.newPhoto({"id":2797021,"src":"The Shimmering Red City_thumb.jpg","galleries_id":174168,"server_id":5,"link":"photo_2797021.html","width":100,"caption":"","height":100});
															thumbnails[2797023] = clik.newPhoto({"id":2797023,"src":"Treasures in the Night_thumb.jpg","galleries_id":174168,"server_id":5,"link":"photo_2797023.html","width":100,"caption":"","height":100});
															thumbnails[3229721] = clik.newPhoto({"id":3229721,"src":"Peel away the Enigma_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3229721.html","width":100,"caption":"","height":100});
															thumbnails[3229787] = clik.newPhoto({"id":3229787,"src":"Take the Bullet_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3229787.html","width":100,"caption":"","height":100});
															thumbnails[3229788] = clik.newPhoto({"id":3229788,"src":"The Fish Market_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3229788.html","width":100,"caption":"","height":100});
															thumbnails[3229789] = clik.newPhoto({"id":3229789,"src":"The Tea House_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3229789.html","width":100,"caption":"","height":100});
															thumbnails[3229790] = clik.newPhoto({"id":3229790,"src":"Tokyo Joey_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3229790.html","width":100,"caption":"","height":100});
															thumbnails[3767041] = clik.newPhoto({"id":3767041,"src":"benign_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767041.html","width":100,"caption":"","height":100});
															thumbnails[3767059] = clik.newPhoto({"id":3767059,"src":"bludgeon_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767059.html","width":100,"caption":"","height":100});
															thumbnails[3767063] = clik.newPhoto({"id":3767063,"src":"clouded_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767063.html","width":100,"caption":"","height":100});
															thumbnails[3767089] = clik.newPhoto({"id":3767089,"src":"constrained_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767089.html","width":100,"caption":"","height":100});
															thumbnails[3767098] = clik.newPhoto({"id":3767098,"src":"curious_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767098.html","width":100,"caption":"","height":100});
															thumbnails[3767099] = clik.newPhoto({"id":3767099,"src":"divisive_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767099.html","width":100,"caption":"","height":100});
															thumbnails[3767114] = clik.newPhoto({"id":3767114,"src":"inever_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767114.html","width":100,"caption":"","height":100});
															thumbnails[3767115] = clik.newPhoto({"id":3767115,"src":"ifthe_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767115.html","width":100,"caption":"","height":100});
															thumbnails[3767117] = clik.newPhoto({"id":3767117,"src":"kyotos_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767117.html","width":100,"caption":"","height":101});
															thumbnails[3767119] = clik.newPhoto({"id":3767119,"src":"notall_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767119.html","width":100,"caption":"","height":100});
															thumbnails[3767120] = clik.newPhoto({"id":3767120,"src":"pharmaceutical_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767120.html","width":100,"caption":"","height":100});
															thumbnails[3767122] = clik.newPhoto({"id":3767122,"src":"please_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767122.html","width":100,"caption":"","height":100});
															thumbnails[3767124] = clik.newPhoto({"id":3767124,"src":"shackle_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767124.html","width":100,"caption":"","height":100});
															thumbnails[3767127] = clik.newPhoto({"id":3767127,"src":"where_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_3767127.html","width":100,"caption":"","height":100});
															thumbnails[4098769] = clik.newPhoto({"id":4098769,"src":"Im_not_sure_about_that_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_4098769.html","width":100,"caption":"","height":100});
															thumbnails[4098775] = clik.newPhoto({"id":4098775,"src":"The_Inconvenient_Truth_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_4098775.html","width":100,"caption":"","height":100});
															thumbnails[4098779] = clik.newPhoto({"id":4098779,"src":"I_like_the_cut_of_your_Giblets_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_4098779.html","width":100,"caption":"","height":100});
															thumbnails[4098780] = clik.newPhoto({"id":4098780,"src":"Its_all_a_bit_overwhelming_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_4098780.html","width":100,"caption":"","height":100});
															thumbnails[4098782] = clik.newPhoto({"id":4098782,"src":"It_was_a_near_miss_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_4098782.html","width":100,"caption":"","height":100});
															thumbnails[4098785] = clik.newPhoto({"id":4098785,"src":"All_at_Odds_and_ends_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_4098785.html","width":100,"caption":"","height":100});
															thumbnails[4098814] = clik.newPhoto({"id":4098814,"src":"Where_do_we_go_from_here_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_4098814.html","width":100,"caption":"","height":100});
															thumbnails[4098816] = clik.newPhoto({"id":4098816,"src":"Its_all_about_the_Process_thumb.jpg","galleries_id":229631,"server_id":5,"link":"photo_4098816.html","width":100,"caption":"","height":100});
															thumbnails[8946193] = clik.newPhoto({"id":8946193,"src":"Progressive_Undercurrents_3A8DC395-1EC9-DFB6-090DE3CD6C763254_thumb.jpg","galleries_id":470908,"server_id":5,"link":"photo_8946193.html","width":100,"caption":"","height":100});
															thumbnails[8946197] = clik.newPhoto({"id":8946197,"src":"Where_Solitude_is_not_an_Option_3A9262CD-1EC9-DFB6-09FAC828CC524C8F_thumb.jpg","galleries_id":470908,"server_id":5,"link":"photo_8946197.html","width":100,"caption":"","height":100});
															thumbnails[8946198] = clik.newPhoto({"id":8946198,"src":"The_Bloodied_Pavements_3A971FC8-1EC9-DFB6-09F1318124221788_thumb.jpg","galleries_id":470907,"server_id":5,"link":"photo_8946198.html","width":100,"caption":"","height":100});
															thumbnails[8946203] = clik.newPhoto({"id":8946203,"src":"This_Disaffected_Breed_of_Men_3A9B1F4D-1EC9-DFB6-09362A51C7A29046_thumb.jpg","galleries_id":470907,"server_id":5,"link":"photo_8946203.html","width":100,"caption":"","height":100});
															thumbnails[8963454] = clik.newPhoto({"id":8963454,"src":"Friend_or_Faux_Pas_3A5B4CC8-1EC9-DFB6-0923154CF926F155_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963454.html","width":100,"caption":"","height":100});
															thumbnails[8963455] = clik.newPhoto({"id":8963455,"src":"Pergatory_Chasm_3A636143-1EC9-DFB6-092C77672194DC32_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963455.html","width":100,"caption":"","height":100});
															thumbnails[8963456] = clik.newPhoto({"id":8963456,"src":"Perpetrators_of_Mass_Consumption_3A682770-1EC9-DFB6-0997CEFFC2229FC0_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963456.html","width":100,"caption":"","height":100});
															thumbnails[8963457] = clik.newPhoto({"id":8963457,"src":"Stealing_Light_from_the_Third_World_3A715566-1EC9-DFB6-09D5EAB563B8B74E_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963457.html","width":100,"caption":"","height":100});
															thumbnails[8963458] = clik.newPhoto({"id":8963458,"src":"The_Fatties_of_the_Land_3A76B5C1-1EC9-DFB6-09BAE88C8E1ED07C_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963458.html","width":100,"caption":"","height":100});
															thumbnails[8963459] = clik.newPhoto({"id":8963459,"src":"Tighten_your_Commuter_Belt_3A7AC3BE-1EC9-DFB6-09A97E7051880FC8_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963459.html","width":100,"caption":"","height":100});
															thumbnails[8963460] = clik.newPhoto({"id":8963460,"src":"What_would_Cartman_do_3A7F24BF-1EC9-DFB6-095639CE84A95BB1_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963460.html","width":100,"caption":"","height":100});
															thumbnails[8963461] = clik.newPhoto({"id":8963461,"src":"Where_You_Bin_3A84BADF-1EC9-DFB6-09A14F82B75E49A0_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963461.html","width":100,"caption":"","height":100});
															thumbnails[8963462] = clik.newPhoto({"id":8963462,"src":"Wheres_North_from_ere_3AA04053-1EC9-DFB6-09FC89D54DB34609_thumb.jpg","galleries_id":470907,"server_id":5,"link":"photo_8963462.html","width":100,"caption":"","height":100});
															thumbnails[8963463] = clik.newPhoto({"id":8963463,"src":"This_Septic_Isle_3AA55D1B-1EC9-DFB6-099C95B909821D0B_thumb.jpg","galleries_id":470907,"server_id":5,"link":"photo_8963463.html","width":100,"caption":"","height":100});
															thumbnails[8963464] = clik.newPhoto({"id":8963464,"src":"In_the_Slipstream_of_and_Alien_Nation_3A8879C5-1EC9-DFB6-09C4C8E96BA22CAE_thumb.jpg","galleries_id":470909,"server_id":5,"link":"photo_8963464.html","width":100,"caption":"","height":100});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[470909] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"America","link":"gallery_470909.html","maxRecords":0.0,"photoIDs":[8963454.0,8963455.0,8963456.0,8963457.0,8963458.0,8963459.0,8963460.0,8963461.0,8963464.0],"skipIndex":0,"section_code":"gallery","featured_images":"8963464,8963461,8963460,8963459,8963458,8963457,8963456,8963455,8963454","id":470909,"singleSection":false});				  						galleries[470908] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"India","link":"gallery_470908.html","maxRecords":0.0,"photoIDs":[8946193.0,8946197.0],"skipIndex":0,"section_code":"gallery","featured_images":"8946197,8946193","id":470908,"singleSection":false});				  						galleries[470907] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"New Stuff","link":"gallery_470907.html","maxRecords":0.0,"photoIDs":[8946198.0,8946203.0,8963462.0,8963463.0],"skipIndex":0,"section_code":"gallery","featured_images":"8963463,8963462,8946203,8946198","id":470907,"singleSection":false});				  						galleries[174167] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Brazil","link":"gallery_174167.html","maxRecords":0.0,"photoIDs":[2796994.0,2796998.0,2796999.0,2797000.0,2797005.0,2797011.0,2797012.0,2797014.0],"skipIndex":0,"section_code":"gallery","featured_images":"2797014,2797012,2797011,2797005,2797000,2796999,2796998,2796994","id":174167,"singleSection":false});				  						galleries[174168] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Morocco","link":"gallery_174168.html","maxRecords":0.0,"photoIDs":[2796971.0,2796987.0,2796993.0,2797015.0,2797019.0,2797021.0,2797023.0],"skipIndex":0,"section_code":"gallery","featured_images":"2797023,2797021,2797019,2797015,2796993,2796987,2796971","id":174168,"singleSection":false});				  						galleries[229631] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Japan","link":"gallery_229631.html","maxRecords":0.0,"photoIDs":[3229721.0,3229787.0,3229788.0,3229789.0,3229790.0,3767041.0,3767059.0,3767063.0,3767089.0,3767098.0,3767099.0,3767114.0,3767115.0,3767117.0,3767119.0,3767120.0,3767122.0,3767124.0,3767127.0,4098769.0,4098775.0,4098779.0,4098780.0,4098782.0,4098785.0,4098814.0,4098816.0],"skipIndex":0,"section_code":"gallery","featured_images":"4098816,4098814,4098785,4098782,4098780,4098779,4098775,4098769,3767127,3767124","id":229631,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8963464,8963463,8963462,8963461,8963460,8963459,8963458,8963457,8963456,8963455,8963454,8946203,8946198,8946197,8946193,4098816,4098814,4098785,4098782,4098780,4098779,4098775,4098769,3767127,3767124,3767122,3767120,3767119,3767117,3767115,3767114,3767099,3767098,3767089,3767063,3767059,3767041,3229790,3229789,3229788,3229787,3229721,3001577,2797023,2797021,2797019,2797015,2797014,2797012,2797011';
imageSets[3] = '8963464,8963463,8963462,8963461,8963460,8963459,8963458,8963457,8963456,8963455,8963454,8946203,8946198,8946197,8946193,4098816,4098814,4098785,4098782,4098780,4098779,4098775,4098769,3767127,3767124,3767122,3767120,3767119,3767117,3767115,3767114,3767099,3767098,3767089,3767063,3767059,3767041,3229790,3229789,3229788,3229787,3229721,3001577,2797023,2797021,2797019,2797015,2797014,2797012,2797011';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/janeprice/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/janeprice/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/janeprice/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/janeprice/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/janeprice/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/janeprice/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/janeprice/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/janeprice/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'www.janeprice.org: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

