window.thumbnails = {};
															thumbnails[1913907] = clik.newPhoto({"id":1913907,"src":"Old College Fields, Shropshire_thumb.jpg","galleries_id":"","server_id":15,"link":"#","width":130,"caption":"Old College Fields,Shopshire","height":83});
															thumbnails[1913064] = clik.newPhoto({"id":1913064,"src":"Americka 37 Praha_thumb.jpg","galleries_id":128265,"server_id":15,"link":"photo_1913064.html","width":130,"caption":"Period style house in Prague","height":186});
															thumbnails[1913096] = clik.newPhoto({"id":1913096,"src":"Colwyn Bay1_thumb.jpg","galleries_id":128265,"server_id":15,"link":"photo_1913096.html","width":130,"caption":"Victorian House in Colwyn Bay","height":91});
															thumbnails[1913132] = clik.newPhoto({"id":1913132,"src":"Bangor_thumb.jpg","galleries_id":128265,"server_id":15,"link":"photo_1913132.html","width":130,"caption":"Victorian school in Bangor","height":96});
															thumbnails[1913145] = clik.newPhoto({"id":1913145,"src":"Llandudno1_thumb.jpg","galleries_id":128265,"server_id":15,"link":"photo_1913145.html","width":130,"caption":"Victorian School in Llandudno","height":92});
															thumbnails[1913168] = clik.newPhoto({"id":1913168,"src":"Penworks, Birmingham_thumb.jpg","galleries_id":128265,"server_id":15,"link":"photo_1913168.html","width":130,"caption":"Old Victorian warehouse in Birmingham","height":92});
															thumbnails[1913180] = clik.newPhoto({"id":1913180,"src":"Palace Hotel Rhyl_thumb.jpg","galleries_id":128265,"server_id":15,"link":"photo_1913180.html","width":130,"caption":"Victorian Hotel in Rhyl","height":92});
															thumbnails[1913214] = clik.newPhoto({"id":1913214,"src":"Barry, Art Deco_thumb.jpg","galleries_id":128302,"server_id":15,"link":"photo_1913214.html","width":130,"caption":"This is renovated house in Barry south Wales","height":92});
															thumbnails[1913413] = clik.newPhoto({"id":1913413,"src":"Barmouth Marina1_thumb.jpg","galleries_id":128302,"server_id":15,"link":"photo_1913413.html","width":130,"caption":"This a renovated Art Deco house in Barmouth Marina","height":91});
															thumbnails[1913415] = clik.newPhoto({"id":1913415,"src":"Barry Art Deco House_thumb.jpg","galleries_id":128302,"server_id":15,"link":"photo_1913415.html","width":130,"caption":"Axonometric view of an Art Deco house in Barry","height":187});
															thumbnails[1913417] = clik.newPhoto({"id":1913417,"src":"Far Moss Road Liverpool_thumb.jpg","galleries_id":128302,"server_id":15,"link":"photo_1913417.html","width":130,"caption":"Art Deco house in Liverpool Far Moss Road","height":90});
															thumbnails[1913562] = clik.newPhoto({"id":1913562,"src":"Waunfaur_thumb.jpg","galleries_id":128306,"server_id":15,"link":"photo_1913562.html","width":130,"caption":"Renovated cottage in Waunfawr North Wales","height":85});
															thumbnails[1913573] = clik.newPhoto({"id":1913573,"src":"Cadnant1_thumb.jpg","galleries_id":128306,"server_id":15,"link":"photo_1913573.html","width":130,"caption":"Renovated cottage in Cadnant Estate, Anglesey","height":87});
															thumbnails[1913582] = clik.newPhoto({"id":1913582,"src":"Cadnant2_thumb.jpg","galleries_id":128306,"server_id":15,"link":"photo_1913582.html","width":130,"caption":"Cottage in Cadnant 2","height":78});
															thumbnails[1913587] = clik.newPhoto({"id":1913587,"src":"Cadnant3_thumb.jpg","galleries_id":128306,"server_id":15,"link":"photo_1913587.html","width":130,"caption":"Cottage in Cadnant 3","height":79});
															thumbnails[1913600] = clik.newPhoto({"id":1913600,"src":"Hatherton nr_thumb.Nantwich2.jpg","galleries_id":128306,"server_id":15,"link":"photo_1913600.html","width":130,"caption":"Hatherton Farm near Nantwich","height":90});
															thumbnails[1913607] = clik.newPhoto({"id":1913607,"src":"Pub nr_thumb. Oxford.jpg","galleries_id":128306,"server_id":15,"link":"photo_1913607.html","width":130,"caption":"Old pub nr.Oxford","height":91});
															thumbnails[1913611] = clik.newPhoto({"id":1913611,"src":"Greenfarm Rainhill, Mreseyside_thumb.jpg","galleries_id":128306,"server_id":15,"link":"photo_1913611.html","width":130,"caption":"Greenfarm Rainhill Merseyside","height":87});
															thumbnails[1913626] = clik.newPhoto({"id":1913626,"src":"Huddersfield2_thumb.jpg","galleries_id":128310,"server_id":15,"link":"photo_1913626.html","width":130,"caption":"Modern blocks of flats built in Huddersfield","height":92});
															thumbnails[1913637] = clik.newPhoto({"id":1913637,"src":"Ynys Mon Gallery,proposed extension_thumb.jpg","galleries_id":128310,"server_id":15,"link":"photo_1913637.html","width":130,"caption":"Proposed extension to Ynys Mon Gallery","height":96});
															thumbnails[1913647] = clik.newPhoto({"id":1913647,"src":"Menai Bridge_thumb.jpg","galleries_id":128310,"server_id":15,"link":"photo_1913647.html","width":130,"caption":"Flats in Menai Bridge","height":92});
															thumbnails[1913662] = clik.newPhoto({"id":1913662,"src":"Beddgelert_thumb.jpg","galleries_id":128313,"server_id":15,"link":"photo_1913662.html","width":130,"caption":"House\\in Snowdonia National Park","height":92});
															thumbnails[1913669] = clik.newPhoto({"id":1913669,"src":"Craigside_thumb.jpg","galleries_id":128313,"server_id":15,"link":"photo_1913669.html","width":130,"caption":"Brick House in Craigsite, North Wales","height":91});
															thumbnails[1913671] = clik.newPhoto({"id":1913671,"src":"Deganwy_thumb.jpg","galleries_id":128313,"server_id":15,"link":"photo_1913671.html","width":130,"caption":"Architect's designed house in Deganwy","height":93});
															thumbnails[1913674] = clik.newPhoto({"id":1913674,"src":"Llanrwst11_thumb.jpg","galleries_id":128313,"server_id":15,"link":"photo_1913674.html","width":130,"caption":"Architect's designed postmodernistic house in Llanrwst","height":92});
															thumbnails[1913676] = clik.newPhoto({"id":1913676,"src":"Llanrwst21_thumb.jpg","galleries_id":128313,"server_id":15,"link":"photo_1913676.html","width":130,"caption":"House in Llanrwst 2","height":92});
															thumbnails[1913677] = clik.newPhoto({"id":1913677,"src":"Wilmslow 001_thumb.jpg","galleries_id":128313,"server_id":15,"link":"photo_1913677.html","width":130,"caption":"Postmodernistic House Architects's designed House in Wilmslow","height":94});
															thumbnails[1913679] = clik.newPhoto({"id":1913679,"src":"Gerddi Benar, Bontnewydd_thumb.jpg","galleries_id":128313,"server_id":15,"link":"photo_1913679.html","width":130,"caption":"Architect's designed houses in Bontnewydd, North Wales","height":89});
															thumbnails[1913695] = clik.newPhoto({"id":1913695,"src":"Porthmadog_thumb.jpg","galleries_id":128313,"server_id":15,"link":"photo_1913695.html","width":130,"caption":"Designed dwellings in Porthmadog","height":90});
															thumbnails[1913699] = clik.newPhoto({"id":1913699,"src":"Acton Farm, Nantwich, Cheshire_thumb.jpg","galleries_id":128318,"server_id":15,"link":"photo_1913699.html","width":130,"caption":"Acton Farm in Cheshire","height":93});
															thumbnails[1913701] = clik.newPhoto({"id":1913701,"src":"Betsy Yn Rhos3_thumb.jpg","galleries_id":128318,"server_id":15,"link":"photo_1913701.html","width":130,"caption":"Betsy yn Rhos ","height":92});
															thumbnails[1913702] = clik.newPhoto({"id":1913702,"src":"Dolwen road aerial view_thumb.jpg","galleries_id":128318,"server_id":15,"link":"photo_1913702.html","width":130,"caption":"Dolwen road aerial view","height":93});
															thumbnails[1913705] = clik.newPhoto({"id":1913705,"src":"Llandaniel2_thumb.jpg","galleries_id":128318,"server_id":15,"link":"photo_1913705.html","width":130,"caption":"llandaniel aerial view","height":95});
															thumbnails[1913707] = clik.newPhoto({"id":1913707,"src":"Port dinorwig_thumb.jpg","galleries_id":128318,"server_id":15,"link":"photo_1913707.html","width":130,"caption":"Development in Portdinorwig","height":84});
															thumbnails[1913710] = clik.newPhoto({"id":1913710,"src":"Treaddur Bay 2_thumb.jpg","galleries_id":128318,"server_id":15,"link":"photo_1913710.html","width":130,"caption":"Hotel in Treaddur Bay","height":92});
															thumbnails[1913714] = clik.newPhoto({"id":1913714,"src":"Splash point2, Rhyl_thumb.jpg","galleries_id":128318,"server_id":15,"link":"photo_1913714.html","width":130,"caption":"Splash point in Rhyl","height":93});
															thumbnails[1913718] = clik.newPhoto({"id":1913718,"src":"Bala3_thumb.jpg","galleries_id":128318,"server_id":15,"link":"photo_1913718.html","width":130,"caption":"Bala development","height":95});
															thumbnails[1913731] = clik.newPhoto({"id":1913731,"src":"Climbing wall Bolton_thumb.jpg","galleries_id":128321,"server_id":15,"link":"photo_1913731.html","width":130,"caption":"Climbing wall in Bolton, Manchester","height":194});
															thumbnails[1913766] = clik.newPhoto({"id":1913766,"src":"msoEA2C1_thumb.jpg","galleries_id":128323,"server_id":15,"link":"photo_1913766.html","width":130,"caption":"Model of Wells kelo Factory","height":88});
															thumbnails[1913768] = clik.newPhoto({"id":1913768,"src":"Wellskelo Factory_thumb.jpg","galleries_id":128323,"server_id":15,"link":"photo_1913768.html","width":130,"caption":"Model of Wells Kelo Factory 2","height":84});
															thumbnails[1913771] = clik.newPhoto({"id":1913771,"src":"British Pavilon_thumb.jpg","galleries_id":128323,"server_id":15,"link":"photo_1913771.html","width":130,"caption":"British Pavilon","height":86});
															thumbnails[1913775] = clik.newPhoto({"id":1913775,"src":"model_thumb.jpg","galleries_id":128323,"server_id":15,"link":"photo_1913775.html","width":130,"caption":"Model for an exhibition about steelwork","height":194});
															thumbnails[1913777] = clik.newPhoto({"id":1913777,"src":"Model of an Exhibition_thumb.jpg","galleries_id":128323,"server_id":15,"link":"photo_1913777.html","width":130,"caption":"Model for an exhibition about steelwork 2","height":175});
															thumbnails[1913912] = clik.newPhoto({"id":1913912,"src":"Rhyl Promenade1_thumb.jpg","galleries_id":128310,"server_id":15,"link":"photo_1913912.html","width":130,"caption":"Rhyl Promenade","height":89});
															thumbnails[1917078] = clik.newPhoto({"id":1917078,"src":"St James s Church1_thumb.jpg","galleries_id":128265,"server_id":15,"link":"photo_1917078.html","width":130,"caption":"St.James's Church in Bangor","height":94});
															thumbnails[1917084] = clik.newPhoto({"id":1917084,"src":"School in Llandudno_thumb.jpg","galleries_id":128321,"server_id":15,"link":"photo_1917084.html","width":130,"caption":"Interior of Victorian school in Llandudno","height":184});
															thumbnails[1917085] = clik.newPhoto({"id":1917085,"src":"Silver Shop in London_thumb.jpg","galleries_id":128321,"server_id":15,"link":"photo_1917085.html","width":130,"caption":"Silver Shop in London","height":97});
															thumbnails[1917087] = clik.newPhoto({"id":1917087,"src":"Swimming pool Treysgawen Hall_thumb.jpg","galleries_id":128321,"server_id":15,"link":"photo_1917087.html","width":130,"caption":"Swimming pool in Treysgawen Hall","height":88});
															thumbnails[1917096] = clik.newPhoto({"id":1917096,"src":"Britannia Housing_thumb.jpg","galleries_id":128323,"server_id":15,"link":"photo_1917096.html","width":130,"caption":"Britannia Housing","height":88});
															thumbnails[1921879] = clik.newPhoto({"id":1921879,"src":"At the Excel Centre London_thumb.jpg","galleries_id":128334,"server_id":15,"link":"photo_1921879.html","width":130,"caption":"Property Exhibition, Excel,London","height":94});
															thumbnails[1921880] = clik.newPhoto({"id":1921880,"src":"At the Excel Centre London 2_thumb.jpg","galleries_id":128334,"server_id":15,"link":"photo_1921880.html","width":130,"caption":"At the Excel Exhibition in London","height":129});
															thumbnails[1921882] = clik.newPhoto({"id":1921882,"src":"In Colwyn Bay_thumb.jpg","galleries_id":128334,"server_id":15,"link":"photo_1921882.html","width":130,"caption":"Board in Colwyn Bay","height":87});
															thumbnails[1921884] = clik.newPhoto({"id":1921884,"src":"Portdinorwig_thumb.jpg","galleries_id":128334,"server_id":15,"link":"photo_1921884.html","width":130,"caption":"Display in Portdinorwig","height":201});
															thumbnails[1921886] = clik.newPhoto({"id":1921886,"src":"Porthmadog1_thumb.jpg","galleries_id":128334,"server_id":15,"link":"photo_1921886.html","width":130,"caption":"Board in Porthmadog","height":97});
															thumbnails[1922565] = clik.newPhoto({"id":1922565,"src":"Church_thumb.jpg","galleries_id":128515,"server_id":15,"link":"photo_1922565.html","width":130,"caption":"Sketch of a church","height":201});
															thumbnails[1923318] = clik.newPhoto({"id":1923318,"src":"Conversion of a Barn in Bryngwran_thumb.jpg","galleries_id":128306,"server_id":15,"link":"photo_1923318.html","width":130,"caption":"Conversion of a barn in Bryngwran","height":89});
															thumbnails[1971976] = clik.newPhoto({"id":1971976,"src":"Chester 1_thumb.jpg","galleries_id":128515,"server_id":15,"link":"photo_1971976.html","width":130,"caption":"Chester 1","height":103});
															thumbnails[1971978] = clik.newPhoto({"id":1971978,"src":"Chester 2_thumb.jpg","galleries_id":128515,"server_id":15,"link":"photo_1971978.html","width":130,"caption":"Chester 2","height":177});
															thumbnails[1971980] = clik.newPhoto({"id":1971980,"src":"Chester  Industrial Park_thumb.jpg","galleries_id":128515,"server_id":15,"link":"photo_1971980.html","width":130,"caption":"Chester Industrial Park","height":83});
															thumbnails[2218483] = clik.newPhoto({"id":2218483,"src":"Szkola nr.5 001_thumb.jpg","galleries_id":128265,"server_id":15,"link":"photo_2218483.html","width":130,"caption":"Elementary school in Bytom Poland 1905 Secession","height":92});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[128302] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Art Deco","link":"gallery_128302.html","maxRecords":0.0,"photoIDs":[1913214.0,1913413.0,1913415.0,1913417.0],"skipIndex":0,"section_code":"gallery","featured_images":"1913417,1913415,1913413,1913214","id":128302,"singleSection":false});				  						galleries[128313] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Contemporary houses","link":"gallery_128313.html","maxRecords":0.0,"photoIDs":[1913662.0,1913669.0,1913671.0,1913674.0,1913676.0,1913677.0,1913679.0,1913695.0],"skipIndex":0,"section_code":"gallery","featured_images":"1913695,1913679,1913677,1913676,1913674,1913671,1913669,1913662","id":128313,"singleSection":false});				  						galleries[128306] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cottages","link":"gallery_128306.html","maxRecords":0.0,"photoIDs":[1913562.0,1913573.0,1913582.0,1913587.0,1913600.0,1913607.0,1913611.0,1923318.0],"skipIndex":0,"section_code":"gallery","featured_images":"1923318,1913611,1913607,1913600,1913587,1913582,1913573,1913562","id":128306,"singleSection":false});				  						galleries[128334] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Exhibitions and displays","link":"gallery_128334.html","maxRecords":0.0,"photoIDs":[1921879.0,1921880.0,1921882.0,1921884.0,1921886.0],"skipIndex":0,"section_code":"gallery","featured_images":"1921886,1921884,1921882,1921880,1921879","id":128334,"singleSection":false});				  						galleries[128321] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Interiors","link":"gallery_128321.html","maxRecords":0.0,"photoIDs":[1913731.0,1917084.0,1917085.0,1917087.0],"skipIndex":0,"section_code":"gallery","featured_images":"1917087,1917085,1917084,1913731","id":128321,"singleSection":false});				  						galleries[128323] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Models","link":"gallery_128323.html","maxRecords":0.0,"photoIDs":[1913766.0,1913768.0,1913771.0,1913775.0,1913777.0,1917096.0],"skipIndex":0,"section_code":"gallery","featured_images":"1917096,1913777,1913775,1913771,1913768,1913766","id":128323,"singleSection":false});				  						galleries[128310] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Modern Architecture","link":"gallery_128310.html","maxRecords":0.0,"photoIDs":[1913626.0,1913637.0,1913647.0,1913912.0],"skipIndex":0,"section_code":"gallery","featured_images":"1913912,1913647,1913637,1913626","id":128310,"singleSection":false});				  						galleries[128318] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Panoramic and bird's eye views ","link":"gallery_128318.html","maxRecords":0.0,"photoIDs":[1913699.0,1913701.0,1913702.0,1913705.0,1913707.0,1913710.0,1913714.0,1913718.0],"skipIndex":0,"section_code":"gallery","featured_images":"1913718,1913714,1913710,1913707,1913705,1913702,1913701,1913699","id":128318,"singleSection":false});				  						galleries[128515] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sketches","link":"gallery_128515.html","maxRecords":0.0,"photoIDs":[1922565.0,1971976.0,1971978.0,1971980.0],"skipIndex":0,"section_code":"gallery","featured_images":"1971980,1971978,1971976,1922565","id":128515,"singleSection":false});				  						galleries[128265] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Period architecture","link":"gallery_128265.html","maxRecords":0.0,"photoIDs":[1913064.0,1913096.0,1913132.0,1913145.0,1913168.0,1913180.0,1917078.0,2218483.0],"skipIndex":0,"section_code":"gallery","featured_images":"2218483,1917078,1913180,1913168,1913145,1913132,1913096,1913064","id":128265,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '1913907';
imageSets[3] = '2218483,1971980,1971978,1971976,1923318,1922565,1921886,1921884,1921882,1921880,1921879,1917096,1917087,1917085,1917084,1917078,1913912,1913907,1913777,1913775,1913771,1913768,1913766,1913731,1913718,1913714,1913710,1913707,1913705,1913702,1913701,1913699,1913695,1913679,1913677,1913676,1913674,1913671,1913669,1913662,1913647,1913637,1913626,1913611,1913607,1913600,1913587,1913582,1913573,1913562';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/branny/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/branny/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/branny/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/branny/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/branny/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/branny/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/branny/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/branny/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 += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$detailContainer:'',
                    updateDocumentTitle:false,speed:0,href:false,css:false,updateHash:false,onAfter:null,onBefore:null},
		op = $.extend({},defaults,options),
		html = '', temp = '',
		photoId = op.nextPhoto.id,
		photoCaption = ''+op.nextPhoto.caption,
		photoSrc = op.nextPhoto.src;
	
	if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Danuta Hedley Art: ' + 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;
	}
}

			

