window.thumbnails = {};
															thumbnails[8970195] = clik.newPhoto({"id":8970195,"src":"100ToWatch_Promo_copy123_thumb.jpg","galleries_id":"","server_id":1,"link":"#","width":130,"caption":"","height":156});
															thumbnails[1893467] = clik.newPhoto({"id":1893467,"src":"matthew_atkinson_Cardinal Cabin 72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1893467.html","width":130,"caption":"","height":108});
															thumbnails[1893515] = clik.newPhoto({"id":1893515,"src":"Untiled Woodlands 72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1893515.html","width":130,"caption":"","height":87});
															thumbnails[1893559] = clik.newPhoto({"id":1893559,"src":"Brevity_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1893559.html","width":130,"caption":"","height":156});
															thumbnails[1921022] = clik.newPhoto({"id":1921022,"src":"71_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1921022.html","width":130,"caption":"","height":86});
															thumbnails[1921026] = clik.newPhoto({"id":1921026,"src":"IMAGE_12_300dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1921026.html","width":130,"caption":"","height":86});
															thumbnails[1926589] = clik.newPhoto({"id":1926589,"src":"Kent & Essex_72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1926589.html","width":130,"caption":"","height":196});
															thumbnails[1932553] = clik.newPhoto({"id":1932553,"src":"White Cabin_72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1932553.html","width":130,"caption":"","height":86});
															thumbnails[1953286] = clik.newPhoto({"id":1953286,"src":"Achromatic Cabin 72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1953286.html","width":130,"caption":"","height":154});
															thumbnails[1958796] = clik.newPhoto({"id":1958796,"src":"72_dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1958796.html","width":130,"caption":"","height":86});
															thumbnails[1997269] = clik.newPhoto({"id":1997269,"src":"New_72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1997269.html","width":130,"caption":"","height":107});
															thumbnails[3228801] = clik.newPhoto({"id":3228801,"src":"Part 1_72dpi_thumb.jpg","galleries_id":159939,"server_id":1,"link":"photo_3228801.html","width":130,"caption":"","height":195});
															thumbnails[5279449] = clik.newPhoto({"id":5279449,"src":"never_never_but_sometimes_forever_72dpi_thumb.jpg","galleries_id":297031,"server_id":1,"link":"photo_5279449.html","width":130,"caption":"","height":156});
															thumbnails[5332675] = clik.newPhoto({"id":5332675,"src":"19_copy_thumb.jpg","galleries_id":159939,"server_id":1,"link":"photo_5332675.html","width":130,"caption":"","height":156});
															thumbnails[5332679] = clik.newPhoto({"id":5332679,"src":"26_thumb.jpg","galleries_id":297031,"server_id":1,"link":"photo_5332679.html","width":130,"caption":"","height":156});
															thumbnails[5332683] = clik.newPhoto({"id":5332683,"src":"25_thumb.jpg","galleries_id":297031,"server_id":1,"link":"photo_5332683.html","width":130,"caption":"","height":108});
															thumbnails[5332686] = clik.newPhoto({"id":5332686,"src":"Disney_4_72dpi_thumb.jpg","galleries_id":297031,"server_id":1,"link":"photo_5332686.html","width":130,"caption":"","height":173});
															thumbnails[5332692] = clik.newPhoto({"id":5332692,"src":"Disney_5_72dpi_thumb.jpg","galleries_id":297031,"server_id":1,"link":"photo_5332692.html","width":130,"caption":"","height":173});
															thumbnails[5332703] = clik.newPhoto({"id":5332703,"src":"Grave_72dpi_thumb.jpg","galleries_id":159939,"server_id":1,"link":"photo_5332703.html","width":130,"caption":"","height":173});
															thumbnails[5342501] = clik.newPhoto({"id":5342501,"src":"20_thumb.jpg","galleries_id":159939,"server_id":1,"link":"photo_5342501.html","width":130,"caption":"","height":189});
															thumbnails[5358624] = clik.newPhoto({"id":5358624,"src":"NeverNeverWorld_Postcard_copy_thumb.jpg","galleries_id":297031,"server_id":1,"link":"photo_5358624.html","width":130,"caption":"","height":86});
															thumbnails[5436486] = clik.newPhoto({"id":5436486,"src":"Disney_7_72dpi_thumb.jpg","galleries_id":297031,"server_id":1,"link":"photo_5436486.html","width":130,"caption":"","height":98});
															thumbnails[5436528] = clik.newPhoto({"id":5436528,"src":"29_thumb.jpg","galleries_id":297031,"server_id":1,"link":"photo_5436528.html","width":130,"caption":"","height":195});
															thumbnails[5747119] = clik.newPhoto({"id":5747119,"src":"Almost_finished21_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_5747119.html","width":130,"caption":"","height":173});
															thumbnails[5929298] = clik.newPhoto({"id":5929298,"src":"31_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_5929298.html","width":130,"caption":"","height":173});
															thumbnails[6162341] = clik.newPhoto({"id":6162341,"src":"Hands_72dpi_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_6162341.html","width":130,"caption":"","height":195});
															thumbnails[6162423] = clik.newPhoto({"id":6162423,"src":"Tree_72dpi_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_6162423.html","width":130,"caption":"","height":173});
															thumbnails[6556443] = clik.newPhoto({"id":6556443,"src":"53_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_6556443.html","width":130,"caption":"","height":195});
															thumbnails[6661891] = clik.newPhoto({"id":6661891,"src":"house_72dpi_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_6661891.html","width":130,"caption":"","height":173});
															thumbnails[6699515] = clik.newPhoto({"id":6699515,"src":"54_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_6699515.html","width":130,"caption":"","height":156});
															thumbnails[6699526] = clik.newPhoto({"id":6699526,"src":"Untitled_PAINTING_2_72dpi_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_6699526.html","width":130,"caption":"","height":195});
															thumbnails[7078720] = clik.newPhoto({"id":7078720,"src":"Untitled_PAINTING_72dpi_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7078720.html","width":130,"caption":"","height":195});
															thumbnails[7401522] = clik.newPhoto({"id":7401522,"src":"42_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7401522.html","width":130,"caption":"","height":156});
															thumbnails[7401524] = clik.newPhoto({"id":7401524,"src":"41_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7401524.html","width":130,"caption":"","height":156});
															thumbnails[7401815] = clik.newPhoto({"id":7401815,"src":"40_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7401815.html","width":130,"caption":"","height":156});
															thumbnails[7435853] = clik.newPhoto({"id":7435853,"src":"44_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7435853.html","width":130,"caption":"","height":182});
															thumbnails[7435855] = clik.newPhoto({"id":7435855,"src":"39_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7435855.html","width":130,"caption":"","height":93});
															thumbnails[7536463] = clik.newPhoto({"id":7536463,"src":"34_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7536463.html","width":130,"caption":"","height":195});
															thumbnails[7932714] = clik.newPhoto({"id":7932714,"src":"46_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7932714.html","width":130,"caption":"","height":156});
															thumbnails[7932721] = clik.newPhoto({"id":7932721,"src":"47_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7932721.html","width":130,"caption":"","height":156});
															thumbnails[7938354] = clik.newPhoto({"id":7938354,"src":"45_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7938354.html","width":130,"caption":"","height":195});
															thumbnails[7938368] = clik.newPhoto({"id":7938368,"src":"48_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7938368.html","width":130,"caption":"","height":195});
															thumbnails[7938567] = clik.newPhoto({"id":7938567,"src":"50_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7938567.html","width":130,"caption":"","height":156});
															thumbnails[7938580] = clik.newPhoto({"id":7938580,"src":"49_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7938580.html","width":130,"caption":"","height":156});
															thumbnails[7939597] = clik.newPhoto({"id":7939597,"src":"51_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7939597.html","width":130,"caption":"","height":156});
															thumbnails[7939674] = clik.newPhoto({"id":7939674,"src":"52_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_7939674.html","width":130,"caption":"","height":156});
															thumbnails[8215035] = clik.newPhoto({"id":8215035,"src":"91_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8215035.html","width":130,"caption":"","height":156});
															thumbnails[8215038] = clik.newPhoto({"id":8215038,"src":"89_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8215038.html","width":130,"caption":"","height":156});
															thumbnails[8215046] = clik.newPhoto({"id":8215046,"src":"88_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8215046.html","width":130,"caption":"","height":156});
															thumbnails[8345670] = clik.newPhoto({"id":8345670,"src":"95_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8345670.html","width":130,"caption":"","height":156});
															thumbnails[8345685] = clik.newPhoto({"id":8345685,"src":"92_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8345685.html","width":130,"caption":"","height":195});
															thumbnails[8345689] = clik.newPhoto({"id":8345689,"src":"93_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8345689.html","width":130,"caption":"","height":195});
															thumbnails[8487539] = clik.newPhoto({"id":8487539,"src":"97_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8487539.html","width":130,"caption":"","height":156});
															thumbnails[8500361] = clik.newPhoto({"id":8500361,"src":"96_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8500361.html","width":130,"caption":"","height":195});
															thumbnails[8606515] = clik.newPhoto({"id":8606515,"src":"98_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8606515.html","width":130,"caption":"","height":76});
															thumbnails[8606607] = clik.newPhoto({"id":8606607,"src":"102_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8606607.html","width":130,"caption":"","height":195});
															thumbnails[8606643] = clik.newPhoto({"id":8606643,"src":"103_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8606643.html","width":130,"caption":"","height":195});
															thumbnails[8606752] = clik.newPhoto({"id":8606752,"src":"100_F8B61F33-24E8-5EC4-4F2B5CFECAFC684E_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8606752.html","width":130,"caption":"","height":156});
															thumbnails[8606767] = clik.newPhoto({"id":8606767,"src":"101_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8606767.html","width":130,"caption":"","height":173});
															thumbnails[8606784] = clik.newPhoto({"id":8606784,"src":"99_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8606784.html","width":130,"caption":"","height":173});
															thumbnails[8608856] = clik.newPhoto({"id":8608856,"src":"23_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8608856.html","width":130,"caption":"","height":196});
															thumbnails[8738937] = clik.newPhoto({"id":8738937,"src":"106_763F9C44-1EC9-DFB6-09D084B84F533B09_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8738937.html","width":130,"caption":"","height":186});
															thumbnails[8755108] = clik.newPhoto({"id":8755108,"src":"107_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8755108.html","width":130,"caption":"","height":156});
															thumbnails[8755120] = clik.newPhoto({"id":8755120,"src":"108_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8755120.html","width":130,"caption":"","height":156});
															thumbnails[8755128] = clik.newPhoto({"id":8755128,"src":"109_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8755128.html","width":130,"caption":"","height":156});
															thumbnails[8876053] = clik.newPhoto({"id":8876053,"src":"68_570AF4CC-24E8-5EC4-4FEAE07FC7F0F4BC_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8876053.html","width":130,"caption":"","height":195});
															thumbnails[8876086] = clik.newPhoto({"id":8876086,"src":"104_thumb.jpg","galleries_id":325514,"server_id":1,"link":"photo_8876086.html","width":130,"caption":"","height":195});
															thumbnails[3159959] = clik.newPhoto({"id":3159959,"src":"kent & Essex Silk_72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_3159959.html","width":130,"caption":"","height":195});
															thumbnails[3629906] = clik.newPhoto({"id":3629906,"src":"W_T_DREAMLAND_72dpi_thumb.jpg","galleries_id":159939,"server_id":1,"link":"photo_3629906.html","width":130,"caption":"","height":104});
															thumbnails[3721073] = clik.newPhoto({"id":3721073,"src":"Welcome_to_Dreamland_TRANSPARENCY_colour_72dpi_thumb.jpg","galleries_id":159939,"server_id":1,"link":"photo_3721073.html","width":130,"caption":"","height":94});
															thumbnails[3035749] = clik.newPhoto({"id":3035749,"src":"Kent & Essex2_72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_3035749.html","width":130,"caption":"","height":195});
															thumbnails[1893493] = clik.newPhoto({"id":1893493,"src":"matthew_atkinson_Kent and Essex_Capriccio or Veduta 72dpi_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_1893493.html","width":130,"caption":"","height":156});
															thumbnails[4281263] = clik.newPhoto({"id":4281263,"src":"Untitled_P_72dpi_thumb.jpg","galleries_id":159939,"server_id":1,"link":"photo_4281263.html","width":130,"caption":"","height":195});
															thumbnails[891839] = clik.newPhoto({"id":891839,"src":"18th century drama cabin klein blue72dpi21_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_891839.html","width":130,"caption":"","height":137});
															thumbnails[891872] = clik.newPhoto({"id":891872,"src":"matthew_atkinson_klein cabin_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_891872.html","width":130,"caption":"","height":195});
															thumbnails[891882] = clik.newPhoto({"id":891882,"src":"That Next Place72dpi2_thumb.jpg","galleries_id":62556,"server_id":1,"link":"photo_891882.html","width":130,"caption":"","height":98});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[325514] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"(im)possibility through the (in)finite... (2011)","link":"gallery_325514.html","maxRecords":0.0,"photoIDs":[5747119.0,5929298.0,6162341.0,6162423.0,6556443.0,6661891.0,6699515.0,6699526.0,7078720.0,7401522.0,7401524.0,7401815.0,7435853.0,7435855.0,7536463.0,7932714.0,7932721.0,7938354.0,7938368.0,7938567.0,7938580.0,7939597.0,7939674.0,8215035.0,8215038.0,8215046.0,8345670.0,8345685.0,8345689.0,8487539.0,8500361.0,8606515.0,8606607.0,8606643.0,8606752.0,8606767.0,8606784.0,8608856.0,8738937.0,8755108.0,8755120.0,8755128.0,8876053.0,8876086.0],"skipIndex":0,"section_code":"gallery","featured_images":"7435853,5747119","id":325514,"singleSection":false});				  						galleries[297031] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"NeverNeverWorld (2009 - 2010)","link":"gallery_297031.html","maxRecords":0.0,"photoIDs":[5279449.0,5332679.0,5332683.0,5332686.0,5332692.0,5358624.0,5436486.0,5436528.0],"skipIndex":0,"section_code":"gallery","featured_images":5279449.0,"id":297031,"singleSection":false});				  						galleries[159939] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"NeverNeverLand (2008 - 2009)","link":"gallery_159939.html","maxRecords":0.0,"photoIDs":[3228801.0,5332675.0,5332703.0,5342501.0,3629906.0,3721073.0,4281263.0],"skipIndex":0,"section_code":"gallery","featured_images":3228801.0,"id":159939,"singleSection":false});				  						galleries[62556] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"NOWhere (2006 - 2007)","link":"gallery_62556.html","maxRecords":0.0,"photoIDs":[1893467.0,1893515.0,1893559.0,1921022.0,1921026.0,1926589.0,1932553.0,1953286.0,1958796.0,1997269.0,3159959.0,3035749.0,1893493.0,891839.0,891872.0,891882.0],"skipIndex":0,"section_code":"gallery","featured_images":1893493.0,"id":62556,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8970195';
imageSets[2] = '7435853,5747119,5279449,3228801,1893493';
imageSets[3] = '8970195,8876086,8876053,8755128,8755120,8755108,8738937,8608856,8606784,8606767,8606752,8606643,8606607,8606515,8500361,8487539,8345689,8345685,8345670,8215046,8215038,8215035,7939674,7939597,7938580,7938567,7938368,7938354,7932721,7932714,7536463,7435855,7435853,7401815,7401524,7401522,7078720,6699526,6699515,6661891,6556443,6162423,6162341,5929298,5747119,5436528,5436486,5358624,5342501,5332703';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/akomonca/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/akomonca/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/akomonca/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/akomonca/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/akomonca/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/akomonca/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/akomonca/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/akomonca/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 = 'Matthew. John. Atkinson : ' + 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;
	}
}

			

