window.thumbnails = new Object();
												thumbnails[2320824] = new thumbnail(2320824,'','','lc_0057ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320886] = new thumbnail(2320886,'','','lc_0118ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320887] = new thumbnail(2320887,'','','lc_0225ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320888] = new thumbnail(2320888,'','','lc_0230ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320891] = new thumbnail(2320891,'','','lc_0313ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320915] = new thumbnail(2320915,'','','lc_0295ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320916] = new thumbnail(2320916,'','','lc_0272ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320920] = new thumbnail(2320920,'','','lc_0274ab_thumb.jpg',130, 162,18,'#');
												thumbnails[2320926] = new thumbnail(2320926,'','','lc_0261ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320928] = new thumbnail(2320928,'','','lc_0334ab_thumb.jpg',130, 163,18,'#');
												thumbnails[2320934] = new thumbnail(2320934,'','','lc_0199ab_thumb.jpg',130, 163,18,'#');
												thumbnails[3917689] = new thumbnail(3917689,'','','2005_0628_141157AA_thumb.jpg',130, 163,18,'#');
												thumbnails[3917691] = new thumbnail(3917691,'','','20-Wallace-Gichere_thumb.jpg',130, 163,18,'#');
												thumbnails[3977872] = new thumbnail(3977872,'','','av5_thumb.jpg',130, 163,18,'#');
												thumbnails[3977879] = new thumbnail(3977879,'','','17-Akoth-Maki-Otieno-2_thumb.jpg',130, 163,18,'#');
												thumbnails[3977883] = new thumbnail(3977883,'','','av7_thumb.jpg',130, 162,18,'#');
												thumbnails[3977914] = new thumbnail(3977914,'','','2005_0710_121833AA_thumb.jpg',130, 163,18,'#');
												thumbnails[3977924] = new thumbnail(3977924,'','','AV2-2_thumb.jpg',130, 163,18,'#');
												thumbnails[3977928] = new thumbnail(3977928,'','','17-Joseph-Rotich-2_thumb.jpg',130, 163,18,'#');
												thumbnails[3977942] = new thumbnail(3977942,'','','2005_0710_093946AA-2_thumb.jpg',130, 163,18,'#');
												thumbnails[3977945] = new thumbnail(3977945,'','','20-Wallace-Gichere-2_thumb.jpg',130, 163,18,'#');
												thumbnails[3977954] = new thumbnail(3977954,'','','39-Guarding-the-kitchens_thumb.jpg',130, 163,18,'#');
												thumbnails[3977967] = new thumbnail(3977967,'','','2005_0710_12-2_thumb.jpg',130, 162,18,'#');
												thumbnails[3977986] = new thumbnail(3977986,'','','2005_0709_130154AA-2_thumb.jpg',130, 163,18,'#');
												thumbnails[3977996] = new thumbnail(3977996,'','','2005_0703_thumb.jpg',130, 163,18,'#');
												thumbnails[3978118] = new thumbnail(3978118,'','','IMG_2306a-2_thumb.jpg',130, 160,18,'#');
												thumbnails[3978121] = new thumbnail(3978121,'','','2005_0710_100106AA_thumb.jpg',130, 163,18,'#');
												thumbnails[3978124] = new thumbnail(3978124,'','','2005_0710_132311_thumb.jpg',130, 163,18,'#');
												thumbnails[4380219] = new thumbnail(4380219,'','','a23r_thumb.jpg',104, 130,18,'#');
												thumbnails[4380248] = new thumbnail(4380248,'','','_MG_9437d_thumb.jpg',104, 130,18,'#');
												thumbnails[4380249] = new thumbnail(4380249,'','','IMG_0027b_thumb.jpg',104, 130,18,'#');
												thumbnails[4380253] = new thumbnail(4380253,'','','IMG_0004_thumb.jpg',104, 130,18,'#');
												thumbnails[4380307] = new thumbnail(4380307,'','','t_0002s_thumb.jpg',104, 130,18,'#');
												thumbnails[4380310] = new thumbnail(4380310,'','','v7a_thumb.jpg',104, 130,18,'#');
												thumbnails[4380653] = new thumbnail(4380653,'','','IMG_0075_thumb.jpg',104, 130,18,'#');
												thumbnails[5209511] = new thumbnail(5209511,'','','a_2966a_thumb.jpg',104, 130,18,'#');
												thumbnails[5209512] = new thumbnail(5209512,'','','a_2973A_thumb.jpg',104, 130,18,'#');
												thumbnails[5209513] = new thumbnail(5209513,'','','a_2987_thumb.jpg',104, 130,18,'#');
												thumbnails[5209529] = new thumbnail(5209529,'','','a_Johnny_Fean_thumb.jpg',104, 130,18,'#');
												thumbnails[5209530] = new thumbnail(5209530,'','','Barry_Devlin_thumb.jpg',104, 130,18,'#');
												thumbnails[5209531] = new thumbnail(5209531,'','','Eamon_Carr_-_Horslips_thumb.jpg',104, 130,18,'#');
												thumbnails[5209532] = new thumbnail(5209532,'','','Johnny_Fean_thumb.jpg',104, 130,18,'#');
												thumbnails[5209533] = new thumbnail(5209533,'','','a_3053_thumb.jpg',104, 130,18,'#');
												thumbnails[5209537] = new thumbnail(5209537,'','','a_3260_thumb.jpg',130, 104,18,'#');
												thumbnails[5209546] = new thumbnail(5209546,'','','Barry_2_thumb.jpg',104, 130,18,'#');
												thumbnails[5211010] = new thumbnail(5211010,'','','h_2988a_thumb.jpg',104, 130,18,'#');
												thumbnails[5211041] = new thumbnail(5211041,'','','h_2941a1_thumb.jpg',104, 130,18,'#');
												thumbnails[5211045] = new thumbnail(5211045,'','','h_3083a_thumb.jpg',104, 130,18,'#');
												thumbnails[5211053] = new thumbnail(5211053,'','','Johnny_Fean11_thumb.jpg',104, 130,18,'#');
												thumbnails[5211055] = new thumbnail(5211055,'','','h_3070a_thumb.jpg',104, 130,18,'#');
												thumbnails[5211135] = new thumbnail(5211135,'','','m_9865s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211137] = new thumbnail(5211137,'','','m_9890s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211149] = new thumbnail(5211149,'','','m_9894s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211153] = new thumbnail(5211153,'','','m_9960s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211156] = new thumbnail(5211156,'','','m_9854s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211161] = new thumbnail(5211161,'','','m_9982s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211168] = new thumbnail(5211168,'','','m_9918s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211171] = new thumbnail(5211171,'','','m_9912s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211175] = new thumbnail(5211175,'','','m_9855s_thumb.jpg',104, 130,18,'#');
												thumbnails[5211193] = new thumbnail(5211193,'','','m_9943s_thumb.jpg',104, 130,18,'#');
												thumbnails[5917716] = new thumbnail(5917716,'','','shane_0314a_thumb.jpg',104, 130,18,'#');
												thumbnails[5917843] = new thumbnail(5917843,'','','13a_thumb.jpg',104, 130,18,'#');
												thumbnails[5917971] = new thumbnail(5917971,'','','IMG_0170-3_thumb.jpg',104, 130,18,'#');
												thumbnails[5917998] = new thumbnail(5917998,'','','Amanda--Fr-Tony_thumb.jpg',104, 130,18,'#');
												thumbnails[5918065] = new thumbnail(5918065,'','','j_171_thumb.jpg',104, 130,18,'#');
												thumbnails[6998260] = new thumbnail(6998260,'','','tj_0040a_thumb.jpg',104, 130,18,'#');
												thumbnails[6998635] = new thumbnail(6998635,'','','tj_0098a_thumb.jpg',104, 130,18,'#');
												thumbnails[7003666] = new thumbnail(7003666,'','','IMG_0484_thumb.jpg',104, 130,18,'#');
												thumbnails[1389058] = new thumbnail(1389058,'','','jose_thumb.jpg',130, 163,18,'#');
												thumbnails[1311895] = new thumbnail(1311895,'','','gf_11_thumb.jpg',130, 163,18,'#');
												thumbnails[5209510] = new thumbnail(5209510,'','','a_29621_thumb.jpg',104, 130,18,'#');
												thumbnails[4378928] = new thumbnail(4378928,'94372','','_MG_4382a1_thumb.jpg',104, 130,18,'photo_4378928.html');
												thumbnails[4378952] = new thumbnail(4378952,'94372','','IMG_0020a2_thumb.jpg',104, 130,18,'photo_4378952.html');
												thumbnails[4378958] = new thumbnail(4378958,'94372','','prg_05222_thumb.jpg',104, 130,18,'photo_4378958.html');
												thumbnails[4378974] = new thumbnail(4378974,'94372','','ww_001_thumb.jpg',104, 130,18,'photo_4378974.html');
												thumbnails[4378978] = new thumbnail(4378978,'94372','','tt2a_thumb.jpg',104, 130,18,'photo_4378978.html');
												thumbnails[4379008] = new thumbnail(4379008,'94372','','ww_8802_thumb.jpg',104, 130,18,'photo_4379008.html');
												thumbnails[4379015] = new thumbnail(4379015,'94372','','ww_6592_thumb.jpg',104, 130,18,'photo_4379015.html');
												thumbnails[4379027] = new thumbnail(4379027,'94372','','Jim_Shaw_25_5_05_thumb.jpg',104, 130,18,'photo_4379027.html');
												thumbnails[5209534] = new thumbnail(5209534,'94372','','a_2803_thumb.jpg',104, 130,18,'photo_5209534.html');
												thumbnails[5918563] = new thumbnail(5918563,'94372','','Alejandra-Badaracco_0402a_thumb.jpg',104, 130,18,'photo_5918563.html');
												thumbnails[5918774] = new thumbnail(5918774,'94372','','lc_0315a_thumb.jpg',104, 130,18,'photo_5918774.html');
												thumbnails[7175352] = new thumbnail(7175352,'94372','','222_thumb.jpg',104, 130,18,'photo_7175352.html');
												thumbnails[5917837] = new thumbnail(5917837,'379244','','2005_0710_132316AA_thumb.jpg',104, 130,18,'photo_5917837.html');
												thumbnails[5917900] = new thumbnail(5917900,'379244','','cfn1_thumb.jpg',104, 130,18,'photo_5917900.html');
												thumbnails[6998862] = new thumbnail(6998862,'379244','','m_8993_thumb.jpg',104, 130,18,'photo_6998862.html');
												thumbnails[6998868] = new thumbnail(6998868,'379244','','2005_0703_12_thumb.jpg',104, 130,18,'photo_6998868.html');
												thumbnails[6998882] = new thumbnail(6998882,'379244','','Michael-Prince-3_thumb.jpg',104, 130,18,'photo_6998882.html');
												thumbnails[6998892] = new thumbnail(6998892,'379244','','13_g0026_thumb.jpg',104, 130,18,'photo_6998892.html');
												thumbnails[6998898] = new thumbnail(6998898,'379244','','IMG_1115_thumb.jpg',104, 130,18,'photo_6998898.html');
												thumbnails[6998916] = new thumbnail(6998916,'379244','','18_10083_thumb.jpg',104, 130,18,'photo_6998916.html');
												thumbnails[6998931] = new thumbnail(6998931,'379244','','f_1738_thumb.jpg',104, 130,18,'photo_6998931.html');
												thumbnails[6998946] = new thumbnail(6998946,'379244','','ch_0030_thumb.jpg',104, 130,18,'photo_6998946.html');
												thumbnails[6998991] = new thumbnail(6998991,'379244','','hs_2016_thumb.jpg',104, 130,18,'photo_6998991.html');
												thumbnails[7175351] = new thumbnail(7175351,'379244','','1111_thumb.jpg',104, 130,18,'photo_7175351.html');
												thumbnails[4378940] = new thumbnail(4378940,'387606','','joe_7524a_thumb.jpg',104, 130,18,'photo_4378940.html');
												thumbnails[5211130] = new thumbnail(5211130,'387606','','m_9837s_thumb.jpg',104, 130,18,'photo_5211130.html');
												thumbnails[5300294] = new thumbnail(5300294,'387606','','Katya_0111_thumb.jpg',104, 130,18,'photo_5300294.html');
												thumbnails[5917983] = new thumbnail(5917983,'387606','','lisa_thumb.jpg',104, 130,18,'photo_5917983.html');
												thumbnails[6996131] = new thumbnail(6996131,'387606','','large_0180a_thumb.jpg',104, 130,18,'photo_6996131.html');
												thumbnails[6998639] = new thumbnail(6998639,'387606','','tj_0085a1_thumb.jpg',104, 130,18,'photo_6998639.html');
												thumbnails[6998776] = new thumbnail(6998776,'387606','','_MG_2831_thumb.jpg',104, 130,18,'photo_6998776.html');
												thumbnails[7003663] = new thumbnail(7003663,'387606','','1_8_thumb.jpg',104, 130,18,'photo_7003663.html');
												thumbnails[7003759] = new thumbnail(7003759,'387606','','_MG_34402_thumb.jpg',104, 130,18,'photo_7003759.html');
												thumbnails[7309404] = new thumbnail(7309404,'387606','','tj_0040a_9AF91B4D-1EC9-D45B-1C063D9D573747A8_thumb.jpg',104, 130,18,'photo_7309404.html');
												thumbnails[7437102] = new thumbnail(7437102,'387606','','h_9633_thumb.jpg',160, 107,18,'photo_7437102.html');
												thumbnails[5918655] = new thumbnail(5918655,'387606','','l_1326e_thumb.jpg',104, 130,18,'photo_5918655.html');
												thumbnails[7173246] = new thumbnail(7173246,'387602','','20_thumb.jpg',160, 128,18,'photo_7173246.html');
												thumbnails[7173249] = new thumbnail(7173249,'387602','','14_thumb.jpg',104, 130,18,'photo_7173249.html');
												thumbnails[7173253] = new thumbnail(7173253,'387602','','6_thumb.jpg',104, 130,18,'photo_7173253.html');
												thumbnails[7173261] = new thumbnail(7173261,'387602','','2_thumb.jpg',104, 130,18,'photo_7173261.html');
												thumbnails[7173281] = new thumbnail(7173281,'387602','','15_thumb.jpg',160, 128,18,'photo_7173281.html');
												thumbnails[7173287] = new thumbnail(7173287,'387602','','131_thumb.jpg',104, 130,18,'photo_7173287.html');
												thumbnails[7173288] = new thumbnail(7173288,'387602','','3_thumb.jpg',104, 130,18,'photo_7173288.html');
												thumbnails[7173289] = new thumbnail(7173289,'387602','','111_thumb.jpg',104, 130,18,'photo_7173289.html');
												thumbnails[7173299] = new thumbnail(7173299,'387602','','5_thumb.jpg',160, 128,18,'photo_7173299.html');
												thumbnails[7173300] = new thumbnail(7173300,'387602','','1_thumb.jpg',104, 130,18,'photo_7173300.html');
												thumbnails[7173303] = new thumbnail(7173303,'387602','','71_thumb.jpg',104, 130,18,'photo_7173303.html');
												thumbnails[7173304] = new thumbnail(7173304,'387602','','18_thumb.jpg',104, 130,18,'photo_7173304.html');
												thumbnails[4261855] = new thumbnail(4261855,'252077','','IMG_0440-2_thumb.jpg',130, 163,18,'photo_4261855.html');
												thumbnails[4261859] = new thumbnail(4261859,'252077','','IMG_3327_thumb.jpg',130, 163,18,'photo_4261859.html');
												thumbnails[4261876] = new thumbnail(4261876,'252077','','IMG_3593_thumb.jpg',130, 163,18,'photo_4261876.html');
												thumbnails[4261878] = new thumbnail(4261878,'252077','','IMG_0512b_thumb.jpg',130, 163,18,'photo_4261878.html');
												thumbnails[4261932] = new thumbnail(4261932,'252077','','IMG_000_00053a_thumb.jpg',130, 163,18,'photo_4261932.html');
												thumbnails[4261953] = new thumbnail(4261953,'252077','','36_thumb.jpg',130, 163,18,'photo_4261953.html');
												thumbnails[4262222] = new thumbnail(4262222,'252077','','IMG_000_00008-copy_thumb.jpg',130, 163,18,'photo_4262222.html');
												thumbnails[4262236] = new thumbnail(4262236,'252077','','Copy-of-prk_0240a1_thumb.jpg',130, 163,18,'photo_4262236.html');
												thumbnails[4380457] = new thumbnail(4380457,'252077','','IMG_000_00060c_thumb.jpg',104, 130,18,'photo_4380457.html');
												thumbnails[4380460] = new thumbnail(4380460,'252077','','IMG_05112_thumb.jpg',104, 130,18,'photo_4380460.html');
												thumbnails[4380462] = new thumbnail(4380462,'252077','','IMG_000_00003_thumb.jpg',104, 130,18,'photo_4380462.html');
												thumbnails[5918896] = new thumbnail(5918896,'252077','','aIMG_0666_thumb.jpg',130, 104,18,'photo_5918896.html');
												thumbnails[5918913] = new thumbnail(5918913,'252077','','IMG_000_00069_thumb.jpg',130, 104,18,'photo_5918913.html');
												thumbnails[5918929] = new thumbnail(5918929,'252077','','IMG_3799_thumb.jpg',104, 130,18,'photo_5918929.html');
												thumbnails[6439778] = new thumbnail(6439778,'252077','','ms_0122a_thumb.jpg',130, 104,18,'photo_6439778.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[387606] = new gallery(387606,'7437102,7309404,7003759,7003663,6998776,6998639,6996131,5918655,5917983,5300294','Formal Portraits','section460970',[4378940,5211130,5300294,5917983,6996131,6998639,6998776,7003663,7003759,7309404,7437102,5918655],0, 0, '', 'section460970.html',0,1);
				  					galleries[94372] = new gallery(94372,'7175352,5918774,5918563,5209534,4379027,4379015,4379008,4378978,4378974,4378958','Gallery One','section127521',[4378928,4378952,4378958,4378974,4378978,4379008,4379015,4379027,5209534,5918563,5918774,7175352],0, 0, '', 'section127521.html',0,1);
				  					galleries[387602] = new gallery(387602,'7173304,7173303,7173300,7173299,7173289,7173288,7173287,7173281,7173261,7173253','Reportage','section460971',[7173246,7173249,7173253,7173261,7173281,7173287,7173288,7173289,7173299,7173300,7173303,7173304],0, 0, '', 'section460971.html',0,1);
				  					galleries[252077] = new gallery(252077,'6439778,5918929,5918913,5918896,4380462,4380460,4380457,4262236,4262222,4261953','Weddings','section304907',[4261855,4261859,4261876,4261878,4261932,4261953,4262222,4262236,4380457,4380460,4380462,5918896,5918913,5918929,6439778],0, 0, '', 'section304907.html',0,1);
				  					galleries[379244] = new gallery(379244,'7175351,6998991,6998946,6998931,6998916,6998898,6998892,6998882,6998868,6998862','Gallery 2','section451245',[5917837,5917900,6998862,6998868,6998882,6998892,6998898,6998916,6998931,6998946,6998991,7175351],0, 1, '', 'section451245.html',0,1);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7437102,5300294,5211130,4380248,4379015,4378974,4378940';
imageSets[3] = '7437102,7309404,7175352,7175351,7173304,7173303,7173300,7173299,7173289,7173288,7173287,7173281,7173261,7173253,7173249,7173246,7003759,7003666,7003663,6998991,6998946,6998931,6998916,6998898,6998892,6998882,6998868,6998862,6998776,6998639,6998635,6998260,6996131,6439778,5918929,5918913,5918896,5918774,5918655,5918563,5918065,5917998,5917983,5917971,5917900,5917843,5917837,5917716,5300294,5211193';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/michaelstamp/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/michaelstamp/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 += 'section127521.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 && 'section127521' != '') {
					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 = 'Michael Stamp 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 == undefined) {
    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;
	}
}

			

