window.thumbnails = {};
															thumbnails[7515506] = clik.newPhoto({"id":7515506,"src":"2roundedspoons_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[7515535] = clik.newPhoto({"id":7515535,"src":"3spoonswithfork_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[7515541] = clik.newPhoto({"id":7515541,"src":"4silverspoons_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[7515544] = clik.newPhoto({"id":7515544,"src":"4teaspoons_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[7515552] = clik.newPhoto({"id":7515552,"src":"blueconverse_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5491593] = clik.newPhoto({"id":5491593,"src":"3spoons1_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[6488753] = clik.newPhoto({"id":6488753,"src":"spoons2_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4311222] = clik.newPhoto({"id":4311222,"src":"scissors-string2_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5941768] = clik.newPhoto({"id":5941768,"src":"keyandfeathertwo_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[7515566] = clik.newPhoto({"id":7515566,"src":"tableware_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4815939] = clik.newPhoto({"id":4815939,"src":"scissorspaperstone_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3944040] = clik.newPhoto({"id":3944040,"src":"Danshoesweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5491567] = clik.newPhoto({"id":5491567,"src":"snowdrops1_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5706277] = clik.newPhoto({"id":5706277,"src":"blacktippedfeathers_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4679821] = clik.newPhoto({"id":4679821,"src":"feather5_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5837624] = clik.newPhoto({"id":5837624,"src":"4spoons5_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[6480400] = clik.newPhoto({"id":6480400,"src":"twosaltspoons_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5491452] = clik.newPhoto({"id":5491452,"src":"6keys_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5491591] = clik.newPhoto({"id":5491591,"src":"2squash1_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5592663] = clik.newPhoto({"id":5592663,"src":"teaspoonsfeather_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3944045] = clik.newPhoto({"id":3944045,"src":"jimshoesweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[7547969] = clik.newPhoto({"id":7547969,"src":"jennywren3_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3944036] = clik.newPhoto({"id":3944036,"src":"babyshoesweb1_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3948498] = clik.newPhoto({"id":3948498,"src":"6chillisweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[6488813] = clik.newPhoto({"id":6488813,"src":"spoonsmonogram1_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3948545] = clik.newPhoto({"id":3948545,"src":"strawbweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3948501] = clik.newPhoto({"id":3948501,"src":"asparagusweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3992259] = clik.newPhoto({"id":3992259,"src":"flagiris_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[5837627] = clik.newPhoto({"id":5837627,"src":"converseblk2_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4808808] = clik.newPhoto({"id":4808808,"src":"redsilkpurse_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3948533] = clik.newPhoto({"id":3948533,"src":"pakchoiweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3948548] = clik.newPhoto({"id":3948548,"src":"urchinweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3948495] = clik.newPhoto({"id":3948495,"src":"3chillisweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[4311233] = clik.newPhoto({"id":4311233,"src":"ripe-strawberry21_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3948510] = clik.newPhoto({"id":3948510,"src":"creamtulipweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3948506] = clik.newPhoto({"id":3948506,"src":"broadbeansweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3944048] = clik.newPhoto({"id":3944048,"src":"redshoesweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[3944042] = clik.newPhoto({"id":3944042,"src":"grnsandalsweb_thumb.gif","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":130});
															thumbnails[6488748] = clik.newPhoto({"id":6488748,"src":"spoonswithreflection_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_6488748.html","width":130,"caption":"","height":130});
															thumbnails[8976866] = clik.newPhoto({"id":8976866,"src":"kniveswithstring_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_8976866.html","width":130,"caption":"","height":130});
															thumbnails[4808780] = clik.newPhoto({"id":4808780,"src":"3keys_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_4808780.html","width":130,"caption":"","height":130});
															thumbnails[8976873] = clik.newPhoto({"id":8976873,"src":"smallsouvenirs_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_8976873.html","width":130,"caption":"","height":130});
															thumbnails[7550453] = clik.newPhoto({"id":7550453,"src":"2dessertspoons1_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_7550453.html","width":130,"caption":"","height":130});
															thumbnails[6480476] = clik.newPhoto({"id":6480476,"src":"twospoons_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_6480476.html","width":130,"caption":"","height":130});
															thumbnails[7515584] = clik.newPhoto({"id":7515584,"src":"settingfor1_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_7515584.html","width":130,"caption":"","height":130});
															thumbnails[6480526] = clik.newPhoto({"id":6480526,"src":"keys_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_6480526.html","width":130,"caption":"","height":130});
															thumbnails[8976860] = clik.newPhoto({"id":8976860,"src":"5spoonsarranged_thumb.gif","galleries_id":239330,"server_id":1,"link":"photo_8976860.html","width":130,"caption":"","height":130});
															thumbnails[5941762] = clik.newPhoto({"id":5941762,"src":"eggandsilk_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_5941762.html","width":130,"caption":"","height":130});
															thumbnails[5941764] = clik.newPhoto({"id":5941764,"src":"coastfragments3_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_5941764.html","width":130,"caption":"","height":130});
															thumbnails[7548277] = clik.newPhoto({"id":7548277,"src":"eggandspoon_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_7548277.html","width":130,"caption":"","height":130});
															thumbnails[7515557] = clik.newPhoto({"id":7515557,"src":"letterwithmothandspoon_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_7515557.html","width":130,"caption":"","height":130});
															thumbnails[6480354] = clik.newPhoto({"id":6480354,"src":"fragmentskilcregganbeach_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_6480354.html","width":130,"caption":"","height":130});
															thumbnails[7515554] = clik.newPhoto({"id":7515554,"src":"letterwithmothandkey_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_7515554.html","width":130,"caption":"","height":130});
															thumbnails[6488750] = clik.newPhoto({"id":6488750,"src":"musselswiththorn1_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_6488750.html","width":130,"caption":"","height":130});
															thumbnails[5491602] = clik.newPhoto({"id":5491602,"src":"snowberries3_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_5491602.html","width":130,"caption":"","height":130});
															thumbnails[5701328] = clik.newPhoto({"id":5701328,"src":"springclutch_thumb.gif","galleries_id":250207,"server_id":1,"link":"photo_5701328.html","width":130,"caption":"","height":130});
															thumbnails[5837621] = clik.newPhoto({"id":5837621,"src":"babette3_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_5837621.html","width":130,"caption":"","height":130});
															thumbnails[5590213] = clik.newPhoto({"id":5590213,"src":"shinyblackshoes_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_5590213.html","width":130,"caption":"","height":130});
															thumbnails[7547960] = clik.newPhoto({"id":7547960,"src":"starlightroom_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_7547960.html","width":130,"caption":"","height":130});
															thumbnails[3944051] = clik.newPhoto({"id":3944051,"src":"willshoesweb_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_3944051.html","width":130,"caption":"","height":130});
															thumbnails[4158097] = clik.newPhoto({"id":4158097,"src":"redsandalsweb_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_4158097.html","width":130,"caption":"","height":130});
															thumbnails[6480498] = clik.newPhoto({"id":6480498,"src":"finnsconverse_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_6480498.html","width":130,"caption":"","height":130});
															thumbnails[4070956] = clik.newPhoto({"id":4070956,"src":"balletpumps_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_4070956.html","width":130,"caption":"","height":130});
															thumbnails[8976879] = clik.newPhoto({"id":8976879,"src":"paulsshoes_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_8976879.html","width":130,"caption":"","height":130});
															thumbnails[3944038] = clik.newPhoto({"id":3944038,"src":"balletshoesweb_thumb.gif","galleries_id":239166,"server_id":1,"link":"photo_3944038.html","width":130,"caption":"","height":130});
															thumbnails[7515630] = clik.newPhoto({"id":7515630,"src":"spoonpinksilkkey_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_7515630.html","width":130,"caption":"","height":130});
															thumbnails[4311160] = clik.newPhoto({"id":4311160,"src":"brushes2_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_4311160.html","width":130,"caption":"","height":130});
															thumbnails[5590124] = clik.newPhoto({"id":5590124,"src":"RR-letters_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_5590124.html","width":130,"caption":"","height":130});
															thumbnails[5491581] = clik.newPhoto({"id":5491581,"src":"memobook_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_5491581.html","width":130,"caption":"","height":130});
															thumbnails[8976891] = clik.newPhoto({"id":8976891,"src":"whatislove_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_8976891.html","width":130,"caption":"","height":130});
															thumbnails[4913935] = clik.newPhoto({"id":4913935,"src":"keyfeather_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_4913935.html","width":130,"caption":"","height":130});
															thumbnails[5491590] = clik.newPhoto({"id":5491590,"src":"gift3_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_5491590.html","width":130,"caption":"","height":130});
															thumbnails[4913939] = clik.newPhoto({"id":4913939,"src":"stringbrush_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_4913939.html","width":130,"caption":"","height":130});
															thumbnails[7515579] = clik.newPhoto({"id":7515579,"src":"quailseggcaddyspoon_thumb.gif","galleries_id":310836,"server_id":1,"link":"photo_7515579.html","width":130,"caption":"","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[239330] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"used","link":"gallery_239330.html","maxRecords":0.0,"photoIDs":[6488748.0,8976866.0,4808780.0,8976873.0,7550453.0,6480476.0,7515584.0,6480526.0,8976860.0],"skipIndex":0,"section_code":"gallery","featured_images":"8976866,7550453,6488748,6480526,6480476,4808780","id":239330,"singleSection":false});				  						galleries[250207] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"found","link":"gallery_250207.html","maxRecords":0.0,"photoIDs":[5941762.0,5941764.0,7548277.0,7515557.0,6480354.0,7515554.0,6488750.0,5491602.0,5701328.0],"skipIndex":0,"section_code":"gallery","featured_images":"7548277,7515557,7515554,6488750,6480354,5941762,5701328,5491602","id":250207,"singleSection":false});				  						galleries[239166] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"worn","link":"gallery_239166.html","maxRecords":0.0,"photoIDs":[5837621.0,5590213.0,7547960.0,3944051.0,4158097.0,6480498.0,4070956.0,8976879.0,3944038.0],"skipIndex":0,"section_code":"gallery","featured_images":"8976879,7547960,6480498,5837621,5590213,3944051,3944038","id":239166,"singleSection":false});				  						galleries[310836] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"significant","link":"gallery_310836.html","maxRecords":0.0,"photoIDs":[7515630.0,4311160.0,5590124.0,5491581.0,8976891.0,4913935.0,5491590.0,4913939.0,7515579.0],"skipIndex":0,"section_code":"gallery","featured_images":"7515630,7515579,5590124,5491581,4913939,4913935,4311160","id":310836,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6488748,8976866,4808780,7550453,6480476,5941762,7515557,6480354,7515554,5491602,5701328,5837621,5590213,7547960,3944051,3944038,4311160,5590124,5491581,4913935,7515579,7515506,7515541,6488753,7515566';
imageSets[2] = '6488748,8976866,4808780,7550453,6480476,6480526,5941762,7548277,7515557,6480354,7515554,6488750,5491602,5701328,5837621,5590213,7547960,3944051,6480498,8976879,3944038,7515630,4311160,5590124,5491581,4913935,4913939,7515579,7515506,7515535,7515544,7515552,6488753,7515566,4815939,5592663,6488813,4311233,3948510';
imageSets[3] = '8976891,8976879,8976873,8976866,8976860,7550453,7548277,7547969,7547960,7515630,7515584,7515579,7515566,7515557,7515554,7515552,7515544,7515541,7515535,7515506,6488813,6488753,6488750,6488748,6480526,6480498,6480476,6480400,6480354,5941768,5941764,5941762,5837627,5837624,5837621,5706277,5701328,5592663,5590213,5590124,5491602,5491593,5491591,5491590,5491581,5491567,5491452,4913939,4913935,4815939';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rachelross/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rachelross/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rachelross/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rachelross/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/rachelross/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/rachelross/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rachelross/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/rachelross/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 = 'Rachel Ross - Paintings: ' + 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;
	}
}

			

