window.thumbnails = {};
															thumbnails[1115679] = clik.newPhoto({"id":1115679,"src":"Canalboat_2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1115679.html","width":130,"caption":"Canal boat on the Chelmer & Blackwater.","height":178});
															thumbnails[1115681] = clik.newPhoto({"id":1115681,"src":"Cottage_2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1115681.html","width":130,"caption":"Cottage in Hatfield Peverel","height":93});
															thumbnails[1115682] = clik.newPhoto({"id":1115682,"src":"cowfield_2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1115682.html","width":130,"caption":"Just outside my door !","height":81});
															thumbnails[1115683] = clik.newPhoto({"id":1115683,"src":"Cornfield_21_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1115683.html","width":130,"caption":"Corn field, Hatfield Peverel.","height":195});
															thumbnails[1115684] = clik.newPhoto({"id":1115684,"src":"Lockkeeper2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1115684.html","width":130,"caption":"Lock keepers cottage, Heybridge Basin.","height":197});
															thumbnails[1115685] = clik.newPhoto({"id":1115685,"src":"Morning_flight2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1115685.html","width":130,"caption":"Early morning, Little Baddow. ","height":81});
															thumbnails[1115686] = clik.newPhoto({"id":1115686,"src":"Sunrise2_05004A99-1D09-001F-995991445027908C_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1115686.html","width":130,"caption":"Heybridge Basin.","height":108});
															thumbnails[1115687] = clik.newPhoto({"id":1115687,"src":"Windmill2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1115687.html","width":130,"caption":"Thaxted windmill.","height":195});
															thumbnails[1115691] = clik.newPhoto({"id":1115691,"src":"Barcalona_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_1115691.html","width":130,"caption":"View over the city from the steps of the Museu Nacional d'Art de Catalunya, Barcelona.","height":193});
															thumbnails[1115692] = clik.newPhoto({"id":1115692,"src":"Burano_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_1115692.html","width":130,"caption":"The colouful island of Burano, in the Venetian lagoon. ","height":96});
															thumbnails[1115694] = clik.newPhoto({"id":1115694,"src":"canal_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_1115694.html","width":130,"caption":"Venetian canal.","height":194});
															thumbnails[1115697] = clik.newPhoto({"id":1115697,"src":"Gondolas_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_1115697.html","width":130,"caption":"Gondolas & Santa Maria Della Salute,  Venice.","height":94});
															thumbnails[1115698] = clik.newPhoto({"id":1115698,"src":"Sagrada_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_1115698.html","width":130,"caption":"Gaudi designed La Sagrada Familia, Barcelona.","height":195});
															thumbnails[1115699] = clik.newPhoto({"id":1115699,"src":"Portrait1_thumb.jpg","galleries_id":81735,"server_id":18,"link":"photo_1115699.html","width":130,"caption":"","height":185});
															thumbnails[1115702] = clik.newPhoto({"id":1115702,"src":"Blackrock_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1115702.html","width":130,"caption":"Black Rock cottage.","height":52});
															thumbnails[1115703] = clik.newPhoto({"id":1115703,"src":"Canary_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1115703.html","width":130,"caption":"Canary Wharf.","height":54});
															thumbnails[1115704] = clik.newPhoto({"id":1115704,"src":"Greenwich_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1115704.html","width":130,"caption":"Greenwich foot tunnel. ","height":52});
															thumbnails[1115706] = clik.newPhoto({"id":1115706,"src":"Holyisland_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1115706.html","width":130,"caption":"Holy Island.","height":52});
															thumbnails[1115708] = clik.newPhoto({"id":1115708,"src":"Sunrise_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1115708.html","width":130,"caption":"Sunrise over Loch Ba.","height":54});
															thumbnails[1115709] = clik.newPhoto({"id":1115709,"src":"Tower_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1115709.html","width":130,"caption":"Tower Bridge","height":53});
															thumbnails[1115720] = clik.newPhoto({"id":1115720,"src":"Bamber2_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_1115720.html","width":130,"caption":"Bamburgh Castle from the dunes, Northumberland.","height":173});
															thumbnails[1115722] = clik.newPhoto({"id":1115722,"src":"Dunstan2_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_1115722.html","width":130,"caption":"Dunstanburgh Castle from Embleton Bay, Northumberland.","height":178});
															thumbnails[1115723] = clik.newPhoto({"id":1115723,"src":"Sligachan2_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_1115723.html","width":130,"caption":"Sligachan, Isle of Skye.","height":93});
															thumbnails[1115724] = clik.newPhoto({"id":1115724,"src":"Sunrise2_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_1115724.html","width":130,"caption":"Sunrise on the Isle of Skye.","height":84});
															thumbnails[1115728] = clik.newPhoto({"id":1115728,"src":"Tree2_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_1115728.html","width":130,"caption":"Sycamore pass, Hadrians wall, Northumberland.","height":144});
															thumbnails[1115731] = clik.newPhoto({"id":1115731,"src":"Wall2_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_1115731.html","width":130,"caption":"Hadrians wall near Halsteads, Northumberland.","height":165});
															thumbnails[1115734] = clik.newPhoto({"id":1115734,"src":"Campanile2_thumb.jpg","galleries_id":81733,"server_id":18,"link":"photo_1115734.html","width":130,"caption":"View from the Campanile, Venice.","height":87});
															thumbnails[1115738] = clik.newPhoto({"id":1115738,"src":"Palace2_thumb.jpg","galleries_id":81733,"server_id":18,"link":"photo_1115738.html","width":130,"caption":"The Palace Hotel, Southend-on-Sea.","height":95});
															thumbnails[1115741] = clik.newPhoto({"id":1115741,"src":"pier2_thumb.jpg","galleries_id":81733,"server_id":18,"link":"photo_1115741.html","width":130,"caption":"At the end of Southend pier.","height":96});
															thumbnails[1115743] = clik.newPhoto({"id":1115743,"src":"Quiraing2_thumb.jpg","galleries_id":81733,"server_id":18,"link":"photo_1115743.html","width":130,"caption":"Footpath to the hills, Isle of Skye.","height":196});
															thumbnails[1115745] = clik.newPhoto({"id":1115745,"src":"Southwold2_thumb.jpg","galleries_id":81733,"server_id":18,"link":"photo_1115745.html","width":130,"caption":"From the dunes at Southwold beach.","height":105});
															thumbnails[1115934] = clik.newPhoto({"id":1115934,"src":"Portrait2_thumb.jpg","galleries_id":81735,"server_id":18,"link":"photo_1115934.html","width":130,"caption":"","height":101});
															thumbnails[1115935] = clik.newPhoto({"id":1115935,"src":"Portrait3_thumb.jpg","galleries_id":81735,"server_id":18,"link":"photo_1115935.html","width":130,"caption":"","height":195});
															thumbnails[1116086] = clik.newPhoto({"id":1116086,"src":"Daffodils_2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1116086.html","width":130,"caption":"Daffodils at Terling.","height":114});
															thumbnails[1502222] = clik.newPhoto({"id":1502222,"src":"Cricket-at-Audley-End_2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_1502222.html","width":130,"caption":"Cricket at Audley End house.","height":149});
															thumbnails[1502227] = clik.newPhoto({"id":1502227,"src":"Budapest_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_1502227.html","width":130,"caption":"Budapest at night","height":93});
															thumbnails[1502228] = clik.newPhoto({"id":1502228,"src":"Budapest-Parliment_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_1502228.html","width":130,"caption":"The Parliament building, Budapest.","height":94});
															thumbnails[1769457] = clik.newPhoto({"id":1769457,"src":"Maldon-pano_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1769457.html","width":130,"caption":"Maldon ","height":50});
															thumbnails[1769464] = clik.newPhoto({"id":1769464,"src":"Budapest1_093E448B-1D09-001F-99680FB89ECAB6BD_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1769464.html","width":130,"caption":"Budapest","height":53});
															thumbnails[1778564] = clik.newPhoto({"id":1778564,"src":"Portrait4_thumb.jpg","galleries_id":81735,"server_id":18,"link":"photo_1778564.html","width":130,"caption":"","height":98});
															thumbnails[1870829] = clik.newPhoto({"id":1870829,"src":"City_hall__Tower_bridge_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_1870829.html","width":130,"caption":"City hall & Tower bridge","height":47});
															thumbnails[2853594] = clik.newPhoto({"id":2853594,"src":"Beach-stream_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_2853594.html","width":130,"caption":"Beach stream","height":99});
															thumbnails[2853597] = clik.newPhoto({"id":2853597,"src":"Bamburgh-castle-1_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_2853597.html","width":130,"caption":"Bamburgh castle, Northumberland.","height":94});
															thumbnails[2853931] = clik.newPhoto({"id":2853931,"src":"Corn-bales_thumb.jpg","galleries_id":81733,"server_id":18,"link":"photo_2853931.html","width":130,"caption":"Hay bales","height":107});
															thumbnails[2855865] = clik.newPhoto({"id":2855865,"src":"Waterfall-1_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_2855865.html","width":130,"caption":"Hareshaw Linn waterfall","height":191});
															thumbnails[2957306] = clik.newPhoto({"id":2957306,"src":"Bamburgh-panoramic-2_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_2957306.html","width":130,"caption":"Bamburgh Castle, Northumberland","height":54});
															thumbnails[3442233] = clik.newPhoto({"id":3442233,"src":"Heybridge-basin_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_3442233.html","width":130,"caption":"Dawn at Heybridge Basin","height":46});
															thumbnails[3442289] = clik.newPhoto({"id":3442289,"src":"Frozen_teasel2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_3442289.html","width":130,"caption":"Frozen teasel","height":195});
															thumbnails[3970518] = clik.newPhoto({"id":3970518,"src":"Liberty-Belle2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_3970518.html","width":130,"caption":"Liberty Belle","height":192});
															thumbnails[3970522] = clik.newPhoto({"id":3970522,"src":"Mountnessing-post-mill2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_3970522.html","width":130,"caption":"MountNessing post mill.","height":194});
															thumbnails[4045154] = clik.newPhoto({"id":4045154,"src":"Frinton-beach2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_4045154.html","width":130,"caption":"Frinton beach.","height":195});
															thumbnails[4878545] = clik.newPhoto({"id":4878545,"src":"Goat_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_4878545.html","width":130,"caption":"Goat","height":195});
															thumbnails[4878568] = clik.newPhoto({"id":4878568,"src":"Instow_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_4878568.html","width":130,"caption":"Instow, North Devon.","height":46});
															thumbnails[4878572] = clik.newPhoto({"id":4878572,"src":"Hele-Bay_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_4878572.html","width":130,"caption":"Hele Bay, North Devon.","height":46});
															thumbnails[4881452] = clik.newPhoto({"id":4881452,"src":"Lynmouth_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_4881452.html","width":130,"caption":"Lynmouth harbour, north Devon.","height":46});
															thumbnails[5376244] = clik.newPhoto({"id":5376244,"src":"Chelmer--Blackwater-canal2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_5376244.html","width":130,"caption":"Chelmer & Blackwater canal","height":195});
															thumbnails[5792649] = clik.newPhoto({"id":5792649,"src":"Hadleigh-castle2_thumb.jpg","galleries_id":81733,"server_id":18,"link":"photo_5792649.html","width":130,"caption":"Hadleigh castle.","height":165});
															thumbnails[6255842] = clik.newPhoto({"id":6255842,"src":"Langford-Poppy-field2_thumb.jpg","galleries_id":81731,"server_id":18,"link":"photo_6255842.html","width":130,"caption":"Langford poppy field.","height":173});
															thumbnails[6446105] = clik.newPhoto({"id":6446105,"src":"Samuel_thumb.jpg","galleries_id":81735,"server_id":18,"link":"photo_6446105.html","width":130,"caption":"","height":167});
															thumbnails[6880891] = clik.newPhoto({"id":6880891,"src":"Prague-castle_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_6880891.html","width":130,"caption":"Prague castle and cathedral","height":87});
															thumbnails[6903316] = clik.newPhoto({"id":6903316,"src":"St-Agnes-bay-Cornwall_thumb.jpg","galleries_id":81740,"server_id":18,"link":"photo_6903316.html","width":130,"caption":"Trevaunance cove, North Cornwall","height":192});
															thumbnails[7866406] = clik.newPhoto({"id":7866406,"src":"Prague-castle-BW_thumb.gif","galleries_id":81733,"server_id":18,"link":"photo_7866406.html","width":130,"caption":"Prague castle and cathedral","height":92});
															thumbnails[7866408] = clik.newPhoto({"id":7866408,"src":"Severn-Sisters-BW_thumb.gif","galleries_id":81733,"server_id":18,"link":"photo_7866408.html","width":130,"caption":"Seven sisters","height":195});
															thumbnails[8719737] = clik.newPhoto({"id":8719737,"src":"Lisbon_thumb.jpg","galleries_id":81734,"server_id":18,"link":"photo_8719737.html","width":130,"caption":"Lisbon overview","height":52});
															thumbnails[8719937] = clik.newPhoto({"id":8719937,"src":"Lisbon1_thumb.jpg","galleries_id":81732,"server_id":18,"link":"photo_8719937.html","width":130,"caption":"Lisbon, Portugal.","height":93});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[81731] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Essex","link":"gallery_81731.html","maxRecords":0.0,"photoIDs":[1115679.0,1115681.0,1115682.0,1115683.0,1115684.0,1115685.0,1115686.0,1115687.0,1116086.0,1502222.0,3442289.0,3970518.0,3970522.0,4045154.0,5376244.0,6255842.0],"skipIndex":0,"section_code":"gallery","featured_images":"6255842,5376244,3970522,3970518,3442289,1115679","id":81731,"singleSection":false});				  						galleries[81732] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Travel","link":"gallery_81732.html","maxRecords":0.0,"photoIDs":[1115691.0,1115692.0,1115694.0,1115697.0,1115698.0,1502227.0,1502228.0,6880891.0,8719937.0],"skipIndex":0,"section_code":"gallery","featured_images":"8719937,6880891,1115694","id":81732,"singleSection":false});				  						galleries[81733] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Mono","link":"gallery_81733.html","maxRecords":0.0,"photoIDs":[1115734.0,1115738.0,1115741.0,1115743.0,1115745.0,2853931.0,5792649.0,7866406.0,7866408.0],"skipIndex":0,"section_code":"gallery","featured_images":1115734.0,"id":81733,"singleSection":false});				  						galleries[81734] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Panoramics","link":"gallery_81734.html","maxRecords":0.0,"photoIDs":[1115702.0,1115703.0,1115704.0,1115706.0,1115708.0,1115709.0,1769457.0,1769464.0,1870829.0,2957306.0,3442233.0,4878568.0,4878572.0,4881452.0,8719737.0],"skipIndex":0,"section_code":"gallery","featured_images":"8719737,4881452,3442233,2957306,1115708","id":81734,"singleSection":false});				  						galleries[81735] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_81735.html","maxRecords":0.0,"photoIDs":[1115699.0,1115934.0,1115935.0,1778564.0,6446105.0],"skipIndex":0,"section_code":"gallery","featured_images":1115699.0,"id":81735,"singleSection":false});				  						galleries[81740] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Landscapes","link":"gallery_81740.html","maxRecords":0.0,"photoIDs":[1115720.0,1115722.0,1115723.0,1115724.0,1115728.0,1115731.0,2853594.0,2853597.0,2855865.0,4878545.0,6903316.0],"skipIndex":0,"section_code":"gallery","featured_images":"4878545,1115723","id":81740,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8719937,8719737,6880891,6255842,5376244,4878545,3442233,2957306,2853597,2853594,1870829,1769464,1769457,1115734,1115723,1115708,1115702,1115694,1115687,1115679';
imageSets[2] = '8719937,8719737,6880891,6255842,5376244,4881452,4878545,3970522,3970518,3442289,3442233,2957306,1115734,1115723,1115708,1115699,1115694,1115679';
imageSets[3] = '8719937,8719737,7866408,7866406,6903316,6880891,6446105,6255842,5792649,5376244,4881452,4878572,4878568,4878545,4045154,3970522,3970518,3442289,3442233,2957306,2855865,2853931,2853597,2853594,1870829,1778564,1769464,1769457,1502228,1502227,1502222,1116086,1115935,1115934,1115745,1115743,1115741,1115738,1115734,1115731,1115728,1115724,1115723,1115722,1115720,1115709,1115708,1115706,1115704,1115703';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/ALANJEVANS/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/ALANJEVANS/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 = 'Alan Evans 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.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 += '<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;
	}
}

			

