window.thumbnails = new Object();
thumbnails[7554886] = new thumbnail(7554886,'395920','Patterdale','Patterdale_edited-1_thumb.jpg',130, 87,21,'photo_7554886.html');
thumbnails[7555206] = new thumbnail(7555206,'395919','Borrowdale','Derwentwater_thumb.jpg',130, 43,21,'photo_7555206.html');
thumbnails[7600912] = new thumbnail(7600912,'395920','Derwentwater','Borrowdale3_clikpic_thumb.jpg',130, 85,21,'photo_7600912.html');
thumbnails[7600955] = new thumbnail(7600955,'395920','Langdale Pikes','Langdale_Pikes_Clikpic1_thumb.jpg',130, 93,21,'photo_7600955.html');
thumbnails[7605557] = new thumbnail(7605557,'395918','Humphrey Head','Humphrey_Head_Trees_Clikpic_thumb.jpg',130, 77,21,'photo_7605557.html');
thumbnails[7605561] = new thumbnail(7605561,'413468','Loch Torridon','Loch_Torridon_Clikpic_thumb.jpg',130, 42,21,'photo_7605561.html');
thumbnails[7605563] = new thumbnail(7605563,'413468','Rannoch Moor','Rannoch_Moor_Clikpic_thumb.jpg',130, 43,21,'photo_7605563.html');
thumbnails[7611868] = new thumbnail(7611868,'395917','Bow wave','bow_wave_clikpic_thumb.jpg',130, 130,21,'photo_7611868.html');
thumbnails[7611873] = new thumbnail(7611873,'395918','Garden gate','9038_garden_door_clikpic_thumb.jpg',130, 124,21,'photo_7611873.html');
thumbnails[7611875] = new thumbnail(7611875,'395918','Piel Castle','Piel_Castle_clikpic_thumb.jpg',130, 73,21,'photo_7611875.html');
thumbnails[7611876] = new thumbnail(7611876,'395918','Stream and icicles','stream_and_icicles_clikpic_thumb.jpg',130, 131,21,'photo_7611876.html');
thumbnails[7611878] = new thumbnail(7611878,'395918','Stream and rocks','stream_and_rocks_clikpic_thumb.jpg',130, 130,21,'photo_7611878.html');
thumbnails[7611897] = new thumbnail(7611897,'395920','Ullswater','Ullswater2_008_thumb.jpg',130, 187,21,'photo_7611897.html');
thumbnails[7611900] = new thumbnail(7611900,'395920','Rydal Water','Rydal_Water_copy_thumb.jpg',130, 83,21,'photo_7611900.html');
thumbnails[7611904] = new thumbnail(7611904,'395920','Aira Force','aira_force_thumb.JPG',130, 195,21,'photo_7611904.html');
thumbnails[7611905] = new thumbnail(7611905,'395920','Ullswater','Boat_Ullswater_thumb.JPG',130, 195,21,'photo_7611905.html');
thumbnails[7611907] = new thumbnail(7611907,'395920','Buttermere','Buttermere_thumb.JPG',130, 87,21,'photo_7611907.html');
thumbnails[7614828] = new thumbnail(7614828,'395917','Loch Katrine','Loch_katrine_thumb.jpg',130, 120,21,'photo_7614828.html');
thumbnails[7614836] = new thumbnail(7614836,'395918','Metal plant','metal_plant_thumb.jpg',130, 130,21,'photo_7614836.html');
thumbnails[7614837] = new thumbnail(7614837,'395918','Stone bench','stone_bench_thumb.jpg',130, 133,21,'photo_7614837.html');
thumbnails[7614870] = new thumbnail(7614870,'395920','Ice floes, Arnside Estuary','Sandside_icebergs_sunset_thumb.jpg',130, 84,21,'photo_7614870.html');
thumbnails[7614976] = new thumbnail(7614976,'395920','Derwentwater Bay','Derwentwater1_thumb.jpg',130, 85,21,'photo_7614976.html');
thumbnails[7614978] = new thumbnail(7614978,'395920','Easdale Tarn','Easdale_Tarn_thumb.jpg',130, 87,21,'photo_7614978.html');
thumbnails[7614994] = new thumbnail(7614994,'395920','Loughrigg Tarn','Loughrigg_Tarn_thumb.jpg',130, 87,21,'photo_7614994.html');
thumbnails[7614997] = new thumbnail(7614997,'395920','Mist','Mist1_thumb.jpg',130, 87,21,'photo_7614997.html');
thumbnails[7614999] = new thumbnail(7614999,'395920','Slater\'s Bridge','Slaters_Bridge_thumb.JPG',130, 195,21,'photo_7614999.html');
thumbnails[7615000] = new thumbnail(7615000,'395920','Striding Edge','Striding_Edge_thumb.JPG',130, 195,21,'photo_7615000.html');
thumbnails[7615017] = new thumbnail(7615017,'395920','Ullswater','Ullswater1_thumb.jpg',130, 95,21,'photo_7615017.html');
thumbnails[7615021] = new thumbnail(7615021,'395920','Wastwater','Wastwater1_thumb.jpg',130, 87,21,'photo_7615021.html');
thumbnails[7615022] = new thumbnail(7615022,'395920','Watendlath','Watendlath_thumb.jpg',130, 86,21,'photo_7615022.html');
thumbnails[7615380] = new thumbnail(7615380,'395920','Patterdale','cattle10003_thumb.jpg',130, 87,21,'photo_7615380.html');
thumbnails[7615388] = new thumbnail(7615388,'395918','Mannequin','9080-1_copy_thumb.jpg',130, 283,21,'photo_7615388.html');
thumbnails[7615399] = new thumbnail(7615399,'395916','East Rongbuk Glacier, Tibet','Landscape-Above_Rongbuk-Graham_Whitwham_thumb.jpg',130, 88,21,'photo_7615399.html');
thumbnails[7618067] = new thumbnail(7618067,'395916','Everest ','5971-317_thumb.jpg',130, 88,21,'photo_7618067.html');
thumbnails[7618069] = new thumbnail(7618069,'395916','Cho Oyo','5971-176_thumb.jpg',130, 86,21,'photo_7618069.html');
thumbnails[7618070] = new thumbnail(7618070,'395916','Everest ','5971-169_thumb.jpg',130, 85,21,'photo_7618070.html');
thumbnails[7618072] = new thumbnail(7618072,'395916','Above Gokyo, Nepal','5971-153_thumb.jpg',130, 85,21,'photo_7618072.html');
thumbnails[7618143] = new thumbnail(7618143,'395916','Machapuchare','5970A-194_thumb.jpg',130, 86,21,'photo_7618143.html');
thumbnails[7618209] = new thumbnail(7618209,'395916','Taj Mahal','Taj_Mahal_clikpic_thumb.jpg',130, 161,21,'photo_7618209.html');
thumbnails[7618212] = new thumbnail(7618212,'395916','Lobuche, Nepal','lobuche_clikpic_thumb.jpg',130, 197,21,'photo_7618212.html');
thumbnails[7618219] = new thumbnail(7618219,'412269','Cloudscape','2003074_thumb.jpg',130, 96,21,'photo_7618219.html');
thumbnails[7618220] = new thumbnail(7618220,'412269','Sunflowers','3059719_thumb.jpg',130, 96,21,'photo_7618220.html');
thumbnails[7618223] = new thumbnail(7618223,'412269','Mist, Lyth Valley','5540109_thumb.jpg',130, 90,21,'photo_7618223.html');
thumbnails[7618224] = new thumbnail(7618224,'412269','Morecambe Bay','5640040_thumb.jpg',130, 90,21,'photo_7618224.html');
thumbnails[7618420] = new thumbnail(7618420,'395919','Morecambe Bay','morecambe_bay0005_thumb.jpg',130, 50,21,'photo_7618420.html');
thumbnails[7618712] = new thumbnail(7618712,'395920','Buttermere','Buttermere_clikpic_thumb.jpg',130, 87,21,'photo_7618712.html');
thumbnails[7618716] = new thumbnail(7618716,'395920','Buttermere pines','Buttermere_Pines_clikpic_thumb.jpg',130, 87,21,'photo_7618716.html');
thumbnails[7618717] = new thumbnail(7618717,'412269','Forest mist','Forest_Mist_clikpic_thumb.jpg',130, 195,21,'photo_7618717.html');
thumbnails[7618719] = new thumbnail(7618719,'395920','Rydal Water','Rydal_Water_clikpic_thumb.jpg',130, 87,21,'photo_7618719.html');
thumbnails[7618720] = new thumbnail(7618720,'412269','Sand ripples','Sand_Ripples_clikpic_thumb.jpg',130, 87,21,'photo_7618720.html');
thumbnails[7618724] = new thumbnail(7618724,'412269','Sunlight on the sea','Sunlight_on_Sea_clikpic_thumb.jpg',130, 195,21,'photo_7618724.html');
thumbnails[7618726] = new thumbnail(7618726,'395920','Sunrise over Ullswater','Sunrise_over_Patterdale_clikpic_thumb.jpg',130, 83,21,'photo_7618726.html');
thumbnails[7618728] = new thumbnail(7618728,'412269','Trees in mist','Trees_in_Mist_clikpic_thumb.jpg',130, 84,21,'photo_7618728.html');
thumbnails[7618730] = new thumbnail(7618730,'395920','Wastwater','Wastwater_clikpic_thumb.jpg',130, 87,21,'photo_7618730.html');
thumbnails[7621914] = new thumbnail(7621914,'413468','Calanais, Harris','Calanais_Harris_clikpic_thumb.jpg',130, 47,21,'photo_7621914.html');
thumbnails[7621920] = new thumbnail(7621920,'413468','North Uist','North_Uist_thumb.jpg',130, 46,21,'photo_7621920.html');
thumbnails[7621923] = new thumbnail(7621923,'413468','Sunset over Rhum','Sunset_Morar_thumb.jpg',130, 43,21,'photo_7621923.html');
thumbnails[7621929] = new thumbnail(7621929,'395919','Helvellyn range','grisedale001_thumb.jpg',130, 42,21,'photo_7621929.html');
thumbnails[7621946] = new thumbnail(7621946,'395920','Little Langdale and the Pikes','Autumn_thumb.jpg',130, 87,21,'photo_7621946.html');
thumbnails[7621950] = new thumbnail(7621950,'395920','Langdale Pikes','Spring2_thumb.jpg',130, 95,21,'photo_7621950.html');
thumbnails[7621952] = new thumbnail(7621952,'395920','Windermere Lake','Summer_thumb.jpg',130, 91,21,'photo_7621952.html');
thumbnails[7621955] = new thumbnail(7621955,'395920','Patterdale','Winter_thumb.jpg',130, 94,21,'photo_7621955.html');
thumbnails[7621979] = new thumbnail(7621979,'395920','Patterdale','Place_Fell_Clikpic_thumb.jpg',130, 82,21,'photo_7621979.html');
thumbnails[7621981] = new thumbnail(7621981,'395918','Slide','Slide_Clikpic__thumb.jpg',130, 130,21,'photo_7621981.html');
thumbnails[7621989] = new thumbnail(7621989,'395916','Glacier, Switzerland','jungfraujoch_clikpic_thumb.jpg',130, 182,21,'photo_7621989.html');
thumbnails[7626113] = new thumbnail(7626113,'395919','Langdale Pikes','Blea_Tarn1185p17_thumb.jpg',130, 41,21,'photo_7626113.html');
thumbnails[7626116] = new thumbnail(7626116,'395919','Blencathra','Blencathra1200p9_thumb.jpg',130, 43,21,'photo_7626116.html');
thumbnails[7626117] = new thumbnail(7626117,'395919','Brotherswater','Brotherswater1390p2_thumb.jpg',130, 44,21,'photo_7626117.html');
thumbnails[7626120] = new thumbnail(7626120,'395919','Buttermere ','Buttermere1540p14_thumb.jpg',130, 44,21,'photo_7626120.html');
thumbnails[7626122] = new thumbnail(7626122,'395919','Castlerigg Stone Circle','Castlerigg_Stone_Circle_thumb.jpg',130, 54,21,'photo_7626122.html');
thumbnails[7626124] = new thumbnail(7626124,'395919','Catbells and Derwentwater','Catbells__Derwentwater2480p201_thumb.jpg',130, 52,21,'photo_7626124.html');
thumbnails[7626127] = new thumbnail(7626127,'395919','Crummockwater','Crummockwater2340p4_thumb.jpg',130, 48,21,'photo_7626127.html');
thumbnails[7626128] = new thumbnail(7626128,'395919','Duddon estuary','Duddon_Estuary2620p38_thumb.jpg',130, 44,21,'photo_7626128.html');
thumbnails[7626130] = new thumbnail(7626130,'395919','Fleetwith Pike','Fleetwith_Pike1540p19_thumb.jpg',130, 43,21,'photo_7626130.html');
thumbnails[7626132] = new thumbnail(7626132,'395919','Skiddaw and Derwentwater','Skiddaw__Derwentwater2480p56_thumb.jpg',130, 46,21,'photo_7626132.html');
thumbnails[7626133] = new thumbnail(7626133,'395919','Upper Eskdale','Upper_Eskdale2860p7_thumb.jpg',130, 42,21,'photo_7626133.html');
thumbnails[7626134] = new thumbnail(7626134,'413468','Loch Tulla','Loch_Tulla1125p3_thumb.jpg',130, 43,21,'photo_7626134.html');
thumbnails[7627681] = new thumbnail(7627681,'413468','Loch Arklet, Trossachs','LochArklet8637p14_thumb.jpg',130, 45,21,'photo_7627681.html');
thumbnails[7627682] = new thumbnail(7627682,'395919','Loweswater','Loweswater5205p4_thumb.jpg',130, 46,21,'photo_7627682.html');
thumbnails[7627683] = new thumbnail(7627683,'413468','Marsco, Skye','Marsco7735p3_thumb.jpg',130, 46,21,'photo_7627683.html');
thumbnails[7627684] = new thumbnail(7627684,'395919','Patterdale','Patterdale6280p36_thumb.jpg',130, 42,21,'photo_7627684.html');
thumbnails[7627688] = new thumbnail(7627688,'413468','Sgurr nan Gillean, Skye','Sgurr_nan_Gillean7735p6_thumb.jpg',130, 53,21,'photo_7627688.html');
thumbnails[7627691] = new thumbnail(7627691,'413468','South Uist and Hecla','South_Uist8702p2098_thumb.jpg',130, 57,21,'photo_7627691.html');
thumbnails[7627693] = new thumbnail(7627693,'413468','Stac Polly','StacPolly8200p6_thumb.jpg',130, 54,21,'photo_7627693.html');
thumbnails[7627694] = new thumbnail(7627694,'395919','Tarn Hows','TarnHows8290p7_thumb.jpg',130, 42,21,'photo_7627694.html');
thumbnails[7627696] = new thumbnail(7627696,'395919','Tewet Tarn','TewetTarn8350p2_thumb.jpg',130, 53,21,'photo_7627696.html');
thumbnails[7627697] = new thumbnail(7627697,'395919','Troutbeck valley','TroutbeckValley8640p11_thumb.jpg',130, 46,21,'photo_7627697.html');
thumbnails[7627699] = new thumbnail(7627699,'395919','Wastwater','Wastwater8815p8_thumb.jpg',130, 49,21,'photo_7627699.html');
thumbnails[7605567] = new thumbnail(7605567,'413467','Twistleton Scar','Twistleton_Scar_Clikpic_thumb.jpg',130, 43,21,'photo_7605567.html');
thumbnails[7626136] = new thumbnail(7626136,'413467','Penyghent','Penyghent2350p10_thumb.jpg',130, 49,21,'photo_7626136.html');
thumbnails[7627680] = new thumbnail(7627680,'413467','Aysgarth Falls','AysgarthFalls8847p10_thumb.jpg',130, 43,21,'photo_7627680.html');
thumbnails[7627701] = new thumbnail(7627701,'413467','Whernside','Whernside8900p10_thumb.jpg',130, 53,21,'photo_7627701.html');
thumbnails[7627686] = new thumbnail(7627686,'413467','Ribblehead viaduct','RibbleheadViaduct9060p6_thumb.jpg',130, 53,21,'photo_7627686.html');
thumbnails[7618464] = new thumbnail(7618464,'413468','Luskentyre, Harris','Beach_sand_ripples_clikpic_thumb.jpg',130, 317,21,'photo_7618464.html');
thumbnails[7621921] = new thumbnail(7621921,'413468','Sound of Taransay, Harris','Sound_of_Taransay_clikpic_thumb.jpg',130, 369,21,'photo_7621921.html');
thumbnails[7605560] = new thumbnail(7605560,'413468','Glen Etive','Glen_Etive_Clikpic_thumb.jpg',130, 378,21,'photo_7605560.html');
thumbnails[7605565] = new thumbnail(7605565,'413467','Hardraw Force','Hardraw_Force_Clikpic_thumb.jpg',130, 397,21,'photo_7605565.html');
thumbnails[7618722] = new thumbnail(7618722,'395919','Scale Force','Scale_Force_clikpic_thumb.jpg',130, 356,21,'photo_7618722.html');
thumbnails[7605553] = new thumbnail(7605553,'395919','Duddon Valley','Duddon_Valley_ClikpicWeb_thumb.jpg',130, 331,21,'photo_7605553.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[395920] = new gallery(395920,'7621979,7621955,7621952,7621950,7621946,7618730,7618726,7618719,7618716,7618712','Lakes General','gallery',[7554886,7600912,7600955,7611897,7611900,7611904,7611905,7611907,7614870,7614976,7614978,7614994,7614997,7614999,7615000,7615017,7615021,7615022,7615380,7618712,7618716,7618719,7618726,7618730,7621946,7621950,7621952,7621955,7621979],0, 0, '392965', 'gallery_395920.html',0,0);
galleries[395919] = new gallery(395919,'7627699,7627697,7627696,7627694,7627684,7627682,7626133,7626132,7626130,7626128','Lakes Panoramic','gallery',[7555206,7618420,7621929,7626113,7626116,7626117,7626120,7626122,7626124,7626127,7626128,7626130,7626132,7626133,7627682,7627684,7627694,7627696,7627697,7627699,7618722,7605553],0, 0, '392965', 'gallery_395919.html',0,0);
galleries[392965] = new gallery(392965,'7627699,7627697,7627696,7627694,7627684,7627682,7626133,7626132,7626130,7626128','Lake District','gallery',[],0, 0, '', 'gallery_392965.html',0,0);
galleries[413467] = new gallery(413467,'7627701,7627686,7627680,7626136,7605567,7605565','Yorkshire Dales','gallery',[7605567,7626136,7627680,7627701,7627686,7605565],0, 0, '', 'gallery_413467.html',0,0);
galleries[413468] = new gallery(413468,'7627693,7627691,7627688,7627683,7627681,7626134,7621923,7621921,7621920,7621914','Scotland ','gallery',[7605561,7605563,7621914,7621920,7621923,7626134,7627681,7627683,7627688,7627691,7627693,7618464,7621921,7605560],0, 0, '', 'gallery_413468.html',0,0);
galleries[395916] = new gallery(395916,'7621989,7618212,7618209,7618143,7618072,7618070,7618069,7618067,7615399','Travel','gallery',[7615399,7618067,7618069,7618070,7618072,7618143,7618209,7618212,7621989],0, 0, '', 'gallery_395916.html',0,0);
galleries[412269] = new gallery(412269,'7618728,7618724,7618720,7618717,7618224,7618223,7618220,7618219','Other','gallery',[7618219,7618220,7618223,7618224,7618717,7618720,7618724,7618728],0, 0, '', 'gallery_412269.html',0,0);
galleries[395917] = new gallery(395917,'7614828,7611868','Black and White','gallery',[7611868,7614828],0, 0, '', 'gallery_395917.html',0,0);
galleries[395918] = new gallery(395918,'7621981,7615388,7614837,7614836,7611878,7611876,7611875,7611873,7605557','Pinhole','gallery',[7605557,7611873,7611875,7611876,7611878,7614836,7614837,7615388,7621981],0, 0, '', 'gallery_395918.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[3] = '7627701,7627699,7627697,7627696,7627694,7627693,7627691,7627688,7627686,7627684,7627683,7627682,7627681,7627680,7626136,7626134,7626133,7626132,7626130,7626128,7626127,7626124,7626122,7626120,7626117,7626116,7626113,7621989,7621981,7621979,7621955,7621952,7621950,7621946,7621929,7621923,7621921,7621920,7621914,7618730,7618728,7618726,7618724,7618722,7618720,7618719,7618717,7618716,7618712,7618464';
imageSets[1] = '7621955,7600955';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/ebony45s/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/ebony45s/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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
				  document.title = 'allscape: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
			
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
						temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = 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({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

