window.thumbnails = {};
															thumbnails[3924321] = clik.newPhoto({"id":3924321,"src":"IMG_7509ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_3924321.html","width":130,"caption":"gerbera","height":87});
															thumbnails[3924342] = clik.newPhoto({"id":3924342,"src":"IMG_2545ck_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_3924342.html","width":130,"caption":"farm machinery","height":87});
															thumbnails[3924353] = clik.newPhoto({"id":3924353,"src":"IMG_2553ck_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_3924353.html","width":130,"caption":"flint wall","height":87});
															thumbnails[3924355] = clik.newPhoto({"id":3924355,"src":"IMG_0533ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_3924355.html","width":130,"caption":"pelican","height":76});
															thumbnails[3924359] = clik.newPhoto({"id":3924359,"src":"IMG_9236ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_3924359.html","width":130,"caption":"native new zealand tree","height":195});
															thumbnails[3924362] = clik.newPhoto({"id":3924362,"src":"IMG_8426ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_3924362.html","width":130,"caption":"pebbles","height":87});
															thumbnails[3924365] = clik.newPhoto({"id":3924365,"src":"IMG_2700ck_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3924365.html","width":130,"caption":"gladiator","height":87});
															thumbnails[3924368] = clik.newPhoto({"id":3924368,"src":"IMG_2771ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_3924368.html","width":130,"caption":"yellow tulip","height":195});
															thumbnails[3924371] = clik.newPhoto({"id":3924371,"src":"IMG_0344ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_3924371.html","width":130,"caption":"up a gum tree","height":195});
															thumbnails[3924419] = clik.newPhoto({"id":3924419,"src":"IMG_9907ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_3924419.html","width":130,"caption":"calla lily","height":195});
															thumbnails[3924441] = clik.newPhoto({"id":3924441,"src":"IMG_8421ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_3924441.html","width":130,"caption":"taupo","height":87});
															thumbnails[3924742] = clik.newPhoto({"id":3924742,"src":"IMG_9288ck_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_3924742.html","width":130,"caption":"look into my eye","height":87});
															thumbnails[3924756] = clik.newPhoto({"id":3924756,"src":"IMG_2453_copyck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_3924756.html","width":130,"caption":"cold and frosty morning","height":87});
															thumbnails[3924767] = clik.newPhoto({"id":3924767,"src":"bw_img_4849_handsck_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_3924767.html","width":130,"caption":"tiny hand","height":87});
															thumbnails[3942505] = clik.newPhoto({"id":3942505,"src":"IMG_6621ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_3942505.html","width":130,"caption":"","height":87});
															thumbnails[3942508] = clik.newPhoto({"id":3942508,"src":"IMG_6667ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_3942508.html","width":130,"caption":"","height":87});
															thumbnails[3942526] = clik.newPhoto({"id":3942526,"src":"IMG_6693ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_3942526.html","width":130,"caption":"","height":87});
															thumbnails[3942529] = clik.newPhoto({"id":3942529,"src":"IMG_6673ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_3942529.html","width":130,"caption":"","height":195});
															thumbnails[3959311] = clik.newPhoto({"id":3959311,"src":"IMG_2828color_removedck2_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3959311.html","width":130,"caption":"waiting","height":151});
															thumbnails[3959320] = clik.newPhoto({"id":3959320,"src":"IMG_3012ck_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3959320.html","width":130,"caption":"lets go","height":195});
															thumbnails[3959329] = clik.newPhoto({"id":3959329,"src":"IMG_2829ck_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3959329.html","width":130,"caption":"scramble","height":195});
															thumbnails[3960021] = clik.newPhoto({"id":3960021,"src":"IMG_0864ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_3960021.html","width":130,"caption":"lake wakatipu, new zealand","height":62});
															thumbnails[3961328] = clik.newPhoto({"id":3961328,"src":"IMG_2834ck_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3961328.html","width":130,"caption":"Group Captain","height":195});
															thumbnails[3961332] = clik.newPhoto({"id":3961332,"src":"IMG_2835ck_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3961332.html","width":130,"caption":"","height":114});
															thumbnails[3961334] = clik.newPhoto({"id":3961334,"src":"IMG_2927ck_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3961334.html","width":130,"caption":"","height":47});
															thumbnails[3961337] = clik.newPhoto({"id":3961337,"src":"IMG_3002ck_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3961337.html","width":130,"caption":"are we ready?","height":87});
															thumbnails[3961339] = clik.newPhoto({"id":3961339,"src":"IMG_3009ck_thumb.jpg","galleries_id":238130,"server_id":15,"link":"photo_3961339.html","width":130,"caption":"sharing a joke","height":95});
															thumbnails[3998612] = clik.newPhoto({"id":3998612,"src":"IMG_3147ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_3998612.html","width":130,"caption":"beautiful day beautiful flower","height":87});
															thumbnails[3998675] = clik.newPhoto({"id":3998675,"src":"IMG_3232ck2_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_3998675.html","width":130,"caption":"tall poppy","height":121});
															thumbnails[4146086] = clik.newPhoto({"id":4146086,"src":"IMG_3286ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_4146086.html","width":130,"caption":"ear of wheat","height":195});
															thumbnails[4146092] = clik.newPhoto({"id":4146092,"src":"IMG_3290ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_4146092.html","width":130,"caption":"barley field","height":87});
															thumbnails[4146102] = clik.newPhoto({"id":4146102,"src":"IMG_3292ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_4146102.html","width":130,"caption":"barley","height":87});
															thumbnails[4251634] = clik.newPhoto({"id":4251634,"src":"IMG_3529ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_4251634.html","width":130,"caption":"globe thistle","height":87});
															thumbnails[4251641] = clik.newPhoto({"id":4251641,"src":"IMG_3557ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_4251641.html","width":130,"caption":"globe thistle","height":195});
															thumbnails[4251647] = clik.newPhoto({"id":4251647,"src":"IMG_3580ck_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_4251647.html","width":130,"caption":"hug me","height":87});
															thumbnails[4399224] = clik.newPhoto({"id":4399224,"src":"IMG_2939_copy_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4399224.html","width":130,"caption":"","height":195});
															thumbnails[4399226] = clik.newPhoto({"id":4399226,"src":"IMG_2940_copy_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4399226.html","width":130,"caption":"","height":87});
															thumbnails[4399227] = clik.newPhoto({"id":4399227,"src":"IMG_2941_copy_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4399227.html","width":130,"caption":"","height":87});
															thumbnails[4399230] = clik.newPhoto({"id":4399230,"src":"IMG_2946_copy_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4399230.html","width":130,"caption":"","height":195});
															thumbnails[4448276] = clik.newPhoto({"id":4448276,"src":"IMG_3047ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4448276.html","width":130,"caption":"","height":195});
															thumbnails[4448283] = clik.newPhoto({"id":4448283,"src":"IMG_3122ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4448283.html","width":130,"caption":"","height":195});
															thumbnails[4448284] = clik.newPhoto({"id":4448284,"src":"IMG_3139ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4448284.html","width":130,"caption":"","height":195});
															thumbnails[4448286] = clik.newPhoto({"id":4448286,"src":"IMG_3153ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4448286.html","width":130,"caption":"","height":195});
															thumbnails[4448288] = clik.newPhoto({"id":4448288,"src":"IMG_3107ck_thumb.jpg","galleries_id":239098,"server_id":15,"link":"photo_4448288.html","width":130,"caption":"","height":87});
															thumbnails[5647961] = clik.newPhoto({"id":5647961,"src":"IMG_5525ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_5647961.html","width":130,"caption":"snowdrop","height":195});
															thumbnails[5647985] = clik.newPhoto({"id":5647985,"src":"IMG_5842ck_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_5647985.html","width":130,"caption":"victorian boots","height":175});
															thumbnails[5767814] = clik.newPhoto({"id":5767814,"src":"IMG_6819_ck_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_5767814.html","width":130,"caption":"bright sunshine, dark sky","height":83});
															thumbnails[5802415] = clik.newPhoto({"id":5802415,"src":"IMG_7032_ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_5802415.html","width":130,"caption":"anemone blanda blue","height":87});
															thumbnails[5802425] = clik.newPhoto({"id":5802425,"src":"IMG_7034_ck_thumb.jpg","galleries_id":238133,"server_id":15,"link":"photo_5802425.html","width":130,"caption":"anemone blanda blue","height":87});
															thumbnails[7172098] = clik.newPhoto({"id":7172098,"src":"IMG_4857_thumb.jpg","galleries_id":237808,"server_id":15,"link":"photo_7172098.html","width":130,"caption":"hills in the early morning mist","height":67});
															thumbnails[7172102] = clik.newPhoto({"id":7172102,"src":"IMG_4965_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_7172102.html","width":130,"caption":"frosty leaves","height":83});
															thumbnails[7172105] = clik.newPhoto({"id":7172105,"src":"IMG_4964_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_7172105.html","width":130,"caption":"leaf","height":87});
															thumbnails[7172108] = clik.newPhoto({"id":7172108,"src":"IMG_4976_thumb.jpg","galleries_id":237809,"server_id":15,"link":"photo_7172108.html","width":130,"caption":"frost on a fir tree","height":221});
															thumbnails[9149698] = clik.newPhoto({"id":9149698,"src":"IMG_0028_fb_bw_bluch_altered_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149698.html","width":130,"caption":"friends","height":195});
															thumbnails[9149707] = clik.newPhoto({"id":9149707,"src":"IMG_0084_fb_love_altered_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149707.html","width":130,"caption":"solitude","height":87});
															thumbnails[9149713] = clik.newPhoto({"id":9149713,"src":"IMG_0084_fb_posh_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149713.html","width":130,"caption":"solitude 2","height":87});
															thumbnails[9149718] = clik.newPhoto({"id":9149718,"src":"IMG_0099_fb_pandora_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149718.html","width":130,"caption":"a word in your ear","height":87});
															thumbnails[9149722] = clik.newPhoto({"id":9149722,"src":"IMG_0103_fb_sugar_altered_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149722.html","width":130,"caption":"i love you","height":195});
															thumbnails[9149726] = clik.newPhoto({"id":9149726,"src":"IMG_0113_fb_allure_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149726.html","width":130,"caption":"best friends","height":195});
															thumbnails[9149728] = clik.newPhoto({"id":9149728,"src":"IMG_0113_fb_bw_blush_altered_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149728.html","width":130,"caption":"best friends 2","height":195});
															thumbnails[9149732] = clik.newPhoto({"id":9149732,"src":"IMG_0113_fb_teatime_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149732.html","width":130,"caption":"best friends 3","height":195});
															thumbnails[9149735] = clik.newPhoto({"id":9149735,"src":"IMG_0118_fb_cashmere_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149735.html","width":130,"caption":"going home","height":87});
															thumbnails[9149737] = clik.newPhoto({"id":9149737,"src":"IMG_0118_fb_halo_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149737.html","width":130,"caption":"going home 2","height":87});
															thumbnails[9149740] = clik.newPhoto({"id":9149740,"src":"IMG_0118_fb_ruby_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149740.html","width":130,"caption":"going home 3","height":87});
															thumbnails[9149742] = clik.newPhoto({"id":9149742,"src":"IMG_0128_fb_envy_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149742.html","width":130,"caption":"trust","height":87});
															thumbnails[9149749] = clik.newPhoto({"id":9149749,"src":"IMG_0128_fb_heiress_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149749.html","width":130,"caption":"trust 2","height":87});
															thumbnails[9149751] = clik.newPhoto({"id":9149751,"src":"IMG_0128_fb_ruby_copy_ck_1_thumb.jpg","galleries_id":483136,"server_id":15,"link":"photo_9149751.html","width":130,"caption":"trust 3","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[238130] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"flight","link":"gallery_238130.html","maxRecords":0.0,"photoIDs":[3924365.0,3959311.0,3959320.0,3959329.0,3961328.0,3961332.0,3961334.0,3961337.0,3961339.0],"skipIndex":0,"section_code":"gallery","featured_images":3924365.0,"id":238130,"singleSection":false});				  						galleries[238133] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"flora","link":"gallery_238133.html","maxRecords":0.0,"photoIDs":[3924321.0,3924368.0,3924419.0,3998612.0,3998675.0,4251634.0,4251641.0,5647961.0,5802415.0,5802425.0],"skipIndex":0,"section_code":"gallery","featured_images":"5802425,5802415,5647961,4251641,4251634,3998675,3998612,3924419,3924368,3924321","id":238133,"singleSection":false});				  						galleries[483136] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"for the love of horses","link":"gallery_483136.html","maxRecords":0.0,"photoIDs":[9149698.0,9149707.0,9149713.0,9149718.0,9149722.0,9149726.0,9149728.0,9149732.0,9149735.0,9149737.0,9149740.0,9149742.0,9149749.0,9149751.0],"skipIndex":0,"section_code":"gallery","featured_images":9149707.0,"id":483136,"singleSection":false});				  						galleries[239098] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"people ","link":"gallery_239098.html","maxRecords":0.0,"photoIDs":[3942505.0,3942508.0,3942526.0,3942529.0,4399224.0,4399226.0,4399227.0,4399230.0,4448276.0,4448283.0,4448284.0,4448286.0,4448288.0],"skipIndex":0,"section_code":"gallery","featured_images":4448284.0,"id":239098,"singleSection":false});				  						galleries[237808] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"our beautiful world","link":"gallery_237808.html","maxRecords":0.0,"photoIDs":[3924355.0,3924359.0,3924362.0,3924371.0,3924441.0,3924756.0,3960021.0,4146086.0,4146092.0,4146102.0,5767814.0,7172098.0],"skipIndex":0,"section_code":"gallery","featured_images":3924359.0,"id":237808,"singleSection":false});				  						galleries[237809] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"the smallest detail","link":"gallery_237809.html","maxRecords":0.0,"photoIDs":[3924342.0,3924353.0,3924742.0,3924767.0,4251647.0,5647985.0,7172102.0,7172105.0,7172108.0],"skipIndex":0,"section_code":"gallery","featured_images":3924353.0,"id":237809,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9149751,9149742,9149740,9149735,9149732,9149726,9149718,9149713,9149707,9149698,7172108,7172105,7172102,7172098,5802425,5802415,5647985,5647961,4448286,4448284,4448283,4448276,4399230,4146086,3998675,3960021,3942529,3924767,3924742,3924441,3924371,3924362,3924359,3924353,3924342';
imageSets[2] = '9149707,4448284,3924365,3924359,3924353';
imageSets[3] = '5802425,5802415,5767814,5647985,5647961,4448288,4448286,4448284,4448283,4448276,4399230,4399227,4399226,4399224,4251647,4251641,4251634,4146102,4146092,4146086,3998675,3998612,3961339,3961337,3961334,3961332,3961328,3960021,3959329,3959320,3959311,3942529,3942526,3942508,3942505,3924767,3924756,3924742,3924441,3924419,3924371,3924368,3924365,3924362,3924359,3924355,3924353,3924342,3924321';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sueabbott/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/sueabbott/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 = 'purely photography: ' + 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;
	}
}

			

