window.thumbnails = {};
															thumbnails[8682751] = clik.newPhoto({"id":8682751,"src":"dreamboats_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_8682751.html","width":121,"caption":"","height":150});
															thumbnails[8078242] = clik.newPhoto({"id":8078242,"src":"yes_prime_minister_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_8078242.html","width":121,"caption":"","height":150});
															thumbnails[5478076] = clik.newPhoto({"id":5478076,"src":"amanda-9_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478076.html","width":121,"caption":"","height":150});
															thumbnails[3702563] = clik.newPhoto({"id":3702563,"src":"new_main1_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3702563.html","width":121,"caption":"","height":150});
															thumbnails[3651046] = clik.newPhoto({"id":3651046,"src":"gloria-group_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651046.html","width":130,"caption":"","height":105});
															thumbnails[3651052] = clik.newPhoto({"id":3651052,"src":"lindyhop_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651052.html","width":130,"caption":"","height":105});
															thumbnails[5478080] = clik.newPhoto({"id":5478080,"src":"amanda-10_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478080.html","width":121,"caption":"","height":150});
															thumbnails[5478144] = clik.newPhoto({"id":5478144,"src":"amanda-3_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478144.html","width":121,"caption":"","height":150});
															thumbnails[3651064] = clik.newPhoto({"id":3651064,"src":"ruby-and-della_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651064.html","width":130,"caption":"","height":105});
															thumbnails[3489070] = clik.newPhoto({"id":3489070,"src":"concept1_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3489070.html","width":121,"caption":"","height":150});
															thumbnails[5478177] = clik.newPhoto({"id":5478177,"src":"amanda-11_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478177.html","width":121,"caption":"","height":150});
															thumbnails[3651070] = clik.newPhoto({"id":3651070,"src":"mario-and-harry_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651070.html","width":130,"caption":"","height":105});
															thumbnails[5478083] = clik.newPhoto({"id":5478083,"src":"amanda-1_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478083.html","width":121,"caption":"","height":150});
															thumbnails[3651078] = clik.newPhoto({"id":3651078,"src":"robert_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651078.html","width":121,"caption":"","height":150});
															thumbnails[5478085] = clik.newPhoto({"id":5478085,"src":"amanda-7_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478085.html","width":121,"caption":"","height":150});
															thumbnails[3651090] = clik.newPhoto({"id":3651090,"src":"vern-and-myrtle_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651090.html","width":130,"caption":"","height":105});
															thumbnails[5478088] = clik.newPhoto({"id":5478088,"src":"amanda-8_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478088.html","width":121,"caption":"","height":150});
															thumbnails[5478136] = clik.newPhoto({"id":5478136,"src":"amanda-14_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478136.html","width":121,"caption":"","height":150});
															thumbnails[5478137] = clik.newPhoto({"id":5478137,"src":"amanda-13_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478137.html","width":121,"caption":"","height":150});
															thumbnails[3651191] = clik.newPhoto({"id":3651191,"src":"shirl_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651191.html","width":130,"caption":"","height":105});
															thumbnails[5478128] = clik.newPhoto({"id":5478128,"src":"amanda-12_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478128.html","width":121,"caption":"","height":150});
															thumbnails[5478158] = clik.newPhoto({"id":5478158,"src":"amanda-6_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478158.html","width":130,"caption":"","height":105});
															thumbnails[5478151] = clik.newPhoto({"id":5478151,"src":"amanda-2_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478151.html","width":130,"caption":"","height":105});
															thumbnails[3651216] = clik.newPhoto({"id":3651216,"src":"rob_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651216.html","width":130,"caption":"","height":105});
															thumbnails[5478157] = clik.newPhoto({"id":5478157,"src":"amanda-5_thumb.jpg","galleries_id":309977,"server_id":15,"link":"photo_5478157.html","width":130,"caption":"","height":105});
															thumbnails[3651221] = clik.newPhoto({"id":3651221,"src":"star_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651221.html","width":130,"caption":"","height":105});
															thumbnails[3739495] = clik.newPhoto({"id":3739495,"src":"show2_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3739495.html","width":130,"caption":"","height":105});
															thumbnails[3739523] = clik.newPhoto({"id":3739523,"src":"show3_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3739523.html","width":130,"caption":"","height":105});
															thumbnails[3651230] = clik.newPhoto({"id":3651230,"src":"mario-and-bella_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651230.html","width":121,"caption":"","height":150});
															thumbnails[3739525] = clik.newPhoto({"id":3739525,"src":"show4_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3739525.html","width":121,"caption":"","height":150});
															thumbnails[8078223] = clik.newPhoto({"id":8078223,"src":"bishop_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_8078223.html","width":121,"caption":"","height":150});
															thumbnails[3651235] = clik.newPhoto({"id":3651235,"src":"ruby_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651235.html","width":130,"caption":"","height":105});
															thumbnails[4111440] = clik.newPhoto({"id":4111440,"src":"midsummer_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_4111440.html","width":121,"caption":"","height":150});
															thumbnails[3651251] = clik.newPhoto({"id":3651251,"src":"dreamscene_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651251.html","width":130,"caption":"","height":105});
															thumbnails[3651255] = clik.newPhoto({"id":3651255,"src":"slow-derby_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3651255.html","width":130,"caption":"","height":105});
															thumbnails[3489529] = clik.newPhoto({"id":3489529,"src":"vixen1_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3489529.html","width":121,"caption":"","height":150});
															thumbnails[3489589] = clik.newPhoto({"id":3489589,"src":"fox1_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3489589.html","width":121,"caption":"","height":150});
															thumbnails[3489598] = clik.newPhoto({"id":3489598,"src":"badger2_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3489598.html","width":121,"caption":"","height":150});
															thumbnails[3739447] = clik.newPhoto({"id":3739447,"src":"show_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3739447.html","width":130,"caption":"","height":105});
															thumbnails[4111086] = clik.newPhoto({"id":4111086,"src":"magpie2_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_4111086.html","width":121,"caption":"","height":150});
															thumbnails[3489622] = clik.newPhoto({"id":3489622,"src":"sea_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3489622.html","width":121,"caption":"","height":150});
															thumbnails[3739855] = clik.newPhoto({"id":3739855,"src":"show7_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3739855.html","width":130,"caption":"","height":105});
															thumbnails[3489637] = clik.newPhoto({"id":3489637,"src":"owl2_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3489637.html","width":121,"caption":"","height":150});
															thumbnails[3739860] = clik.newPhoto({"id":3739860,"src":"show8_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_3739860.html","width":130,"caption":"","height":105});
															thumbnails[3489669] = clik.newPhoto({"id":3489669,"src":"wife2_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_3489669.html","width":121,"caption":"","height":150});
															thumbnails[5439238] = clik.newPhoto({"id":5439238,"src":"mfl-eliza-pink_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_5439238.html","width":130,"caption":"","height":105});
															thumbnails[5439227] = clik.newPhoto({"id":5439227,"src":"mfl-im-getting-married-2_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_5439227.html","width":130,"caption":"","height":105});
															thumbnails[5439231] = clik.newPhoto({"id":5439231,"src":"mfl-im-getting-married_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_5439231.html","width":130,"caption":"","height":105});
															thumbnails[5439226] = clik.newPhoto({"id":5439226,"src":"mfl-ascot-2_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_5439226.html","width":130,"caption":"","height":105});
															thumbnails[5439239] = clik.newPhoto({"id":5439239,"src":"mfl-ascot_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_5439239.html","width":130,"caption":"","height":105});
															thumbnails[5439500] = clik.newPhoto({"id":5439500,"src":"mfl-ascot-hat_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_5439500.html","width":121,"caption":"","height":150});
															thumbnails[5439540] = clik.newPhoto({"id":5439540,"src":"mfl-sian--phil_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_5439540.html","width":121,"caption":"","height":150});
															thumbnails[5439579] = clik.newPhoto({"id":5439579,"src":"mfl-eliza-peach_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_5439579.html","width":121,"caption":"","height":150});
															thumbnails[6704699] = clik.newPhoto({"id":6704699,"src":"Cecil_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704699.html","width":121,"caption":"","height":150});
															thumbnails[6704777] = clik.newPhoto({"id":6704777,"src":"Jill_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704777.html","width":121,"caption":"","height":150});
															thumbnails[6704778] = clik.newPhoto({"id":6704778,"src":"Jon_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704778.html","width":121,"caption":"","height":150});
															thumbnails[6704780] = clik.newPhoto({"id":6704780,"src":"Emma_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704780.html","width":121,"caption":"","height":150});
															thumbnails[6704806] = clik.newPhoto({"id":6704806,"src":"Hannah_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704806.html","width":121,"caption":"","height":150});
															thumbnails[6704810] = clik.newPhoto({"id":6704810,"src":"Helen_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704810.html","width":121,"caption":"","height":150});
															thumbnails[6704815] = clik.newPhoto({"id":6704815,"src":"Matt_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704815.html","width":121,"caption":"","height":150});
															thumbnails[6704819] = clik.newPhoto({"id":6704819,"src":"Nick--Emma_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704819.html","width":121,"caption":"","height":150});
															thumbnails[6704830] = clik.newPhoto({"id":6704830,"src":"Bradley_thumb.jpg","galleries_id":212376,"server_id":15,"link":"photo_6704830.html","width":121,"caption":"","height":150});
															thumbnails[5478431] = clik.newPhoto({"id":5478431,"src":"jockeydesign_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_5478431.html","width":130,"caption":"","height":105});
															thumbnails[5439157] = clik.newPhoto({"id":5439157,"src":"jockey-group_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_5439157.html","width":130,"caption":"","height":105});
															thumbnails[5439133] = clik.newPhoto({"id":5439133,"src":"jockey_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_5439133.html","width":121,"caption":"","height":150});
															thumbnails[5439141] = clik.newPhoto({"id":5439141,"src":"jockey-2_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_5439141.html","width":121,"caption":"","height":150});
															thumbnails[5439155] = clik.newPhoto({"id":5439155,"src":"jockey-3_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_5439155.html","width":121,"caption":"","height":150});
															thumbnails[6690356] = clik.newPhoto({"id":6690356,"src":"Lincoln_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690356.html","width":130,"caption":"","height":105});
															thumbnails[6690357] = clik.newPhoto({"id":6690357,"src":"marge--Eyre_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690357.html","width":130,"caption":"","height":105});
															thumbnails[6690360] = clik.newPhoto({"id":6690360,"src":"Oatley_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690360.html","width":130,"caption":"","height":105});
															thumbnails[6690368] = clik.newPhoto({"id":6690368,"src":"Sybil--Firk_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690368.html","width":130,"caption":"","height":105});
															thumbnails[6690373] = clik.newPhoto({"id":6690373,"src":"eyre--Lacy_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690373.html","width":130,"caption":"","height":105});
															thumbnails[6690394] = clik.newPhoto({"id":6690394,"src":"masks_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690394.html","width":130,"caption":"","height":105});
															thumbnails[6690449] = clik.newPhoto({"id":6690449,"src":"Dodger_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690449.html","width":130,"caption":"","height":105});
															thumbnails[6690454] = clik.newPhoto({"id":6690454,"src":"men-group_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690454.html","width":130,"caption":"","height":105});
															thumbnails[6690402] = clik.newPhoto({"id":6690402,"src":"sybil--hodge_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690402.html","width":130,"caption":"","height":105});
															thumbnails[6690409] = clik.newPhoto({"id":6690409,"src":"Rose_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690409.html","width":121,"caption":"","height":150});
															thumbnails[6690419] = clik.newPhoto({"id":6690419,"src":"Ralph--Jane_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690419.html","width":121,"caption":"","height":150});
															thumbnails[6690435] = clik.newPhoto({"id":6690435,"src":"Marge_thumb.jpg","galleries_id":212370,"server_id":15,"link":"photo_6690435.html","width":121,"caption":"","height":150});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[212370] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Costume","link":"gallery_212370.html","maxRecords":0.0,"photoIDs":[3702563.0,3489070.0,3739495.0,3739523.0,3739525.0,8078223.0,4111440.0,3489529.0,3489589.0,3489598.0,4111086.0,3489622.0,3489637.0,3489669.0,5478431.0,5439157.0,5439133.0,5439141.0,5439155.0,6690356.0,6690357.0,6690360.0,6690368.0,6690373.0,6690394.0,6690449.0,6690454.0,6690402.0,6690409.0,6690419.0,6690435.0],"skipIndex":0,"section_code":"gallery","featured_images":3702563.0,"id":212370,"singleSection":false});				  						galleries[309977] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Styling","link":"gallery_309977.html","maxRecords":0.0,"photoIDs":[5478076.0,5478080.0,5478144.0,5478177.0,5478083.0,5478085.0,5478088.0,5478136.0,5478137.0,5478128.0,5478158.0,5478151.0,5478157.0],"skipIndex":0,"section_code":"gallery","featured_images":5478076.0,"id":309977,"singleSection":false});				  						galleries[212376] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Supervising\/Assisting","link":"gallery_212376.html","maxRecords":0.0,"photoIDs":[8682751.0,8078242.0,3651046.0,3651052.0,3651064.0,3651070.0,3651078.0,3651090.0,3651191.0,3651216.0,3651221.0,3651230.0,3651235.0,3651251.0,3651255.0,3739447.0,3739855.0,3739860.0,5439238.0,5439227.0,5439231.0,5439226.0,5439239.0,5439500.0,5439540.0,5439579.0,6704699.0,6704777.0,6704778.0,6704780.0,6704806.0,6704810.0,6704815.0,6704819.0,6704830.0],"skipIndex":0,"section_code":"gallery","featured_images":"8682751,8078242","id":212376,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3702563';
imageSets[2] = '8682751,8078242,5478076,3702563';
imageSets[3] = '8078242,5478076,5478144,5478080,5478177,5478083,5478085,5478088,5478136,5478137,5478128,5478158,5478151,5478157,4111440,4111086,3739860,5439238,5439227,5439231,5439226,5439239,5439500,5439540,5439579,6704830,6704819,6704815,6704810,6704806,6704780,6704778,6704777,6704699,5478431,5439157,5439133,5439141,5439155,6690356,6690357,6690360,6690368,6690373,6690394,6690454,6690449,6690402,6690409,6690419,6690435';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/flossy/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/flossy/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/flossy/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/flossy/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/flossy/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/flossy/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/flossy/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Sarah Jones Costume: ' + 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.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> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="https://www.paypal.com/uk/cgi-bin/webscr?cmd=_account&nav=0">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="https://www.paypal.com/uk/cgi-bin/webscr?cmd=_account&nav=0">';
				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;
	}
}

			

