window.thumbnails = {};
															thumbnails[8256221] = clik.newPhoto({"id":8256221,"src":"c_detail1_thumb.jpg","galleries_id":"","server_id":35,"link":"#","width":130,"caption":"Sleeper (detail) ","height":195});
															thumbnails[3326483] = clik.newPhoto({"id":3326483,"src":"Mirror_thumb.jpg","galleries_id":439832,"server_id":18,"link":"photo_3326483.html","width":130,"caption":"A Sharper image","height":130});
															thumbnails[1011521] = clik.newPhoto({"id":1011521,"src":"Hurt_thumb.JPG","galleries_id":75704,"server_id":18,"link":"photo_1011521.html","width":130,"caption":"Hurt","height":173});
															thumbnails[1013450] = clik.newPhoto({"id":1013450,"src":"table11_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_1013450.html","width":130,"caption":"Table Top Expedition","height":126});
															thumbnails[1014341] = clik.newPhoto({"id":1014341,"src":"All That Remains 2_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_1014341.html","width":130,"caption":"All That Remains","height":109});
															thumbnails[1014342] = clik.newPhoto({"id":1014342,"src":"All That Remains 3_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_1014342.html","width":130,"caption":"All That Remains","height":183});
															thumbnails[1034684] = clik.newPhoto({"id":1034684,"src":"Hurt2_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_1034684.html","width":130,"caption":"Hurt","height":157});
															thumbnails[1034723] = clik.newPhoto({"id":1034723,"src":"Spine1_thumb.JPG","galleries_id":75704,"server_id":18,"link":"photo_1034723.html","width":130,"caption":"Exhibit A","height":178});
															thumbnails[1034733] = clik.newPhoto({"id":1034733,"src":"Every Mammal3_thumb.JPG","galleries_id":75704,"server_id":18,"link":"photo_1034733.html","width":130,"caption":"Exhibit A ( Detail )","height":98});
															thumbnails[1034806] = clik.newPhoto({"id":1034806,"src":"card5_thumb.jpg","galleries_id":439833,"server_id":18,"link":"photo_1034806.html","width":130,"caption":"Aldgate, London","height":173});
															thumbnails[1035847] = clik.newPhoto({"id":1035847,"src":"Barbed fence_thumb.jpg","galleries_id":439833,"server_id":18,"link":"photo_1035847.html","width":130,"caption":"Restricted area Dungeness","height":188});
															thumbnails[1035856] = clik.newPhoto({"id":1035856,"src":"derelictbuildings_thumb.jpg","galleries_id":439833,"server_id":18,"link":"photo_1035856.html","width":130,"caption":"Derelict Building. Poplar. London","height":98});
															thumbnails[1035857] = clik.newPhoto({"id":1035857,"src":"Dung1_thumb.JPG","galleries_id":439833,"server_id":18,"link":"photo_1035857.html","width":130,"caption":"Pylons Dungeness","height":98});
															thumbnails[1035859] = clik.newPhoto({"id":1035859,"src":"Dungeness1_thumb.jpg","galleries_id":439833,"server_id":18,"link":"photo_1035859.html","width":130,"caption":"Dungeness One","height":98});
															thumbnails[1035860] = clik.newPhoto({"id":1035860,"src":"DungStructure_thumb.JPG","galleries_id":439833,"server_id":18,"link":"photo_1035860.html","width":130,"caption":"Dungeness Two","height":173});
															thumbnails[1035863] = clik.newPhoto({"id":1035863,"src":"Structure3_thumb.JPG","galleries_id":439833,"server_id":18,"link":"photo_1035863.html","width":130,"caption":"Dungeness Sunset","height":98});
															thumbnails[1039081] = clik.newPhoto({"id":1039081,"src":"Yard2_thumb.jpg","galleries_id":439833,"server_id":18,"link":"photo_1039081.html","width":130,"caption":"Bow Creek Wharf","height":98});
															thumbnails[1045151] = clik.newPhoto({"id":1045151,"src":"Scar 2 1_thumb.JPG","galleries_id":75704,"server_id":18,"link":"photo_1045151.html","width":130,"caption":"Scar 2","height":168});
															thumbnails[1045152] = clik.newPhoto({"id":1045152,"src":"Scar2detail_thumb.JPG","galleries_id":75704,"server_id":18,"link":"photo_1045152.html","width":130,"caption":"Scar 2 Detail","height":98});
															thumbnails[1046515] = clik.newPhoto({"id":1046515,"src":"Medussa_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_1046515.html","width":130,"caption":"Medussa","height":180});
															thumbnails[1055713] = clik.newPhoto({"id":1055713,"src":"pendulum1_thumb.JPG","galleries_id":77187,"server_id":18,"link":"photo_1055713.html","width":130,"caption":"Time","height":244});
															thumbnails[1075923] = clik.newPhoto({"id":1075923,"src":"Pill1_thumb.JPG","galleries_id":77187,"server_id":18,"link":"photo_1075923.html","width":130,"caption":"In pursuit of Happiness","height":95});
															thumbnails[1075925] = clik.newPhoto({"id":1075925,"src":"pill2_thumb.JPG","galleries_id":77187,"server_id":18,"link":"photo_1075925.html","width":130,"caption":"In pursuit of happiness","height":78});
															thumbnails[1075943] = clik.newPhoto({"id":1075943,"src":"scar one_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_1075943.html","width":130,"caption":"Scar one","height":216});
															thumbnails[1075944] = clik.newPhoto({"id":1075944,"src":"scar one detail_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_1075944.html","width":130,"caption":"Scar one ( detail)","height":98});
															thumbnails[1096052] = clik.newPhoto({"id":1096052,"src":"table6_thumb.JPG","galleries_id":77187,"server_id":18,"link":"photo_1096052.html","width":130,"caption":"Table Top Expedition (detail)","height":124});
															thumbnails[1902489] = clik.newPhoto({"id":1902489,"src":"bloodlight5_thumb.jpg","galleries_id":439832,"server_id":18,"link":"photo_1902489.html","width":130,"caption":"Bloodlight 2008 - 1.3m x 0.7m. Mixed media","height":193});
															thumbnails[1902496] = clik.newPhoto({"id":1902496,"src":"bloodlight in gallery1_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_1902496.html","width":129,"caption":"Bloodlight 2008","height":173});
															thumbnails[1902497] = clik.newPhoto({"id":1902497,"src":"Bloodlight2_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_1902497.html","width":130,"caption":"Bloodlight 2008","height":173});
															thumbnails[2102762] = clik.newPhoto({"id":2102762,"src":"reveal1_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_2102762.html","width":130,"caption":"arrested corrosion","height":98});
															thumbnails[2351040] = clik.newPhoto({"id":2351040,"src":"jupiterforweb2_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_2351040.html","width":130,"caption":"NEW CUT. Mixed Media. 1m diameter. 2008","height":126});
															thumbnails[2351042] = clik.newPhoto({"id":2351042,"src":"jupiterdetailforweb_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_2351042.html","width":130,"caption":"NEW CUT detail","height":98});
															thumbnails[2862478] = clik.newPhoto({"id":2862478,"src":"incubation2forweb_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_2862478.html","width":129,"caption":"half life","height":87});
															thumbnails[2862486] = clik.newPhoto({"id":2862486,"src":"incubation3for web_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_2862486.html","width":129,"caption":"half life","height":100});
															thumbnails[3627804] = clik.newPhoto({"id":3627804,"src":"weeping_wall_1_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_3627804.html","width":130,"caption":"weeping wall. 2009. Wood, steel and resin","height":173});
															thumbnails[4013336] = clik.newPhoto({"id":4013336,"src":"Assembly_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_4013336.html","width":130,"caption":"Assembly2009 - steel and plaster. 1.7m x 1m","height":188});
															thumbnails[4106738] = clik.newPhoto({"id":4106738,"src":"3_-_Interference_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_4106738.html","width":130,"caption":"Interference","height":170});
															thumbnails[4704671] = clik.newPhoto({"id":4704671,"src":"ASSEMBLY_detail_thumb.jpg","galleries_id":77187,"server_id":18,"link":"photo_4704671.html","width":130,"caption":"Assembly at Dalston Supesrtore exhibition","height":173});
															thumbnails[4885231] = clik.newPhoto({"id":4885231,"src":"Hospital_tray_thumb.jpg","galleries_id":439832,"server_id":18,"link":"photo_4885231.html","width":130,"caption":"Design for a hospital tray. 2009. wood and acrylic. 40cm x 30cm","height":98});
															thumbnails[4885232] = clik.newPhoto({"id":4885232,"src":"hospital_tray_detail_thumb.jpg","galleries_id":439832,"server_id":18,"link":"photo_4885232.html","width":130,"caption":"Design for a hospital tray - detail","height":98});
															thumbnails[5570267] = clik.newPhoto({"id":5570267,"src":"new_piece_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_5570267.html","width":130,"caption":"Dungeness","height":206});
															thumbnails[5570283] = clik.newPhoto({"id":5570283,"src":"new_piece_2_thumb.jpg","galleries_id":75704,"server_id":18,"link":"photo_5570283.html","width":130,"caption":"Dungeness","height":124});
															thumbnails[8256216] = clik.newPhoto({"id":8256216,"src":"c1_thumb.jpg","galleries_id":77187,"server_id":35,"link":"photo_8256216.html","width":130,"caption":"Sleeper","height":192});
															thumbnails[8256219] = clik.newPhoto({"id":8256219,"src":"c_detail_thumb.jpg","galleries_id":75704,"server_id":35,"link":"photo_8256219.html","width":130,"caption":"Sleeper (detail)","height":195});
															thumbnails[8256223] = clik.newPhoto({"id":8256223,"src":"cross_thumb.jpg","galleries_id":439832,"server_id":35,"link":"photo_8256223.html","width":130,"caption":"In Place of Faith","height":86});
															thumbnails[8256224] = clik.newPhoto({"id":8256224,"src":"cross_detail_thumb.jpg","galleries_id":439832,"server_id":35,"link":"photo_8256224.html","width":130,"caption":"In Place of Faith (Detail)","height":87});
															thumbnails[8256228] = clik.newPhoto({"id":8256228,"src":"d1_thumb.jpg","galleries_id":77187,"server_id":35,"link":"photo_8256228.html","width":130,"caption":"sweet and sour","height":87});
															thumbnails[8256330] = clik.newPhoto({"id":8256330,"src":"d2_thumb.jpg","galleries_id":77187,"server_id":35,"link":"photo_8256330.html","width":130,"caption":"Sweet and Sour ( alternative view)","height":146});
															thumbnails[8256405] = clik.newPhoto({"id":8256405,"src":"d_detail_thumb.jpg","galleries_id":77187,"server_id":35,"link":"photo_8256405.html","width":130,"caption":"Sweet and Sour (detail)","height":87});
															thumbnails[8256532] = clik.newPhoto({"id":8256532,"src":"e1_thumb.jpg","galleries_id":77187,"server_id":35,"link":"photo_8256532.html","width":130,"caption":"The Tower","height":180});
															thumbnails[8256727] = clik.newPhoto({"id":8256727,"src":"f1_thumb.jpg","galleries_id":75704,"server_id":35,"link":"photo_8256727.html","width":130,"caption":"Spillage","height":195});
															thumbnails[8256752] = clik.newPhoto({"id":8256752,"src":"f_detail_thumb.jpg","galleries_id":75704,"server_id":35,"link":"photo_8256752.html","width":130,"caption":"Spillage (Detail)","height":178});
															thumbnails[8256767] = clik.newPhoto({"id":8256767,"src":"g1_thumb.jpg","galleries_id":75704,"server_id":37,"link":"photo_8256767.html","width":130,"caption":"Scar","height":199});
															thumbnails[8256993] = clik.newPhoto({"id":8256993,"src":"g_detail_thumb.jpg","galleries_id":75704,"server_id":37,"link":"photo_8256993.html","width":130,"caption":"Scar (Detail)","height":195});
															thumbnails[8256995] = clik.newPhoto({"id":8256995,"src":"h1_thumb.jpg","galleries_id":75704,"server_id":37,"link":"photo_8256995.html","width":130,"caption":"Urban Ghost","height":230});
															thumbnails[8256997] = clik.newPhoto({"id":8256997,"src":"h_detail_thumb.jpg","galleries_id":75704,"server_id":37,"link":"photo_8256997.html","width":130,"caption":"Urban Ghost (detail)","height":195});
															thumbnails[8256999] = clik.newPhoto({"id":8256999,"src":"i2_thumb.jpg","galleries_id":75704,"server_id":37,"link":"photo_8256999.html","width":130,"caption":"weeping wall","height":139});
															thumbnails[8257002] = clik.newPhoto({"id":8257002,"src":"i_detail_thumb.jpg","galleries_id":75704,"server_id":37,"link":"photo_8257002.html","width":130,"caption":"Weeping Wall (detail)","height":193});
															thumbnails[8257003] = clik.newPhoto({"id":8257003,"src":"j1_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257003.html","width":130,"caption":"The Dance","height":192});
															thumbnails[8257004] = clik.newPhoto({"id":8257004,"src":"j2_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257004.html","width":130,"caption":"The Dance (alternative view)","height":195});
															thumbnails[8257012] = clik.newPhoto({"id":8257012,"src":"k2_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257012.html","width":130,"caption":"fractured nerves","height":195});
															thumbnails[8257017] = clik.newPhoto({"id":8257017,"src":"k_detail_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257017.html","width":130,"caption":"Fractured nerves (Detail)","height":195});
															thumbnails[8257023] = clik.newPhoto({"id":8257023,"src":"k_detail2_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257023.html","width":130,"caption":"Fractured Nerves (detail2)","height":87});
															thumbnails[8257027] = clik.newPhoto({"id":8257027,"src":"light_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257027.html","width":130,"caption":"Tesla IV - The party is over","height":87});
															thumbnails[8257061] = clik.newPhoto({"id":8257061,"src":"light_profile_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257061.html","width":130,"caption":"Tesla IV - The Party is over (alternative view)","height":87});
															thumbnails[8257065] = clik.newPhoto({"id":8257065,"src":"light_rear_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257065.html","width":130,"caption":"Tesla IV - The Part Is Over ( alternative view)","height":195});
															thumbnails[8257072] = clik.newPhoto({"id":8257072,"src":"m2_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257072.html","width":130,"caption":"Afterlives","height":203});
															thumbnails[8257074] = clik.newPhoto({"id":8257074,"src":"m_detail_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257074.html","width":130,"caption":"Afterlives (detail)","height":164});
															thumbnails[8257075] = clik.newPhoto({"id":8257075,"src":"m_detail2_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257075.html","width":130,"caption":"Afterlives (detail 2)","height":195});
															thumbnails[8257078] = clik.newPhoto({"id":8257078,"src":"n1_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257078.html","width":130,"caption":"Slice Of Life","height":196});
															thumbnails[8257079] = clik.newPhoto({"id":8257079,"src":"n2_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257079.html","width":130,"caption":"Slice Of Life (alternative view)","height":195});
															thumbnails[8257082] = clik.newPhoto({"id":8257082,"src":"s2_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257082.html","width":130,"caption":"Black Heart","height":195});
															thumbnails[8257083] = clik.newPhoto({"id":8257083,"src":"s1_thumb.jpg","galleries_id":77187,"server_id":37,"link":"photo_8257083.html","width":130,"caption":"Black Heart (rear view)","height":195});
															thumbnails[8257084] = clik.newPhoto({"id":8257084,"src":"t1_thumb.jpg","galleries_id":75704,"server_id":37,"link":"photo_8257084.html","width":130,"caption":"Exhibit A","height":195});
															thumbnails[8257085] = clik.newPhoto({"id":8257085,"src":"t_detail_thumb.jpg","galleries_id":75704,"server_id":37,"link":"photo_8257085.html","width":130,"caption":"Exhibit A (detail)","height":195});
															thumbnails[8257088] = clik.newPhoto({"id":8257088,"src":"Table1_thumb.jpg","galleries_id":439832,"server_id":37,"link":"photo_8257088.html","width":130,"caption":"Table for opposing views","height":89});
															thumbnails[8257092] = clik.newPhoto({"id":8257092,"src":"table2_thumb.jpg","galleries_id":439832,"server_id":37,"link":"photo_8257092.html","width":130,"caption":"Table For Opposing Views (alternate view)","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[439832] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Furniture Fixtures and Fittings","link":"gallery_439832.html","maxRecords":0.0,"photoIDs":[3326483.0,1902489.0,4885231.0,4885232.0,8256223.0,8256224.0,8257088.0,8257092.0],"skipIndex":0,"section_code":"gallery","featured_images":"8256224,4885232","id":439832,"singleSection":false});				  						galleries[439833] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Photographs and Inspirations","link":"gallery_439833.html","maxRecords":0.0,"photoIDs":[1034806.0,1035847.0,1035856.0,1035857.0,1035859.0,1035860.0,1035863.0,1039081.0],"skipIndex":0,"section_code":"gallery","featured_images":"1039081,1035863,1035860,1035859,1035857,1035856,1035847,1034806","id":439833,"singleSection":false});				  						galleries[77187] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Sculpture","link":"gallery_77187.html","maxRecords":0.0,"photoIDs":[1013450.0,1014341.0,1014342.0,1046515.0,1055713.0,1075923.0,1075925.0,1096052.0,1902496.0,1902497.0,2862478.0,2862486.0,4013336.0,4704671.0,8256216.0,8256228.0,8256330.0,8256405.0,8256532.0,8257003.0,8257004.0,8257012.0,8257017.0,8257023.0,8257027.0,8257061.0,8257065.0,8257072.0,8257074.0,8257075.0,8257078.0,8257079.0,8257082.0,8257083.0],"skipIndex":0,"section_code":"gallery","featured_images":"8257083,8257078,8257074,8257061,8257023,4704671","id":77187,"singleSection":false});				  						galleries[75704] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wall Pieces","link":"gallery_75704.html","maxRecords":0.0,"photoIDs":[1011521.0,1034684.0,1034723.0,1034733.0,1045151.0,1045152.0,1075943.0,1075944.0,2102762.0,2351040.0,2351042.0,3627804.0,4106738.0,5570267.0,5570283.0,8256219.0,8256727.0,8256752.0,8256767.0,8256993.0,8256995.0,8256997.0,8256999.0,8257002.0,8257084.0,8257085.0],"skipIndex":0,"section_code":"gallery","featured_images":1034684.0,"id":75704,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8257083,8257078,8257074,8257061,8257023,4704671,3627804';
imageSets[2] = '8257083,8257078,8257074,8257061,8257023,8256224,4885232,4704671,1034684';
imageSets[3] = '1035857';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/mickbateman/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/mickbateman/images';
		break;
	}
		return val;
}

/***************************************************************************
* img = reference to image object in which to show image                   *
***************************************************************************/
function showHomeImage(img) {
	imageID = randomListVal('');
	if (!basic) {
		img.src = photos[imageID].src;
		img.width = photos[imageID].width;
		img.height = photos[imageID].height;
		img.parentNode.title = img.alt = photos[imageID].caption;
	} else {
		newImage = new Image(photos[imageID].width,photos[imageID].height);
		newImage.src = photos[imageID].src;
		document.images[img.name] = newImage;
		
	}
}

function getHomeImageLink(imageID) {
  	var href='', photo = backgrounds && backgrounds[imageID];
	if(photo){
		if (photo && photo.galleries_id != '') {
  			href = photo.fnGalleryLink();
  		}
  		  		else {
  				href += 'gallery.html';
  	  		}
	}
    return href;
}

/***************************************************************************
* Show a random image on home page from featured images                    *
***************************************************************************/
function showHomeImageInline(el, image_sets_id, href) {
	
	var css = {}, imageID,
	    imageSetsId = 1;
	if(image_sets_id){
		imageSetsId = image_sets_id;
	}
	imageID = randomListVal(imageSets[imageSetsId]);
	if (href == null && 'gallery' != '') {
					href = getHomeImageLink(imageID);
	}
	
	updateImage({nextPhoto: backgrounds[imageID], img:el.find('img')[0],
                $photo:el, $title:$('#homeimageTitleContainer'), $detail:$('#homeimageDetailsContainer'),                speed:0, href:href, css:css, onAfter: function(){                  this.closest('.contentsection').doManualAlign({				    inner: 'img',				    crop: 'a'				  });                }              });
}

/***************************************************************************
* Set 'img' to be a new image given its photo() object                     *
***************************************************************************/
function updateImage (options) {
	var defaults = {nextPhoto:'',field:'',img:'',$photo:'',$title:'',$detail:'',$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 = 'Mick Bateman: ' + 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.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="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		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 += '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
	
	if(img){
		if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
		  	imageID = imageID[1];
		} else {
		  	imageID = randomListVal(galleries[gallery_id].featured_images);
		}
		
		if (imageID != 0) {
			img.src = thumbnails[imageID].src;
			img.width = thumbnails[imageID].width;
			img.height = thumbnails[imageID].height;
			img.alt = galleries[gallery_id].title;
			if (updateLink) {
				$(img).parent().attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id),					title: galleries[gallery_id].title				});
			}
		}
	}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp += ' | ';
				}
								temp += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

