window.thumbnails = {};
															thumbnails[3739008] = clik.newPhoto({"id":3739008,"src":"lucy_postcard_back_300_medium_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":88});
															thumbnails[3739428] = clik.newPhoto({"id":3739428,"src":"Happy_Sheep_Designs_logo_final_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":53});
															thumbnails[3714911] = clik.newPhoto({"id":3714911,"src":"JMP10584_bids_paradise_P_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":195});
															thumbnails[3714912] = clik.newPhoto({"id":3714912,"src":"JMP10255_pumpkin_arrangement_closer_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":90});
															thumbnails[3714908] = clik.newPhoto({"id":3714908,"src":"JMP_MG_9410_the_feathers_arrangement_close_P_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":195});
															thumbnails[3714910] = clik.newPhoto({"id":3714910,"src":"JMP_MG_9419_town_hall_hands_cutting_stems_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"","height":87});
															thumbnails[3715151] = clik.newPhoto({"id":3715151,"src":"JMP_MG_2192_sheep_horizon_CJ1_thumb.jpg","galleries_id":436977,"server_id":15,"link":"photo_3715151.html","width":130,"caption":"Sunrise Sheep","height":87});
															thumbnails[3715152] = clik.newPhoto({"id":3715152,"src":"JMP_MG_0135_alpaca_head_P_thumb.jpg","galleries_id":436977,"server_id":15,"link":"photo_3715152.html","width":130,"caption":"Alpaca","height":195});
															thumbnails[3715160] = clik.newPhoto({"id":3715160,"src":"JMP_MG_1704_turf_piles_mweelrea_L_fee_P_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_3715160.html","width":130,"caption":"Mweelrea Turf","height":195});
															thumbnails[3715208] = clik.newPhoto({"id":3715208,"src":"JMP_MG_8010_glassilaun_beach_levels_thumb.jpg","galleries_id":436975,"server_id":15,"link":"photo_3715208.html","width":130,"caption":"Blue Beach","height":87});
															thumbnails[3715214] = clik.newPhoto({"id":3715214,"src":"JMP_MG_1007_mandolin_strings_fret_soundboard_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_3715214.html","width":130,"caption":"Mary's Mandolin","height":87});
															thumbnails[3715221] = clik.newPhoto({"id":3715221,"src":"JMP_MG_1332_bernaderg_bay_boat_reflection_thumb.jpg","galleries_id":436979,"server_id":15,"link":"photo_3715221.html","width":130,"caption":"Tully Boat","height":87});
															thumbnails[3715224] = clik.newPhoto({"id":3715224,"src":"JMP_MG_1559_blue_rope_P_thumb.jpg","galleries_id":436975,"server_id":15,"link":"photo_3715224.html","width":130,"caption":"Blue Rope","height":195});
															thumbnails[3715227] = clik.newPhoto({"id":3715227,"src":"JMPIMG_4704_pebbles_slow_water_thumb.jpg","galleries_id":436975,"server_id":15,"link":"photo_3715227.html","width":130,"caption":"Smooth Rocks","height":87});
															thumbnails[3715267] = clik.newPhoto({"id":3715267,"src":"JMP_MG_6336_renvyle_rock_splash_big_crop_thumb.jpg","galleries_id":436975,"server_id":15,"link":"photo_3715267.html","width":130,"caption":"Wild Sea","height":82});
															thumbnails[3715276] = clik.newPhoto({"id":3715276,"src":"JMP9414_driftwood_boat_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_3715276.html","width":130,"caption":"Driftwood Boat","height":87});
															thumbnails[3715277] = clik.newPhoto({"id":3715277,"src":"JMP9605_3_rocks_P_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_3715277.html","width":130,"caption":"Rockpile","height":195});
															thumbnails[3715280] = clik.newPhoto({"id":3715280,"src":"bluebells_path_stump_P_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_3715280.html","width":130,"caption":"Bluebells","height":195});
															thumbnails[3715287] = clik.newPhoto({"id":3715287,"src":"JMPIMG_4347_tree_mountain_sky_P_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_3715287.html","width":130,"caption":"Renvyle Tree","height":195});
															thumbnails[3715342] = clik.newPhoto({"id":3715342,"src":"JMP201_gerbera_3_colours_SB_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_3715342.html","width":130,"caption":"3 Gerberas","height":87});
															thumbnails[3715343] = clik.newPhoto({"id":3715343,"src":"JMP208_gerbera_4_colours_SB_P_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_3715343.html","width":130,"caption":"4 Gerberas","height":195});
															thumbnails[3715345] = clik.newPhoto({"id":3715345,"src":"JMP003_pink_white_tulip_water_2_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_3715345.html","width":130,"caption":"Tulip Water","height":87});
															thumbnails[3715346] = clik.newPhoto({"id":3715346,"src":"JMP001_pink_white_tulip_leaf_rf_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_3715346.html","width":130,"caption":"Tulip Leaf","height":87});
															thumbnails[3715360] = clik.newPhoto({"id":3715360,"src":"JMP163_tulip_red_close_petals_BW_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_3715360.html","width":130,"caption":"Tulips B&W","height":87});
															thumbnails[3715363] = clik.newPhoto({"id":3715363,"src":"JMP031_foxglove_and_bee_flying_P_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_3715363.html","width":130,"caption":"Foxglove Bee","height":173});
															thumbnails[4795601] = clik.newPhoto({"id":4795601,"src":"JMP3711_surfer_thumb.jpg","galleries_id":436975,"server_id":15,"link":"photo_4795601.html","width":130,"caption":"Wild Surf","height":87});
															thumbnails[4795919] = clik.newPhoto({"id":4795919,"src":"JMP0713_cleggan_view_horse_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_4795919.html","width":130,"caption":"Cleggan Pony","height":87});
															thumbnails[4795921] = clik.newPhoto({"id":4795921,"src":"JMP11125_cow_P_BW_thumb.jpg","galleries_id":436977,"server_id":15,"link":"photo_4795921.html","width":130,"caption":"Munching Cow","height":195});
															thumbnails[4795924] = clik.newPhoto({"id":4795924,"src":"JMP12804_red_panda_tongue_thumb.jpg","galleries_id":436977,"server_id":15,"link":"photo_4795924.html","width":130,"caption":"Red Panda","height":87});
															thumbnails[4795936] = clik.newPhoto({"id":4795936,"src":"JMP002_pink_white_tulip_lf1_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4795936.html","width":130,"caption":"Pink-White Tulip","height":87});
															thumbnails[4795946] = clik.newPhoto({"id":4795946,"src":"JMP10664_white_amaryllis_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4795946.html","width":130,"caption":"Amaryllis","height":87});
															thumbnails[4795948] = clik.newPhoto({"id":4795948,"src":"JMP_prunus_square_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4795948.html","width":130,"caption":"Prunus Square","height":121});
															thumbnails[4795950] = clik.newPhoto({"id":4795950,"src":"JMP3554_tulip_BW_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4795950.html","width":130,"caption":"B&W Tulip","height":87});
															thumbnails[4795951] = clik.newPhoto({"id":4795951,"src":"JMP078_iris_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4795951.html","width":130,"caption":"Iris Square","height":119});
															thumbnails[4795952] = clik.newPhoto({"id":4795952,"src":"JMP_rose_pink_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4795952.html","width":130,"caption":"Roses Square","height":114});
															thumbnails[4795955] = clik.newPhoto({"id":4795955,"src":"JMP_tulips_red_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4795955.html","width":130,"caption":"Red Tulips Square","height":109});
															thumbnails[4795956] = clik.newPhoto({"id":4795956,"src":"JMP9729_white_rose_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4795956.html","width":130,"caption":"White Rose Square","height":124});
															thumbnails[4796002] = clik.newPhoto({"id":4796002,"src":"JMP5488_sunset_Tully_Lough_thumb.jpg","galleries_id":436979,"server_id":15,"link":"photo_4796002.html","width":130,"caption":"Irish Sunset","height":87});
															thumbnails[4796003] = clik.newPhoto({"id":4796003,"src":"JMP4874_boat_ballynakill_P_thumb.jpg","galleries_id":436979,"server_id":15,"link":"photo_4796003.html","width":130,"caption":"Ballynakil Boat","height":195});
															thumbnails[4796004] = clik.newPhoto({"id":4796004,"src":"JMP5127_rosmuc_rock_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_4796004.html","width":130,"caption":"Rosmuc Rock","height":87});
															thumbnails[4796007] = clik.newPhoto({"id":4796007,"src":"JMP10443_autumn_sheep_P_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_4796007.html","width":130,"caption":"Sheep Trees","height":195});
															thumbnails[4796038] = clik.newPhoto({"id":4796038,"src":"JMP2510_smarties_close_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_4796038.html","width":130,"caption":"Smarties","height":87});
															thumbnails[4796044] = clik.newPhoto({"id":4796044,"src":"JMP047_balloons_nokia_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_4796044.html","width":130,"caption":"Balloon","height":87});
															thumbnails[4796046] = clik.newPhoto({"id":4796046,"src":"JMP1085_rock_face_close_P_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_4796046.html","width":130,"caption":"Rock Face","height":195});
															thumbnails[4796050] = clik.newPhoto({"id":4796050,"src":"JMP12431_cyclist_porthcawl_beach_thumb.jpg","galleries_id":436975,"server_id":15,"link":"photo_4796050.html","width":130,"caption":"Beach Bike","height":57});
															thumbnails[4921079] = clik.newPhoto({"id":4921079,"src":"JMP3848_sunrise_tree_close_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_4921079.html","width":130,"caption":"Red Sunrise","height":87});
															thumbnails[4934874] = clik.newPhoto({"id":4934874,"src":"JMP402-5909_sunflowers_P_thumb.jpg","galleries_id":436976,"server_id":15,"link":"photo_4934874.html","width":130,"caption":"Sunflower","height":195});
															thumbnails[5978071] = clik.newPhoto({"id":5978071,"src":"JMP4441_boat_trees_kylemore_P_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_5978071.html","width":130,"caption":"Kylemore Boat","height":195});
															thumbnails[5978104] = clik.newPhoto({"id":5978104,"src":"JMP5534_baseball_boot_close_Crop_BW_P_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_5978104.html","width":130,"caption":"Bootlaces","height":161});
															thumbnails[6385476] = clik.newPhoto({"id":6385476,"src":"JMP_8098_barred_window_crop_P_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_6385476.html","width":130,"caption":"Roman Blind","height":132});
															thumbnails[6385486] = clik.newPhoto({"id":6385486,"src":"JMP_8652_stone_tub_s_m_d_angeli_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_6385486.html","width":130,"caption":"Roman Bath","height":87});
															thumbnails[6385504] = clik.newPhoto({"id":6385504,"src":"JMP9689_plasticine_horizontal_square_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_6385504.html","width":130,"caption":"Rainbow Square","height":119});
															thumbnails[7341561] = clik.newPhoto({"id":7341561,"src":"JMP_7989_topiary_vatican_P_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_7341561.html","width":130,"caption":"Roman Pot","height":195});
															thumbnails[7341573] = clik.newPhoto({"id":7341573,"src":"JMP402-5973_ty_canol_wood_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_7341573.html","width":130,"caption":"Ty Canol","height":87});
															thumbnails[7341599] = clik.newPhoto({"id":7341599,"src":"JMP_MG_4019_swan_reflection_crop_P_thumb.jpg","galleries_id":436977,"server_id":15,"link":"photo_7341599.html","width":130,"caption":"Swan Lake","height":165});
															thumbnails[7341649] = clik.newPhoto({"id":7341649,"src":"JMP_MG_8465_four_pins_lough_nascodery_east_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_7341649.html","width":130,"caption":"Twelve Pins","height":87});
															thumbnails[7341671] = clik.newPhoto({"id":7341671,"src":"JMP037_three_sheep_cloud_sky_P_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_7341671.html","width":130,"caption":"Sheep Clouds","height":204});
															thumbnails[7341848] = clik.newPhoto({"id":7341848,"src":"JMP086_snowtrees1_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_7341848.html","width":130,"caption":"Snowtrees","height":86});
															thumbnails[7341855] = clik.newPhoto({"id":7341855,"src":"JMP065_pavilion_gardens_bandstand_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_7341855.html","width":130,"caption":"Buxton Bandstand","height":87});
															thumbnails[7341860] = clik.newPhoto({"id":7341860,"src":"JMP402-5607_triumph_wheel_P_thumb.jpg","galleries_id":436973,"server_id":15,"link":"photo_7341860.html","width":130,"caption":"Wheel","height":195});
															thumbnails[7344028] = clik.newPhoto({"id":7344028,"src":"JMP_2010_7245_frosty_trees_Holton_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_7344028.html","width":130,"caption":"Frosty Trees","height":87});
															thumbnails[7344098] = clik.newPhoto({"id":7344098,"src":"JMP_2010_9422_pony_field_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_7344098.html","width":130,"caption":"Pony Paddock","height":87});
															thumbnails[7344104] = clik.newPhoto({"id":7344104,"src":"JMP_MG_4775_sheep_on_rock_marconi_site_thumb.jpg","galleries_id":436977,"server_id":15,"link":"photo_7344104.html","width":130,"caption":"Sheep Rock","height":87});
															thumbnails[7344114] = clik.newPhoto({"id":7344114,"src":"JMP_MG_4834_boat_reflection_crop_P_thumb.jpg","galleries_id":436975,"server_id":15,"link":"photo_7344114.html","width":130,"caption":"Mill Pond","height":177});
															thumbnails[7344266] = clik.newPhoto({"id":7344266,"src":"JMP_MG_5448_diamond_hill_sky_moon_thumb.jpg","galleries_id":436972,"server_id":15,"link":"photo_7344266.html","width":130,"caption":"Diamond Moon","height":87});
															thumbnails[7344315] = clik.newPhoto({"id":7344315,"src":"JMP_MG_7979_boat_water_CJ_roisin_dubh1_thumb.jpg","galleries_id":436979,"server_id":15,"link":"photo_7344315.html","width":130,"caption":"Calm Water","height":86});
															thumbnails[7344321] = clik.newPhoto({"id":7344321,"src":"JMP_MG_8284_anchor_beach_snow_mountain_thumb.jpg","galleries_id":436975,"server_id":15,"link":"photo_7344321.html","width":130,"caption":"Anchor Beach","height":90});
															thumbnails[8215427] = clik.newPhoto({"id":8215427,"src":"JMP_2009_MG_3456_bucket_spade_crop_P_thumb.jpg","galleries_id":436973,"server_id":35,"link":"photo_8215427.html","width":130,"caption":"","height":170});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[436977] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Fauna","link":"section523858_436977.html","maxRecords":0.0,"photoIDs":[3715151.0,3715152.0,4795921.0,4795924.0,7341599.0,7344104.0],"skipIndex":0,"section_code":"section523858","featured_images":3715152.0,"id":436977,"singleSection":false});				  						galleries[436976] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Flora","link":"section523858_436976.html","maxRecords":0.0,"photoIDs":[3715342.0,3715343.0,3715345.0,3715346.0,3715360.0,3715363.0,4795936.0,4795946.0,4795948.0,4795950.0,4795951.0,4795952.0,4795955.0,4795956.0,4934874.0],"skipIndex":0,"section_code":"section523858","featured_images":4795950.0,"id":436976,"singleSection":false});				  						galleries[436972] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Land","link":"section523858_436972.html","maxRecords":0.0,"photoIDs":[3715160.0,3715276.0,3715280.0,3715287.0,4795919.0,4796004.0,4796007.0,4921079.0,5978071.0,6385486.0,7341561.0,7341573.0,7341649.0,7341848.0,7341855.0,7344028.0,7344098.0,7344266.0],"skipIndex":0,"section_code":"section523858","featured_images":"6385486,5978071,3715280","id":436972,"singleSection":false});				  						galleries[436973] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Quirky","link":"section523858_436973.html","maxRecords":0.0,"photoIDs":[3715214.0,3715277.0,4796038.0,4796044.0,4796046.0,5978104.0,6385476.0,6385504.0,7341671.0,7341860.0,8215427.0],"skipIndex":0,"section_code":"section523858","featured_images":6385504.0,"id":436973,"singleSection":false});				  						galleries[436975] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Sea","link":"section523858_436975.html","maxRecords":0.0,"photoIDs":[3715208.0,3715224.0,3715227.0,3715267.0,4795601.0,4796050.0,7344114.0,7344321.0],"skipIndex":0,"section_code":"section523858","featured_images":3715267.0,"id":436975,"singleSection":false});				  						galleries[436979] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Water","link":"section523858_436979.html","maxRecords":0.0,"photoIDs":[3715221.0,4796002.0,4796003.0,7344315.0],"skipIndex":0,"section_code":"section523858","featured_images":"7344315,4796003,4796002,3715221","id":436979,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7344098,5978071,4796003,4795950,3739428,3715345,3715343,3715280,3715267,3715221,3715152,3715151';
imageSets[2] = '6385504,6385486,5978071,4795950,3715280,3715267,3715152,3714910';
imageSets[3] = '3739428,3739008';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rokemage/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rokemage/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rokemage/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rokemage/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/rokemage/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rokemage/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/rokemage/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 += 'section523858.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 && 'section523858' != '') {
					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 = 'Happy Sheep Designs - photography & more: ' + 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>';
	}
				
	temp += this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
		 									temp += '<select class="paymentlink" name="payment_options_id" onchange="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		temp += '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
		
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
											temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="ROKEMAGE">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to cart</div>';
			temp += '</div>';
			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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

