window.thumbnails = {};
															thumbnails[7545540] = clik.newPhoto({"id":7545540,"src":"egg_2_450_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"jewelled ceramic egg","height":140});
															thumbnails[7124229] = clik.newPhoto({"id":7124229,"src":"bw_light_4501_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Ceramic pierced light, various sizes £60, £34, £28","height":120});
															thumbnails[7128724] = clik.newPhoto({"id":7128724,"src":"confetti_heart_450_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Small 'confetti' Heart Box £15","height":127});
															thumbnails[8371012] = clik.newPhoto({"id":8371012,"src":"3_organics_400_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Stoneware group with green ash glaze","height":182});
															thumbnails[9057826] = clik.newPhoto({"id":9057826,"src":"ceramic_and_steel_72_dpi_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9057826.html","width":130,"caption":"Ceramic and Steel","height":189});
															thumbnails[6188659] = clik.newPhoto({"id":6188659,"src":"stainless_steel_balls_500_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_6188659.html","width":130,"caption":"Plant Form  ","height":213});
															thumbnails[9036836] = clik.newPhoto({"id":9036836,"src":"Steel_Grass_5001_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9036836.html","width":130,"caption":"Steel Form 1","height":173});
															thumbnails[9037101] = clik.newPhoto({"id":9037101,"src":"steel_form_2010_450_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9037101.html","width":130,"caption":"Steel Form 2","height":181});
															thumbnails[9037348] = clik.newPhoto({"id":9037348,"src":"crop_white_border_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9037348.html","width":130,"caption":"Steel Form 3","height":195});
															thumbnails[9060371] = clik.newPhoto({"id":9060371,"src":"heads_72dpi1_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9060371.html","width":130,"caption":"Heads","height":192});
															thumbnails[9037288] = clik.newPhoto({"id":9037288,"src":"dove_cottage_NGS_75_450_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9037288.html","width":130,"caption":"at Dove Cottage NGS","height":173});
															thumbnails[9071024] = clik.newPhoto({"id":9071024,"src":"ceramic_and_steel_sculpture_72dpi_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9071024.html","width":130,"caption":"Ceramic and Steel","height":126});
															thumbnails[9060069] = clik.newPhoto({"id":9060069,"src":"ceramic_and_steel_L_72dpi_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9060069.html","width":130,"caption":"Ceramic and Steel","height":98});
															thumbnails[9036862] = clik.newPhoto({"id":9036862,"src":"black_orbs_500_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9036862.html","width":130,"caption":"Orbs Black Ash Glaze","height":92});
															thumbnails[9060061] = clik.newPhoto({"id":9060061,"src":"ceramic_and_steel_2_72dpi1_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9060061.html","width":130,"caption":"Ceramic and Steel 2","height":94});
															thumbnails[8440846] = clik.newPhoto({"id":8440846,"src":"Jude_garden_sculpture_500_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_8440846.html","width":130,"caption":"small organic","height":96});
															thumbnails[9037292] = clik.newPhoto({"id":9037292,"src":"TAN_ASH_2_500_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9037292.html","width":130,"caption":"Orb Tan Ash Glaze","height":98});
															thumbnails[8371010] = clik.newPhoto({"id":8371010,"src":"1_organic_500_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_8371010.html","width":130,"caption":"Stoneware with green ash glaze","height":100});
															thumbnails[9037286] = clik.newPhoto({"id":9037286,"src":"P1020153_500_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9037286.html","width":130,"caption":"cut form","height":96});
															thumbnails[7943794] = clik.newPhoto({"id":7943794,"src":"topiary_5_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_7943794.html","width":130,"caption":"Topiary 5","height":136});
															thumbnails[8440834] = clik.newPhoto({"id":8440834,"src":"Jude_Howe__garden_sculpture_400_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_8440834.html","width":130,"caption":"Stoneware with green ash glaze","height":174});
															thumbnails[9037293] = clik.newPhoto({"id":9037293,"src":"stainless_steel_pod_450_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9037293.html","width":130,"caption":"Stainless Steel with Pod","height":180});
															thumbnails[9061680] = clik.newPhoto({"id":9061680,"src":"plant_form_at_Dove_Cottage_72dpi_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9061680.html","width":130,"caption":"Plant Form at Dove Cottage NGS","height":182});
															thumbnails[9061688] = clik.newPhoto({"id":9061688,"src":"at_Dove_Cottage_NGS_72dpi_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_9061688.html","width":130,"caption":"at Dove Cottage NGS","height":173});
															thumbnails[6567279] = clik.newPhoto({"id":6567279,"src":"crank_Torso2_450_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_6567279.html","width":130,"caption":"Stoneware Torso ","height":209});
															thumbnails[6644092] = clik.newPhoto({"id":6644092,"src":"black_torso_450_thumb.jpg","galleries_id":390838,"server_id":15,"link":"photo_6644092.html","width":130,"caption":"Torso in Black Textured Stoneware Clay ","height":226});
															thumbnails[6673842] = clik.newPhoto({"id":6673842,"src":"red_egg_400_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_6673842.html","width":130,"caption":"Large Red Egg Box Glazed Earthenware £20","height":105});
															thumbnails[6673847] = clik.newPhoto({"id":6673847,"src":"red_orb_450_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_6673847.html","width":130,"caption":"Small Pierced Red Orb Glazed Earthenware £10","height":123});
															thumbnails[6742384] = clik.newPhoto({"id":6742384,"src":"starry_black_pierced_orb_450_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_6742384.html","width":130,"caption":"Starry Black pierced Orb Glazed Earthenware £20, £25 for candles or as a complete lamp £28, £34","height":122});
															thumbnails[7545527] = clik.newPhoto({"id":7545527,"src":"egg_450_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_7545527.html","width":130,"caption":"jewelled ceramic egg","height":143});
															thumbnails[7545556] = clik.newPhoto({"id":7545556,"src":"vessel_lamp_450_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_7545556.html","width":130,"caption":"ceramic lamp with glaze detail","height":192});
															thumbnails[7124217] = clik.newPhoto({"id":7124217,"src":"red_light_450_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_7124217.html","width":130,"caption":"Ceramic pierced light, various sizes £60, £34, £28","height":125});
															thumbnails[7128720] = clik.newPhoto({"id":7128720,"src":"blue_laced_egg_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_7128720.html","width":130,"caption":"Small Laced Egg Box £15","height":117});
															thumbnails[7128725] = clik.newPhoto({"id":7128725,"src":"white_egg_450_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_7128725.html","width":130,"caption":"Small Egg Box, white glaze detail £15","height":102});
															thumbnails[6786167] = clik.newPhoto({"id":6786167,"src":"laced_egg_450_thumb.jpg","galleries_id":476183,"server_id":15,"link":"photo_6786167.html","width":130,"caption":"Laced Egg Earthenware with clear matte glaze £15","height":104});
															thumbnails[7412482] = clik.newPhoto({"id":7412482,"src":"planter_450_2891E692-24E8-5EC4-4F0E76ACECFD4D77_thumb.jpg","galleries_id":476184,"server_id":15,"link":"photo_7412482.html","width":130,"caption":"Stoneware Planter ","height":127});
															thumbnails[7545578] = clik.newPhoto({"id":7545578,"src":"planter_2__450_thumb.jpg","galleries_id":476184,"server_id":15,"link":"photo_7545578.html","width":130,"caption":"stoneware planter","height":155});
															thumbnails[7545583] = clik.newPhoto({"id":7545583,"src":"planter_450_CF7FB425-1E4F-37DC-71145087DE735EC4_thumb.jpg","galleries_id":476184,"server_id":15,"link":"photo_7545583.html","width":130,"caption":"stoneware planter","height":156});
															thumbnails[9071049] = clik.newPhoto({"id":9071049,"src":"black_and_white_vessel_72dpi_thumb.jpg","galleries_id":476184,"server_id":15,"link":"photo_9071049.html","width":130,"caption":"Laminated Stoneware Vessel","height":173});
															thumbnails[9071056] = clik.newPhoto({"id":9071056,"src":"black_and_white_large_72dpi_thumb.jpg","galleries_id":476184,"server_id":15,"link":"photo_9071056.html","width":130,"caption":"Laminated Stoneware Vessel","height":148});
															thumbnails[9037295] = clik.newPhoto({"id":9037295,"src":"tree_spirit1_thumb.jpg","galleries_id":476187,"server_id":15,"link":"photo_9037295.html","width":130,"caption":"Tree Spirit","height":159});
															thumbnails[9037298] = clik.newPhoto({"id":9037298,"src":"in_Buckley_Woods12_thumb.jpg","galleries_id":476187,"server_id":15,"link":"photo_9037298.html","width":130,"caption":"In Buckley Woods","height":239});
															thumbnails[9037303] = clik.newPhoto({"id":9037303,"src":"Nutclough_Scar_thumb.jpg","galleries_id":476187,"server_id":15,"link":"photo_9037303.html","width":130,"caption":"Nutclough Scar","height":252});
															thumbnails[9037324] = clik.newPhoto({"id":9037324,"src":"skipsea_impression_thumb.jpg","galleries_id":476187,"server_id":15,"link":"photo_9037324.html","width":130,"caption":"Fragile Earth (Skipsea)","height":163});
															thumbnails[6786272] = clik.newPhoto({"id":6786272,"src":"pink_kfb_4501_thumb.jpg","galleries_id":247250,"server_id":15,"link":"photo_6786272.html","width":130,"caption":"Pink Bowl ","height":90});
															thumbnails[4130594] = clik.newPhoto({"id":4130594,"src":"orange_glass_thumb.jpg","galleries_id":247250,"server_id":15,"link":"photo_4130594.html","width":130,"caption":"Orange Bowl ","height":79});
															thumbnails[4423836] = clik.newPhoto({"id":4423836,"src":"steel_blue_bowl_thumb.jpg","galleries_id":247250,"server_id":15,"link":"photo_4423836.html","width":130,"caption":"Steel Blue Bowl","height":81});
															thumbnails[4423839] = clik.newPhoto({"id":4423839,"src":"spring_green_glass_thumb.jpg","galleries_id":247250,"server_id":15,"link":"photo_4423839.html","width":130,"caption":"Spring Green Bowl ","height":80});
															thumbnails[9091352] = clik.newPhoto({"id":9091352,"src":"ruby_72_dpi_2_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091352.html","width":130,"caption":"Ruby with Woodburning Stove","height":199});
															thumbnails[9092667] = clik.newPhoto({"id":9092667,"src":"colin_72dpi_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9092667.html","width":130,"caption":"Colin's favourite place","height":163});
															thumbnails[9091400] = clik.newPhoto({"id":9091400,"src":"house_august_2013_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091400.html","width":130,"caption":"Our House August 2011","height":98});
															thumbnails[9091412] = clik.newPhoto({"id":9091412,"src":"caravan_august_2012_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091412.html","width":130,"caption":"Caravan (Ceramics Studio)","height":98});
															thumbnails[9090760] = clik.newPhoto({"id":9090760,"src":"Sept_1_72dpi_2_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9090760.html","width":130,"caption":"September 2011","height":98});
															thumbnails[9090849] = clik.newPhoto({"id":9090849,"src":"Oct_5_72dpi_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9090849.html","width":130,"caption":"October 2011","height":98});
															thumbnails[9091097] = clik.newPhoto({"id":9091097,"src":"nov_sunrise_72dpi_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091097.html","width":130,"caption":"November sunrise 2011 ","height":98});
															thumbnails[9090871] = clik.newPhoto({"id":9090871,"src":"November_sunset_2_72dpi_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9090871.html","width":130,"caption":"November sunset 2011","height":98});
															thumbnails[9091118] = clik.newPhoto({"id":9091118,"src":"Dec_sunrise_72dpi_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091118.html","width":130,"caption":"December 1st sunrise 2011","height":98});
															thumbnails[9091129] = clik.newPhoto({"id":9091129,"src":"dec_sunset_72dpi_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091129.html","width":130,"caption":"December sunset 2011","height":98});
															thumbnails[9092707] = clik.newPhoto({"id":9092707,"src":"weather_vane_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9092707.html","width":130,"caption":"Our Weather Vane","height":108});
															thumbnails[9091131] = clik.newPhoto({"id":9091131,"src":"Dec_23rd_sunrise_72dpi_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091131.html","width":130,"caption":"December 23rd sunrise 2011","height":98});
															thumbnails[9091346] = clik.newPhoto({"id":9091346,"src":"February_3rd_2013_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091346.html","width":130,"caption":"February 3rd 2012","height":98});
															thumbnails[9091347] = clik.newPhoto({"id":9091347,"src":"Our_House_Feb_2013_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091347.html","width":130,"caption":"Our House","height":98});
															thumbnails[9091348] = clik.newPhoto({"id":9091348,"src":"Stan_outside_our_house_February_2013_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091348.html","width":130,"caption":"Stan outside our house","height":98});
															thumbnails[9091349] = clik.newPhoto({"id":9091349,"src":"Our_Beach_February_2013_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091349.html","width":130,"caption":"Our Beach","height":98});
															thumbnails[9091351] = clik.newPhoto({"id":9091351,"src":"Ditch_feb_2013_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9091351.html","width":130,"caption":"Ditch February 2012","height":98});
															thumbnails[9096469] = clik.newPhoto({"id":9096469,"src":"feb_5th_2012_72dpi_1_thumb.jpg","galleries_id":479620,"server_id":15,"link":"photo_9096469.html","width":130,"caption":"Our Garden February 5th 2012","height":93});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[479620] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Atwick","link":"section584430.html","maxRecords":0.0,"photoIDs":[9091352.0,9092667.0,9091400.0,9091412.0,9090760.0,9090849.0,9091097.0,9090871.0,9091118.0,9091129.0,9092707.0,9091131.0,9091346.0,9091347.0,9091348.0,9091349.0,9091351.0,9096469.0],"skipIndex":0,"section_code":"section584430","featured_images":"9096469,9092707,9092667,9091412,9091400,9091352,9091351,9091349,9091348,9091347","id":479620,"singleSection":true});				  						galleries[476184] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Planters","link":"section579564.html","maxRecords":0.0,"photoIDs":[7412482.0,7545578.0,7545583.0,9071049.0,9071056.0],"skipIndex":0,"section_code":"section579564","featured_images":"9071056,9071049,7545583,7545578,7412482","id":476184,"singleSection":true});				  						galleries[476183] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Slip Cast Ceramics","link":"section442062.html","maxRecords":0.0,"photoIDs":[6673842.0,6673847.0,6742384.0,7545527.0,7545556.0,7124217.0,7128720.0,7128725.0,6786167.0],"skipIndex":0,"section_code":"section442062","featured_images":"7545556,7545527,7128725,7128720,7124217,6786167,6742384,6673847,6673842","id":476183,"singleSection":true});				  						galleries[390838] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Garden Sculpture","link":"section464263.html","maxRecords":0.0,"photoIDs":[9057826.0,6188659.0,9036836.0,9037101.0,9037348.0,9060371.0,9037288.0,9071024.0,9060069.0,9036862.0,9060061.0,8440846.0,9037292.0,8371010.0,9037286.0,7943794.0,8440834.0,9037293.0,9061680.0,9061688.0,6567279.0,6644092.0],"skipIndex":0,"section_code":"section464263","featured_images":9036836.0,"id":390838,"singleSection":true});				  						galleries[476187] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ceramic Impressions","link":"section579565.html","maxRecords":0.0,"photoIDs":[9037295.0,9037298.0,9037303.0,9037324.0],"skipIndex":0,"section_code":"section579565","featured_images":"9037324,9037303,9037298,9037295","id":476187,"singleSection":true});				  						galleries[247250] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Glass","link":"gallery.html","maxRecords":0.0,"photoIDs":[6786272.0,4130594.0,4423836.0,4423839.0],"skipIndex":0,"section_code":"gallery","featured_images":"6786272,4130594","id":247250,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9057826,6188659,9036836,9071024,8440846';
imageSets[2] = '6786272,9036836,4130594';
imageSets[3] = '9091347,9091348,9091349,9091351';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/judehowe2/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/judehowe2/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 += 'section464263.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 && 'section464263' != '') {
					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 = 'Stan Pile and Jude Howe: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		if (op.$photo.length > 0) {
		html = $('<img/>',{
			'class': 'mainphoto photo',
			src: photoSrc,
			id: 'mainPic',
			name: 'mainPic',
			width: op.nextPhoto.width,
			height: op.nextPhoto.height,
			alt: photoCaption,
			css: op.css || {}
		});
		if (op.href) {
			if (op.href.match(/<a/)) {
				html = $(op.href).append(html);
			} else {
				html = $('<a/>', {
					href: op.href,
					title: photoCaption
				}).append(html);
			}
		} else {
			html = $('<a/>', {
				title: photoCaption
			}).append(html);
		}
		if (op.speed == 0) {			op.$photo.html(html);			if (op.onBefore) {			  	op.onBefore.apply(op.$photo);			}			if (op.onAfter) {			  	op.onAfter.apply(op.$photo);			}		} else {			op.$photo.stop(true,true).fadeReplaceWith(html,op.speed,'',function(){  				if (op.onAfter) {				  	op.onAfter.apply(this);				}				clik.doColumnResize(false, $(this).add(op.$detail).add(op.$title));			}, op.onBefore);
		}	}
    if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
        if (!op.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp += '<p>Order this print:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
			temp += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

