window.thumbnails = {};
															thumbnails[5757397] = clik.newPhoto({"id":5757397,"src":"Silk-Mill_5E12FA7A-24E8-5EC4-4F5A61472AB30911_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[6725883] = clik.newPhoto({"id":6725883,"src":"kedlestone_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5761967] = clik.newPhoto({"id":5761967,"src":"quad_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5766042] = clik.newPhoto({"id":5766042,"src":"swing-bridge_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5760803] = clik.newPhoto({"id":5760803,"src":"council-4b_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5766576] = clik.newPhoto({"id":5766576,"src":"cathedral4_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":87});
															thumbnails[5757964] = clik.newPhoto({"id":5757964,"src":"eiffel-tower_thumb.jpg","galleries_id":"","server_id":32,"link":"#","width":130,"caption":"","height":195});
															thumbnails[6857156] = clik.newPhoto({"id":6857156,"src":"quad_8185A762-1D09-001F-991EDA53C532DDAB_thumb.jpg","galleries_id":372256,"server_id":32,"link":"photo_6857156.html","width":130,"caption":"","height":87});
															thumbnails[6857160] = clik.newPhoto({"id":6857160,"src":"Silk-Mill_8186B9FA-1D09-001F-992EF4D3C93620B3_thumb.jpg","galleries_id":372256,"server_id":32,"link":"photo_6857160.html","width":130,"caption":"","height":87});
															thumbnails[6857165] = clik.newPhoto({"id":6857165,"src":"kedlestone_8187C9D4-1D09-001F-992BD40C9773E39E_thumb.jpg","galleries_id":372263,"server_id":32,"link":"photo_6857165.html","width":130,"caption":"","height":87});
															thumbnails[6857214] = clik.newPhoto({"id":6857214,"src":"eiffel-tower_8199D0D2-1D09-001F-99E0038DD38EA335_thumb.jpg","galleries_id":372256,"server_id":32,"link":"photo_6857214.html","width":130,"caption":"","height":195});
															thumbnails[6857288] = clik.newPhoto({"id":6857288,"src":"swing-bridge_81AAE570-1D09-001F-992636716D84F78E_thumb.jpg","galleries_id":372256,"server_id":32,"link":"photo_6857288.html","width":130,"caption":"","height":87});
															thumbnails[6857302] = clik.newPhoto({"id":6857302,"src":"council-house_thumb.jpg","galleries_id":372256,"server_id":32,"link":"photo_6857302.html","width":130,"caption":"","height":87});
															thumbnails[6864885] = clik.newPhoto({"id":6864885,"src":"tower-small_thumb.jpg","galleries_id":372256,"server_id":32,"link":"photo_6864885.html","width":130,"caption":"","height":87});
															thumbnails[6725891] = clik.newPhoto({"id":6725891,"src":"chatsworth1_thumb.jpg","galleries_id":372263,"server_id":32,"link":"photo_6725891.html","width":130,"caption":"","height":87});
															thumbnails[6725938] = clik.newPhoto({"id":6725938,"src":"wingfield_thumb.jpg","galleries_id":372263,"server_id":32,"link":"photo_6725938.html","width":130,"caption":"","height":87});
															thumbnails[6725918] = clik.newPhoto({"id":6725918,"src":"denby-pottery_thumb.jpg","galleries_id":372263,"server_id":32,"link":"photo_6725918.html","width":130,"caption":"","height":87});
															thumbnails[6725935] = clik.newPhoto({"id":6725935,"src":"ognaston-res_thumb.jpg","galleries_id":372263,"server_id":32,"link":"photo_6725935.html","width":130,"caption":"","height":87});
															thumbnails[6962260] = clik.newPhoto({"id":6962260,"src":"wine-glass-chair_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962260.html","width":130,"caption":"","height":195});
															thumbnails[6962302] = clik.newPhoto({"id":6962302,"src":"buns1_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962302.html","width":130,"caption":"","height":195});
															thumbnails[6962320] = clik.newPhoto({"id":6962320,"src":"chair-back_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962320.html","width":130,"caption":"","height":195});
															thumbnails[6962332] = clik.newPhoto({"id":6962332,"src":"table-edge_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962332.html","width":130,"caption":"","height":195});
															thumbnails[6962341] = clik.newPhoto({"id":6962341,"src":"seat-view_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962341.html","width":130,"caption":"","height":195});
															thumbnails[6962361] = clik.newPhoto({"id":6962361,"src":"fish-cake_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962361.html","width":130,"caption":"","height":130});
															thumbnails[6962454] = clik.newPhoto({"id":6962454,"src":"chickwings2_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962454.html","width":130,"caption":"","height":130});
															thumbnails[6962475] = clik.newPhoto({"id":6962475,"src":"bellypork_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962475.html","width":130,"caption":"","height":130});
															thumbnails[6962491] = clik.newPhoto({"id":6962491,"src":"choc-brownie_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962491.html","width":130,"caption":"","height":130});
															thumbnails[6962590] = clik.newPhoto({"id":6962590,"src":"logs2_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962590.html","width":130,"caption":"","height":87});
															thumbnails[6962558] = clik.newPhoto({"id":6962558,"src":"table-leg_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962558.html","width":130,"caption":"","height":87});
															thumbnails[6962611] = clik.newPhoto({"id":6962611,"src":"yellow-flower_thumb.jpg","galleries_id":377403,"server_id":32,"link":"photo_6962611.html","width":130,"caption":"","height":87});
															thumbnails[3499684] = clik.newPhoto({"id":3499684,"src":"blueice_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_3499684.html","width":130,"caption":"","height":87});
															thumbnails[3521469] = clik.newPhoto({"id":3521469,"src":"seasun_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_3521469.html","width":130,"caption":"","height":87});
															thumbnails[3594817] = clik.newPhoto({"id":3594817,"src":"Fields_of_Green_thumb.jpg","galleries_id":252881,"server_id":32,"link":"photo_3594817.html","width":130,"caption":"Fields of Green","height":65});
															thumbnails[3634578] = clik.newPhoto({"id":3634578,"src":"seawood1_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_3634578.html","width":130,"caption":"","height":87});
															thumbnails[3634588] = clik.newPhoto({"id":3634588,"src":"2beach_rocks_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_3634588.html","width":130,"caption":"","height":87});
															thumbnails[4306806] = clik.newPhoto({"id":4306806,"src":"murmuring-rocks2_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_4306806.html","width":130,"caption":"","height":87});
															thumbnails[5721178] = clik.newPhoto({"id":5721178,"src":"cards-displayed_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_5721178.html","width":130,"caption":"","height":87});
															thumbnails[5757971] = clik.newPhoto({"id":5757971,"src":"eiffel-tower1_thumb.jpg","galleries_id":326255,"server_id":32,"link":"photo_5757971.html","width":130,"caption":"","height":195});
															thumbnails[3420224] = clik.newPhoto({"id":3420224,"src":"2pines1_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_3420224.html","width":130,"caption":"","height":87});
															thumbnails[4283031] = clik.newPhoto({"id":4283031,"src":"Twisted-Twilight_thumb.jpg","galleries_id":252879,"server_id":32,"link":"photo_4283031.html","width":130,"caption":"","height":87});
															thumbnails[5777555] = clik.newPhoto({"id":5777555,"src":"IMG_1544_thumb.jpg","galleries_id":252879,"server_id":32,"link":"photo_5777555.html","width":130,"caption":"","height":195});
															thumbnails[3420203] = clik.newPhoto({"id":3420203,"src":"boat2_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_3420203.html","width":130,"caption":"","height":87});
															thumbnails[3420150] = clik.newPhoto({"id":3420150,"src":"red-black_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_3420150.html","width":130,"caption":"","height":87});
															thumbnails[3420153] = clik.newPhoto({"id":3420153,"src":"felley-woods_thumb.jpg","galleries_id":252881,"server_id":32,"link":"photo_3420153.html","width":130,"caption":"","height":87});
															thumbnails[3420110] = clik.newPhoto({"id":3420110,"src":"felley-wood-21_thumb.jpg","galleries_id":252881,"server_id":32,"link":"photo_3420110.html","width":130,"caption":"","height":87});
															thumbnails[3376484] = clik.newPhoto({"id":3376484,"src":"sundance_thumb.jpg","galleries_id":252881,"server_id":32,"link":"photo_3376484.html","width":130,"caption":"","height":87});
															thumbnails[4306970] = clik.newPhoto({"id":4306970,"src":"pebles_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_4306970.html","width":130,"caption":"","height":92});
															thumbnails[3405703] = clik.newPhoto({"id":3405703,"src":"beachscape1_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_3405703.html","width":130,"caption":"","height":65});
															thumbnails[3521560] = clik.newPhoto({"id":3521560,"src":"seawood_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_3521560.html","width":130,"caption":"","height":195});
															thumbnails[3413595] = clik.newPhoto({"id":3413595,"src":"triangle_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_3413595.html","width":130,"caption":"","height":195});
															thumbnails[5777377] = clik.newPhoto({"id":5777377,"src":"seaweed_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_5777377.html","width":130,"caption":"","height":195});
															thumbnails[5726817] = clik.newPhoto({"id":5726817,"src":"osbournes-pond_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_5726817.html","width":130,"caption":"","height":87});
															thumbnails[5778145] = clik.newPhoto({"id":5778145,"src":"silkywater_thumb.jpg","galleries_id":252879,"server_id":32,"link":"photo_5778145.html","width":130,"caption":"","height":195});
															thumbnails[5720504] = clik.newPhoto({"id":5720504,"src":"Heavens-Above_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_5720504.html","width":130,"caption":"","height":87});
															thumbnails[6028119] = clik.newPhoto({"id":6028119,"src":"bluebells2_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_6028119.html","width":130,"caption":"","height":87});
															thumbnails[5726639] = clik.newPhoto({"id":5726639,"src":"snow-tree_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_5726639.html","width":130,"caption":"","height":87});
															thumbnails[5743425] = clik.newPhoto({"id":5743425,"src":"mistyfy_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_5743425.html","width":130,"caption":"","height":87});
															thumbnails[3499622] = clik.newPhoto({"id":3499622,"src":"oxtonsky_thumb.jpg","galleries_id":252881,"server_id":32,"link":"photo_3499622.html","width":130,"caption":"","height":87});
															thumbnails[4306672] = clik.newPhoto({"id":4306672,"src":"Edge-of-Serenity_thumb.jpg","galleries_id":252878,"server_id":32,"link":"photo_4306672.html","width":130,"caption":"","height":195});
															thumbnails[4306612] = clik.newPhoto({"id":4306612,"src":"Crack-in-Ocean1a_thumb.jpg","galleries_id":252879,"server_id":32,"link":"photo_4306612.html","width":130,"caption":"","height":195});
															thumbnails[4357320] = clik.newPhoto({"id":4357320,"src":"Coral-Sphere_thumb.jpg","galleries_id":252879,"server_id":32,"link":"photo_4357320.html","width":130,"caption":"","height":195});
															thumbnails[5587618] = clik.newPhoto({"id":5587618,"src":"hathersage_moor1_thumb.jpg","galleries_id":252880,"server_id":32,"link":"photo_5587618.html","width":130,"caption":"","height":195});
															thumbnails[5587607] = clik.newPhoto({"id":5587607,"src":"blackrock1_thumb.jpg","galleries_id":252880,"server_id":32,"link":"photo_5587607.html","width":130,"caption":"","height":195});
															thumbnails[5778825] = clik.newPhoto({"id":5778825,"src":"On--Reflection_thumb.jpg","galleries_id":252880,"server_id":32,"link":"photo_5778825.html","width":130,"caption":"","height":195});
															thumbnails[5587643] = clik.newPhoto({"id":5587643,"src":"loscoe_dam_thumb.jpg","galleries_id":252880,"server_id":32,"link":"photo_5587643.html","width":130,"caption":"","height":87});
															thumbnails[5587818] = clik.newPhoto({"id":5587818,"src":"over-heanor_thumb.jpg","galleries_id":252880,"server_id":32,"link":"photo_5587818.html","width":130,"caption":"","height":87});
															thumbnails[5588406] = clik.newPhoto({"id":5588406,"src":"eaton_bank_thumb.jpg","galleries_id":252880,"server_id":32,"link":"photo_5588406.html","width":130,"caption":"","height":87});
															thumbnails[5757190] = clik.newPhoto({"id":5757190,"src":"Silk-Mill_thumb.jpg","galleries_id":252880,"server_id":32,"link":"photo_5757190.html","width":130,"caption":"","height":87});
															thumbnails[5956048] = clik.newPhoto({"id":5956048,"src":"heavens2_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_5956048.html","width":130,"caption":"","height":195});
															thumbnails[6027431] = clik.newPhoto({"id":6027431,"src":"golden-Gate3_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_6027431.html","width":130,"caption":"","height":195});
															thumbnails[6027604] = clik.newPhoto({"id":6027604,"src":"Blown-Away6_thumb.jpg","galleries_id":195326,"server_id":32,"link":"photo_6027604.html","width":130,"caption":"","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[372263] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Aerial Photography","link":"section391151_372263.html","maxRecords":0.0,"photoIDs":[6857165.0,6725891.0,6725938.0,6725918.0,6725935.0],"skipIndex":0,"section_code":"section391151","featured_images":"6857165,6725938,6725935,6725918,6725891","id":372263,"singleSection":false});				  						galleries[372256] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Architectural ","link":"section391151_372256.html","maxRecords":0.0,"photoIDs":[6857156.0,6857160.0,6857214.0,6857288.0,6857302.0,6864885.0],"skipIndex":0,"section_code":"section391151","featured_images":"6864885,6857302,6857288,6857214,6857160,6857156","id":372256,"singleSection":false});				  						galleries[252879] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Caribbean","link":"gallery_252879.html","maxRecords":0.0,"photoIDs":[4283031.0,5777555.0,5778145.0,4306612.0,4357320.0],"skipIndex":0,"section_code":"gallery","featured_images":"5778145,5777555,4357320,4306612,4283031","id":252879,"singleSection":false});				  						galleries[377403] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Creative Photography.","link":"section391151_377403.html","maxRecords":0.0,"photoIDs":[6962260.0,6962302.0,6962320.0,6962332.0,6962341.0,6962361.0,6962454.0,6962475.0,6962491.0,6962590.0,6962558.0,6962611.0],"skipIndex":0,"section_code":"section391151","featured_images":6962361.0,"id":377403,"singleSection":false});				  						galleries[252880] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Derbyshire","link":"gallery_252880.html","maxRecords":0.0,"photoIDs":[5587618.0,5587607.0,5778825.0,5587643.0,5587818.0,5588406.0,5757190.0],"skipIndex":0,"section_code":"gallery","featured_images":"5778825,5757190,5588406,5587818,5587643,5587618,5587607","id":252880,"singleSection":false});				  						galleries[326255] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"France","link":"gallery_326255.html","maxRecords":0.0,"photoIDs":[5757971.0],"skipIndex":0,"section_code":"gallery","featured_images":5757971.0,"id":326255,"singleSection":false});				  						galleries[252878] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"North Wales","link":"gallery_252878.html","maxRecords":0.0,"photoIDs":[3521469.0,3634578.0,3634588.0,4306806.0,3420203.0,3420150.0,4306970.0,3405703.0,3521560.0,3413595.0,5777377.0,4306672.0],"skipIndex":0,"section_code":"gallery","featured_images":3521469.0,"id":252878,"singleSection":false});				  						galleries[252881] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Nottinghamshire","link":"gallery_252881.html","maxRecords":0.0,"photoIDs":[3594817.0,3420153.0,3420110.0,3376484.0,3499622.0],"skipIndex":0,"section_code":"gallery","featured_images":"3594817,3499622,3420153,3420110,3376484","id":252881,"singleSection":false});				  						galleries[195326] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"Shipley Country Park","link":"gallery_195326.html","maxRecords":0.0,"photoIDs":[3499684.0,5721178.0,3420224.0,5726817.0,5720504.0,6028119.0,5726639.0,5743425.0,5956048.0,6027431.0,6027604.0],"skipIndex":0,"section_code":"gallery","featured_images":"6028119,6027604,6027431,5956048,5743425,5726817,5726639,5721178,5720504,3499684","id":195326,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '6864885,6028119,5757190,6725883,5761967,6725891,6725938,6962341,6962558,6962611';
imageSets[2] = '3521469,6962361';
imageSets[3] = '6962611,6962590,6962558,6962491,6962475,6962454,6962361,6962341,6962332,6962320,6962302,6962260,6864885,6857302,6857288,6857214,6857165,6857160,6857156,6725938,6725935,6725918,6725891,6725883,6028119,6027604,6027431,5956048,5778825,5778145,5777555,5777377,5766576,5766042,5761967,5760803,5757971,5757964,5757397,5757190,5743425,5726817,5726639,5721178,5720504,5588406,5587818,5587643,5587618,5587607';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/stuartwilco/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/stuartwilco/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = (backgrounds || photos || {})[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'section391151.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 && 'section391151' != '') {
					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 = 'Stuart Anthony 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>';
	}
				
	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="STUARTWILCO">';
			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({					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;
	}
}

			

