window.thumbnails = new Object();
												thumbnails[2415877] = new thumbnail(2415877,'','Gallery pictures coming soon','Logo_thumb.jpg',130, 26,15,'#');
												thumbnails[2415275] = new thumbnail(2415275,'156264','','CT10858-copy_thumb.jpg',130, 73,15,'photo_2415275.html');
												thumbnails[2416491] = new thumbnail(2416491,'156264','Nyala','CT11141-copy_thumb.jpg',130, 96,15,'photo_2416491.html');
												thumbnails[2416497] = new thumbnail(2416497,'156264','','CT11194-copy_thumb.jpg',130, 96,15,'photo_2416497.html');
												thumbnails[2416505] = new thumbnail(2416505,'156264','','CT11244-copy_thumb.jpg',130, 83,15,'photo_2416505.html');
												thumbnails[2416511] = new thumbnail(2416511,'156264','','CT11248-copy_thumb.jpg',130, 97,15,'photo_2416511.html');
												thumbnails[2416539] = new thumbnail(2416539,'156264','','CT11375-copy_thumb.jpg',130, 76,15,'photo_2416539.html');
												thumbnails[2416592] = new thumbnail(2416592,'156264','','CT11410-copy_thumb.jpg',130, 92,15,'photo_2416592.html');
												thumbnails[2416603] = new thumbnail(2416603,'156264','','CT11419-copy_thumb.jpg',130, 87,15,'photo_2416603.html');
												thumbnails[2416938] = new thumbnail(2416938,'156264','Amanzimtoti','CT11506-copy_thumb.jpg',130, 59,15,'photo_2416938.html');
												thumbnails[2416960] = new thumbnail(2416960,'156264','','CT11525-copy_thumb.jpg',130, 80,15,'photo_2416960.html');
												thumbnails[2416962] = new thumbnail(2416962,'156264','','CT11566-copy_thumb.jpg',130, 78,15,'photo_2416962.html');
												thumbnails[2416964] = new thumbnail(2416964,'156264','Underberg - KZN','CT11576-copy_thumb.jpg',130, 69,15,'photo_2416964.html');
												thumbnails[2416977] = new thumbnail(2416977,'156264','Sani Pass','CT11623-copy_thumb.jpg',130, 99,15,'photo_2416977.html');
												thumbnails[2417005] = new thumbnail(2417005,'156264','','CT11690-copy_thumb.jpg',130, 67,15,'photo_2417005.html');
												thumbnails[2417020] = new thumbnail(2417020,'156264','Lesotho','CT11700-copy_thumb.jpg',130, 83,15,'photo_2417020.html');
												thumbnails[2417751] = new thumbnail(2417751,'156264','','CT11721-copy_thumb.jpg',130, 80,15,'photo_2417751.html');
												thumbnails[2417755] = new thumbnail(2417755,'156264','','CT11743-copy_thumb.jpg',130, 87,15,'photo_2417755.html');
												thumbnails[2417804] = new thumbnail(2417804,'156264','','CT11911-copy_thumb.jpg',130, 75,15,'photo_2417804.html');
												thumbnails[2417807] = new thumbnail(2417807,'156264','','CT11860-copy_thumb.jpg',130, 78,15,'photo_2417807.html');
												thumbnails[2417808] = new thumbnail(2417808,'156264','','CT11986-copy_thumb.jpg',130, 149,15,'photo_2417808.html');
												thumbnails[2417824] = new thumbnail(2417824,'156264','','CT11952-copy_thumb.jpg',130, 179,15,'photo_2417824.html');
												thumbnails[2420211] = new thumbnail(2420211,'119333','','CT08781-copy_thumb.jpg',130, 194,15,'photo_2420211.html');
												thumbnails[2420225] = new thumbnail(2420225,'119333','','CT10711-copy_thumb.jpg',130, 194,15,'photo_2420225.html');
												thumbnails[2420230] = new thumbnail(2420230,'119333','','CT11063-copy_thumb.jpg',130, 183,15,'photo_2420230.html');
												thumbnails[2421441] = new thumbnail(2421441,'119278','','5-prom-copy_thumb.jpg',130, 198,15,'photo_2421441.html');
												thumbnails[2421442] = new thumbnail(2421442,'119278','','20-Prom-copy_thumb.jpg',130, 187,15,'photo_2421442.html');
												thumbnails[2421443] = new thumbnail(2421443,'119278','','29-Prom-copy_thumb.jpg',130, 207,15,'photo_2421443.html');
												thumbnails[6617887] = new thumbnail(6617887,'277045','','DSC_4687_copy_thumb.jpg',130, 176,15,'photo_6617887.html');
												thumbnails[6617896] = new thumbnail(6617896,'277045','','DSC_4739_copy_thumb.jpg',130, 87,15,'photo_6617896.html');
												thumbnails[6617899] = new thumbnail(6617899,'277045','','DSC_4746_copy_thumb.jpg',130, 92,15,'photo_6617899.html');
												thumbnails[6617900] = new thumbnail(6617900,'277045','','DSC_4790_copy_thumb.jpg',130, 187,15,'photo_6617900.html');
												thumbnails[6617902] = new thumbnail(6617902,'277045','','DSC_5002_copy_thumb.jpg',130, 194,15,'photo_6617902.html');
												thumbnails[6618577] = new thumbnail(6618577,'277045','','DSC_4892_copy_thumb.jpg',130, 90,15,'photo_6618577.html');
												thumbnails[6618586] = new thumbnail(6618586,'277045','','DSC_4990_copy_thumb.jpg',130, 196,15,'photo_6618586.html');
												thumbnails[6618590] = new thumbnail(6618590,'277045','','DSC_5009_copy_thumb.jpg',130, 179,15,'photo_6618590.html');
												thumbnails[6618621] = new thumbnail(6618621,'277045','','DSC_5024_copy1_thumb.jpg',130, 177,15,'photo_6618621.html');
												thumbnails[6618632] = new thumbnail(6618632,'277045','','DSC_5067_copy_thumb.jpg',130, 196,15,'photo_6618632.html');
												thumbnails[6618716] = new thumbnail(6618716,'277045','','DSC_5091_copy_thumb.jpg',130, 86,15,'photo_6618716.html');
												thumbnails[6618723] = new thumbnail(6618723,'277045','','DSC_5147_copy_thumb.jpg',130, 173,15,'photo_6618723.html');
												thumbnails[6618726] = new thumbnail(6618726,'277045','','DSC_5172_copy_thumb.jpg',130, 189,15,'photo_6618726.html');
												thumbnails[2415187] = new thumbnail(2415187,'156264','Kosi Bay','CT10792-copy_thumb.jpg',130, 76,15,'photo_2415187.html');
												thumbnails[1775036] = new thumbnail(1775036,'119278','','Danielle_thumb.jpg',130, 170,15,'photo_1775036.html');
												thumbnails[1775097] = new thumbnail(1775097,'119333','Foxglove','Foxglove_thumb.jpg',130, 196,15,'photo_1775097.html');
												thumbnails[1775421] = new thumbnail(1775421,'119364','','CT05903-copy_thumb.jpg',130, 181,15,'photo_1775421.html');
												thumbnails[1854996] = new thumbnail(1854996,'119333','','CT08967-copy_edited-2_thumb.jpg',130, 198,15,'photo_1854996.html');
												thumbnails[2415186] = new thumbnail(2415186,'156264','','CT10761-copy_thumb.jpg',130, 170,15,'photo_2415186.html');
												thumbnails[4855490] = new thumbnail(4855490,'277242','','DSC_0121_copy_thumb.jpg',130, 194,15,'photo_4855490.html');
												thumbnails[4861331] = new thumbnail(4861331,'277045','','CT17858_copy_thumb.jpg',130, 194,15,'photo_4861331.html');
												thumbnails[1776536] = new thumbnail(1776536,'119333','','Talybont-Waterfal-copy-2_thumb.jpg',130, 187,15,'photo_1776536.html');
												thumbnails[1775056] = new thumbnail(1775056,'119278','','Bethany_thumb.jpg',130, 197,15,'photo_1775056.html');
												thumbnails[1776307] = new thumbnail(1776307,'119333','','CT0006210-copy-2_thumb.jpg',130, 197,15,'photo_1776307.html');
												thumbnails[2415271] = new thumbnail(2415271,'156264','Kudu - St Lucia','CT10886-copy_thumb.jpg',130, 178,15,'photo_2415271.html');
												thumbnails[4855420] = new thumbnail(4855420,'277242','','DSC_0015_copy_thumb.jpg',130, 179,15,'photo_4855420.html');
												thumbnails[4861519] = new thumbnail(4861519,'277045','','CT17882_copy1_thumb.jpg',130, 96,15,'photo_4861519.html');
												thumbnails[1857647] = new thumbnail(1857647,'119333','','CT08883-copy_edited-2_thumb.jpg',130, 189,15,'photo_1857647.html');
												thumbnails[1775047] = new thumbnail(1775047,'119278','','Georgia_thumb.jpg',130, 194,15,'photo_1775047.html');
												thumbnails[1775362] = new thumbnail(1775362,'119333','','CT0004231-copy_thumb.jpg',130, 166,15,'photo_1775362.html');
												thumbnails[1776080] = new thumbnail(1776080,'119333','','CT0000622-copy_thumb.jpg',130, 196,15,'photo_1776080.html');
												thumbnails[1776150] = new thumbnail(1776150,'119364','','CT03444-copy_thumb.jpg',130, 110,15,'photo_1776150.html');
												thumbnails[2415267] = new thumbnail(2415267,'156264','','CT10809-copy_thumb.jpg',130, 80,15,'photo_2415267.html');
												thumbnails[2416520] = new thumbnail(2416520,'156264','','CT11319-copy_thumb.jpg',130, 176,15,'photo_2416520.html');
												thumbnails[4855946] = new thumbnail(4855946,'277242','','DSC_0126_copy_thumb.jpg',130, 192,15,'photo_4855946.html');
												thumbnails[4861365] = new thumbnail(4861365,'277045','','CT17901_copy1_thumb.jpg',130, 186,15,'photo_4861365.html');
												thumbnails[1775442] = new thumbnail(1775442,'119364','','CT07192-copy_thumb.jpg',130, 118,15,'photo_1775442.html');
												thumbnails[1776541] = new thumbnail(1776541,'119333','','Witch-copy_thumb.jpg',130, 162,15,'photo_1776541.html');
												thumbnails[1777142] = new thumbnail(1777142,'119278','','CT0003637-copy_thumb.jpg',130, 163,15,'photo_1777142.html');
												thumbnails[2416515] = new thumbnail(2416515,'156264','','CT11261-copy_thumb.jpg',130, 172,15,'photo_2416515.html');
												thumbnails[4855948] = new thumbnail(4855948,'277242','','DSC_0137_copy_thumb.jpg',130, 213,15,'photo_4855948.html');
												thumbnails[4861367] = new thumbnail(4861367,'277045','','CT17932_copy_thumb.jpg',130, 213,15,'photo_4861367.html');
												thumbnails[1775054] = new thumbnail(1775054,'119278','','Melona_thumb.jpg',130, 170,15,'photo_1775054.html');
												thumbnails[1776113] = new thumbnail(1776113,'119333','','CTW000164-copy_thumb.jpg',130, 182,15,'photo_1776113.html');
												thumbnails[1776152] = new thumbnail(1776152,'119364','','CT03602-copy_thumb.jpg',130, 122,15,'photo_1776152.html');
												thumbnails[2416984] = new thumbnail(2416984,'156264','','CT11680-copy_thumb.jpg',130, 167,15,'photo_2416984.html');
												thumbnails[4855950] = new thumbnail(4855950,'277242','','DSC_0205_copy_thumb.jpg',130, 185,15,'photo_4855950.html');
												thumbnails[1775062] = new thumbnail(1775062,'119278','','Lowri_thumb.jpg',130, 187,15,'photo_1775062.html');
												thumbnails[1776214] = new thumbnail(1776214,'119364','','CT05704-copy_thumb.jpg',130, 83,15,'photo_1776214.html');
												thumbnails[1782727] = new thumbnail(1782727,'119333','','Otter-Pup-2007-copy1_thumb.jpg',130, 192,15,'photo_1782727.html');
												thumbnails[2417757] = new thumbnail(2417757,'156264','','CT11745-copy_thumb.jpg',130, 194,15,'photo_2417757.html');
												thumbnails[4859922] = new thumbnail(4859922,'277242','','DSC_0185_copy1_thumb.jpg',130, 175,15,'photo_4859922.html');
												thumbnails[4861370] = new thumbnail(4861370,'277045','','CT17986_copy_thumb.jpg',130, 117,15,'photo_4861370.html');
												thumbnails[4864921] = new thumbnail(4864921,'277045','','CT17962_thumb.jpg',130, 173,15,'photo_4864921.html');
												thumbnails[1775096] = new thumbnail(1775096,'119333','','Northcott-Mouth_thumb.jpg',130, 184,15,'photo_1775096.html');
												thumbnails[1775424] = new thumbnail(1775424,'119364','','CT05799-copy_thumb.jpg',130, 82,15,'photo_1775424.html');
												thumbnails[1775439] = new thumbnail(1775439,'119278','','Pirates-copy_thumb.jpg',130, 211,15,'photo_1775439.html');
												thumbnails[2417788] = new thumbnail(2417788,'156264','','CT11826-copy_thumb.jpg',130, 194,15,'photo_2417788.html');
												thumbnails[4861372] = new thumbnail(4861372,'277045','','CT18000_copy_thumb.jpg',130, 155,15,'photo_4861372.html');
												thumbnails[1775052] = new thumbnail(1775052,'119278','','Lucey_thumb.jpg',130, 177,15,'photo_1775052.html');
												thumbnails[1776096] = new thumbnail(1776096,'119364','Nidus Childrens Choir - 2008','Choir-Gratz-brochure-copy_thumb.jpg',130, 90,15,'photo_1776096.html');
												thumbnails[1776131] = new thumbnail(1776131,'119333','','CT00686-copy_thumb.jpg',130, 163,15,'photo_1776131.html');
												thumbnails[2417834] = new thumbnail(2417834,'156264','Protea','CT11885-copy_thumb.jpg',130, 187,15,'photo_2417834.html');
												thumbnails[4865477] = new thumbnail(4865477,'277045','','CT18174_copy_2_thumb.jpg',130, 91,15,'photo_4865477.html');
												thumbnails[1775426] = new thumbnail(1775426,'119364','','Air-Raid-copy_thumb.jpg',130, 76,15,'photo_1775426.html');
												thumbnails[1775544] = new thumbnail(1775544,'119333','','CT01488-copy_thumb.jpg',130, 113,15,'photo_1775544.html');
												thumbnails[2415181] = new thumbnail(2415181,'156264','','CT11875-copy_thumb.jpg',130, 103,15,'photo_2415181.html');
												thumbnails[4861374] = new thumbnail(4861374,'277045','','CT18047_copy_thumb.jpg',130, 118,15,'photo_4861374.html');
												thumbnails[2416500] = new thumbnail(2416500,'156264','Young Kudu','CT11210_thumb.jpg',130, 174,15,'photo_2416500.html');
												thumbnails[1776143] = new thumbnail(1776143,'119278','','CT03090-copy_thumb.jpg',130, 195,15,'photo_1776143.html');
												thumbnails[2417792] = new thumbnail(2417792,'156264','','CT11843_thumb.jpg',130, 196,15,'photo_2417792.html');
												thumbnails[4861376] = new thumbnail(4861376,'277045','','CT18063_copy_thumb.jpg',130, 91,15,'photo_4861376.html');
												thumbnails[2420213] = new thumbnail(2420213,'119333','','CT09926-copy_thumb.jpg',130, 89,15,'photo_2420213.html');
												thumbnails[2420220] = new thumbnail(2420220,'119333','','CT09933-copy_thumb.jpg',130, 83,15,'photo_2420220.html');
												thumbnails[1775433] = new thumbnail(1775433,'119364','','Jade1_thumb.jpg',130, 77,15,'photo_1775433.html');
												thumbnails[1775435] = new thumbnail(1775435,'119278','','Peter-&-Wendy-copy_thumb.jpg',130, 196,15,'photo_1775435.html');
												thumbnails[1776117] = new thumbnail(1776117,'119333','','Newport-Footbridge_thumb.jpg',130, 80,15,'photo_1776117.html');
												thumbnails[4861378] = new thumbnail(4861378,'277045','','CT18070_copy_thumb.jpg',130, 78,15,'photo_4861378.html');
												thumbnails[1775428] = new thumbnail(1775428,'119364','','Gabinick-dance-copy_thumb.jpg',130, 72,15,'photo_1775428.html');
												thumbnails[1776491] = new thumbnail(1776491,'119278','','Megan-copy_thumb.jpg',130, 173,15,'photo_1776491.html');
												thumbnails[4861379] = new thumbnail(4861379,'277045','','CT18072_copy_thumb.jpg',130, 99,15,'photo_4861379.html');
												thumbnails[4861380] = new thumbnail(4861380,'277045','','CT18098_copy_thumb.jpg',130, 171,15,'photo_4861380.html');
												thumbnails[1777146] = new thumbnail(1777146,'119278','','CT0003436-copy_thumb.jpg',130, 166,15,'photo_1777146.html');
												thumbnails[4861381] = new thumbnail(4861381,'277045','','CT18127_copy_thumb.jpg',130, 106,15,'photo_4861381.html');
												thumbnails[1776489] = new thumbnail(1776489,'119278','','Holly-copy1_thumb.jpg',130, 162,15,'photo_1776489.html');
												thumbnails[4861386] = new thumbnail(4861386,'277045','','CT18149_copy_thumb.jpg',130, 92,15,'photo_4861386.html');
												thumbnails[2415819] = new thumbnail(2415819,'119278','Birthday Gift Idea - Fashion Studio Shoot','CT10591-copy_thumb.jpg',130, 105,15,'photo_2415819.html');
												thumbnails[2415869] = new thumbnail(2415869,'119278','','CT10665-copy_thumb.jpg',130, 144,15,'photo_2415869.html');
												thumbnails[2415822] = new thumbnail(2415822,'119278','','CT07994-copy_thumb.jpg',130, 146,15,'photo_2415822.html');
												thumbnails[1806086] = new thumbnail(1806086,'119278','','CT0000883-copy_thumb.jpg',130, 163,15,'photo_1806086.html');
												thumbnails[1806089] = new thumbnail(1806089,'119278','','CT0000238-copy_thumb.jpg',130, 195,15,'photo_1806089.html');
												thumbnails[1894440] = new thumbnail(1894440,'119278','','CT09611-copy_thumb.jpg',130, 172,15,'photo_1894440.html');
												thumbnails[1806098] = new thumbnail(1806098,'119278','','Morgan260-copy_thumb.jpg',130, 157,15,'photo_1806098.html');
												thumbnails[1889756] = new thumbnail(1889756,'119278','','CT04323-copy_thumb.jpg',130, 163,15,'photo_1889756.html');
												thumbnails[1775041] = new thumbnail(1775041,'119278','','Maddy_thumb.jpg',130, 87,15,'photo_1775041.html');
												thumbnails[1775156] = new thumbnail(1775156,'119278','','Molly_thumb.jpg',130, 105,15,'photo_1775156.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[277242] = new gallery(277242,'4855490','Lotte','gallery',[4855490,4855420,4855946,4855948,4855950,4859922],0, 0, '277044', 'gallery_277242.html',0,0);
				  					galleries[156264] = new gallery(156264,'2416515','South Africa','gallery',[2415275,2416491,2416497,2416505,2416511,2416539,2416592,2416603,2416938,2416960,2416962,2416964,2416977,2417005,2417020,2417751,2417755,2417804,2417807,2417808,2417824,2415187,2415186,2415271,2415267,2416520,2416515,2416984,2417757,2417788,2417834,2415181,2416500,2417792],0, 0, '156306', 'gallery_156264.html',0,0);
				  					galleries[119278] = new gallery(119278,'2421442','Studio','gallery',[2421441,2421442,2421443,1775036,1775056,1775047,1777142,1775054,1775062,1775439,1775052,1776143,1775435,1776491,1777146,1776489,2415819,2415869,2415822,1806086,1806089,1894440,1806098,1889756,1775041,1775156],0, 0, '', 'gallery_119278.html',0,0);
				  					galleries[119333] = new gallery(119333,'1775096','Location','gallery',[2420211,2420225,2420230,1775097,1854996,1776536,1776307,1857647,1775362,1776080,1776541,1776113,1782727,1775096,1776131,1775544,2420213,2420220,1776117],0, 0, '', 'gallery_119333.html',0,0);
				  					galleries[277044] = new gallery(277044,'4855490','Model Portfolio','gallery',[],0, 0, '', 'gallery_277044.html',0,0);
				  					galleries[277045] = new gallery(277045,'4861331','Wedding','gallery',[6617887,6617896,6617899,6617900,6617902,6618577,6618586,6618590,6618621,6618632,6618716,6618723,6618726,4861331,4861519,4861365,4861367,4861370,4864921,4861372,4865477,4861374,4861376,4861378,4861379,4861380,4861381,4861386],0, 0, '', 'gallery_277045.html',0,0);
				  					galleries[119364] = new gallery(119364,'1775421','Theatre','gallery',[1775421,1776150,1775442,1776152,1776214,1775424,1776096,1775426,1775433,1775428],0, 0, '', 'gallery_119364.html',0,0);
				  					galleries[156306] = new gallery(156306,'2416515','Travel','gallery',[],0, 0, '', 'gallery_156306.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '1775433';
imageSets[2] = '4861331,4855490,2421442,2416515,1775421,1775096';
imageSets[3] = '4865477,4861519,4861386,4861381,4861380,4861379,4861378,4861376,4861374,4861370,4861367,4861365,4861331,4859922,4855950,4855490,4855420,2420220,2420213,2416515,2415271,1775442,1775421';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/christottle/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/christottle/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/christottle/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/christottle/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/christottle/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/christottle/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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'Chris Tottle - Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = 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 = 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

