window.thumbnails = new Object();
												thumbnails[2161724] = new thumbnail(2161724,'','','new018_thumb.jpg',130, 179,18,'							photo_2161724.html');
												thumbnails[2161761] = new thumbnail(2161761,'','','new019_thumb.jpg',130, 179,18,'							photo_2161761.html');
												thumbnails[5916711] = new thumbnail(5916711,'','','new051_thumb.jpg',130, 98,18,'							photo_5916711.html');
												thumbnails[3348475] = new thumbnail(3348475,'','','new023_thumb.jpg',130, 98,18,'							photo_3348475.html');
												thumbnails[3358698] = new thumbnail(3358698,'10142','','new026_thumb.jpg',130, 179,18,'							photo_3358698.html');
												thumbnails[1063271] = new thumbnail(1063271,'10018','','web97_thumb.jpg',130, 179,18,'							photo_1063271.html');
												thumbnails[3358661] = new thumbnail(3358661,'10142','','new007_thumb.jpg',130, 179,18,'							photo_3358661.html');
												thumbnails[5616642] = new thumbnail(5616642,'44734','','new038_thumb.jpg',130, 179,18,'							photo_5616642.html');
												thumbnails[5916050] = new thumbnail(5916050,'10016','','new053_thumb.jpg',130, 179,18,'							photo_5916050.html');
												thumbnails[1063275] = new thumbnail(1063275,'10018','','web98_thumb.jpg',130, 179,18,'							photo_1063275.html');
												thumbnails[3358725] = new thumbnail(3358725,'10142','','new027_thumb.jpg',130, 179,18,'							photo_3358725.html');
												thumbnails[5616644] = new thumbnail(5616644,'44734','','new040_thumb.jpg',130, 179,18,'							photo_5616644.html');
												thumbnails[5916047] = new thumbnail(5916047,'10016','','new052_thumb.jpg',130, 179,18,'							photo_5916047.html');
												thumbnails[1063282] = new thumbnail(1063282,'10018','','web99_thumb.jpg',130, 179,18,'							photo_1063282.html');
												thumbnails[2161752] = new thumbnail(2161752,'10016','','new017_thumb.jpg',130, 179,18,'							photo_2161752.html');
												thumbnails[5616646] = new thumbnail(5616646,'44734','','new042_thumb.jpg',130, 179,18,'							photo_5616646.html');
												thumbnails[1063285] = new thumbnail(1063285,'10018','','web1001_thumb.jpg',130, 98,18,'							photo_1063285.html');
												thumbnails[5616660] = new thumbnail(5616660,'44734','','new044_thumb.jpg',130, 179,18,'							photo_5616660.html');
												thumbnails[5933515] = new thumbnail(5933515,'10016','','web7_thumb.jpg',130, 87,18,'							photo_5933515.html');
												thumbnails[5933528] = new thumbnail(5933528,'10142','','web8_thumb.jpg',130, 98,18,'							photo_5933528.html');
												thumbnails[1063296] = new thumbnail(1063296,'10018','','web1011_thumb.jpg',130, 98,18,'							photo_1063296.html');
												thumbnails[5616662] = new thumbnail(5616662,'44734','','new041_thumb.jpg',130, 179,18,'							photo_5616662.html');
												thumbnails[5933518] = new thumbnail(5933518,'10016','','web010_thumb.jpg',130, 98,18,'							photo_5933518.html');
												thumbnails[5933551] = new thumbnail(5933551,'10142','','web9_thumb.jpg',130, 98,18,'							photo_5933551.html');
												thumbnails[1063298] = new thumbnail(1063298,'10018','','web102_thumb.jpg',130, 98,18,'							photo_1063298.html');
												thumbnails[5616665] = new thumbnail(5616665,'44734','Steff & Helen Married at the Stradey Park Hotel , Llanelli ','new043_thumb.jpg',130, 179,18,'							photo_5616665.html');
												thumbnails[5933520] = new thumbnail(5933520,'10016','','web12_thumb.jpg',130, 98,18,'							photo_5933520.html');
												thumbnails[5933552] = new thumbnail(5933552,'10142','','web11_thumb.jpg',130, 98,18,'							photo_5933552.html');
												thumbnails[110464] = new thumbnail(110464,'10018','','web119_thumb.jpg',130, 179,18,'							photo_110464.html');
												thumbnails[3358765] = new thumbnail(3358765,'10142','','new029_thumb.jpg',130, 179,18,'							photo_3358765.html');
												thumbnails[3358785] = new thumbnail(3358785,'10142','','new012_thumb.jpg',130, 179,18,'							photo_3358785.html');
												thumbnails[3361863] = new thumbnail(3361863,'10142','','new033_thumb.jpg',130, 179,18,'							photo_3361863.html');
												thumbnails[5616681] = new thumbnail(5616681,'44734','','new048_thumb.jpg',130, 98,18,'							photo_5616681.html');
												thumbnails[5933576] = new thumbnail(5933576,'10016','','web13_thumb.jpg',130, 179,18,'							photo_5933576.html');
												thumbnails[1940371] = new thumbnail(1940371,'10018','','web105_1_thumb.jpg',130, 179,18,'							photo_1940371.html');
												thumbnails[1940397] = new thumbnail(1940397,'10018','','web106_2_thumb.jpg',130, 179,18,'							photo_1940397.html');
												thumbnails[3358867] = new thumbnail(3358867,'10142','','new030_thumb.jpg',130, 179,18,'							photo_3358867.html');
												thumbnails[3361864] = new thumbnail(3361864,'10142','','new032_thumb.jpg',130, 179,18,'							photo_3361864.html');
												thumbnails[5616684] = new thumbnail(5616684,'44734','','new050_thumb.jpg',130, 98,18,'							photo_5616684.html');
												thumbnails[5933580] = new thumbnail(5933580,'10016','','web14_thumb.jpg',130, 179,18,'							photo_5933580.html');
												thumbnails[1063317] = new thumbnail(1063317,'10018','','web103_thumb.jpg',130, 163,18,'							photo_1063317.html');
												thumbnails[3361862] = new thumbnail(3361862,'10142','','new031_thumb.jpg',130, 179,18,'							photo_3361862.html');
												thumbnails[3361963] = new thumbnail(3361963,'10142','','new034_thumb.jpg',130, 98,18,'							photo_3361963.html');
												thumbnails[5616687] = new thumbnail(5616687,'44734','','new046_thumb.jpg',130, 98,18,'							photo_5616687.html');
												thumbnails[5933586] = new thumbnail(5933586,'10016','','web15_thumb.jpg',130, 179,18,'							photo_5933586.html');
												thumbnails[3361979] = new thumbnail(3361979,'10142','','new035_thumb.jpg',130, 98,18,'							photo_3361979.html');
												thumbnails[5933631] = new thumbnail(5933631,'44734','','web16_thumb.jpg',130, 179,18,'							photo_5933631.html');
												thumbnails[3361980] = new thumbnail(3361980,'10142','','new036_thumb.jpg',130, 98,18,'							photo_3361980.html');
												thumbnails[5933633] = new thumbnail(5933633,'44734','','web17_thumb.jpg',130, 179,18,'							photo_5933633.html');
												thumbnails[6872062] = new thumbnail(6872062,'10016','','new056_thumb.jpg',130, 98,18,'							photo_6872062.html');
												thumbnails[459583] = new thumbnail(459583,'10142','','web86_thumb.jpg',130, 179,18,'							photo_459583.html');
												thumbnails[1063321] = new thumbnail(1063321,'10018','','web104_thumb.jpg',130, 163,18,'							photo_1063321.html');
												thumbnails[5933635] = new thumbnail(5933635,'44734','','web18_thumb.jpg',130, 179,18,'							photo_5933635.html');
												thumbnails[6872064] = new thumbnail(6872064,'10016','','new054_thumb.jpg',130, 98,18,'							photo_6872064.html');
												thumbnails[210277] = new thumbnail(210277,'10018','','portrait6_thumb.jpg',130, 163,18,'							photo_210277.html');
												thumbnails[5643481] = new thumbnail(5643481,'44734','','web6_thumb.jpg',130, 179,18,'							photo_5643481.html');
												thumbnails[6872067] = new thumbnail(6872067,'10016','','new064_thumb.jpg',130, 98,18,'							photo_6872067.html');
												thumbnails[5643150] = new thumbnail(5643150,'44734','','web4_thumb.jpg',130, 179,18,'							photo_5643150.html');
												thumbnails[6872082] = new thumbnail(6872082,'10016','','new057_thumb.jpg',130, 179,18,'							photo_6872082.html');
												thumbnails[569980] = new thumbnail(569980,'10142','','web90_thumb.jpg',130, 179,18,'							photo_569980.html');
												thumbnails[5643364] = new thumbnail(5643364,'44734','','web5_thumb.jpg',130, 179,18,'							photo_5643364.html');
												thumbnails[6872087] = new thumbnail(6872087,'10016','','new055_thumb.jpg',130, 179,18,'							photo_6872087.html');
												thumbnails[116755] = new thumbnail(116755,'10142','','web981_thumb.jpg',130, 173,18,'							photo_116755.html');
												thumbnails[6872092] = new thumbnail(6872092,'10016','','new061_thumb.jpg',130, 179,18,'							photo_6872092.html');
												thumbnails[163482] = new thumbnail(163482,'10142','','web93_thumb.jpg',130, 98,18,'							photo_163482.html');
												thumbnails[163483] = new thumbnail(163483,'10142','','web57_thumb.jpg',130, 98,18,'							photo_163483.html');
												thumbnails[106038] = new thumbnail(106038,'10016','','new015_thumb.jpg',130, 179,18,'							photo_106038.html');
												thumbnails[163484] = new thumbnail(163484,'10142','','web1002_thumb.jpg',130, 98,18,'							photo_163484.html');
												thumbnails[1011032] = new thumbnail(1011032,'44734','','web96_thumb.jpg',130, 163,18,'							photo_1011032.html');
												thumbnails[384321] = new thumbnail(384321,'10016','','new008_thumb.jpg',130, 179,18,'							photo_384321.html');
												thumbnails[1078483] = new thumbnail(1078483,'44734','','web106_thumb.jpg',130, 179,18,'							photo_1078483.html');
												thumbnails[1940424] = new thumbnail(1940424,'10142','','web108_thumb.jpg',130, 179,18,'							photo_1940424.html');
												thumbnails[1078500] = new thumbnail(1078500,'44734','','web1083_thumb.jpg',130, 179,18,'							photo_1078500.html');
												thumbnails[1940409] = new thumbnail(1940409,'10142','','web107_thumb.jpg',130, 179,18,'							photo_1940409.html');
												thumbnails[1207141] = new thumbnail(1207141,'44734','','web112_thumb.jpg',130, 98,18,'							photo_1207141.html');
												thumbnails[1940463] = new thumbnail(1940463,'10142','','web109_1_thumb.jpg',130, 179,18,'							photo_1940463.html');
												thumbnails[108454] = new thumbnail(108454,'10142','','web1111_thumb.jpg',130, 179,18,'							photo_108454.html');
												thumbnails[1207150] = new thumbnail(1207150,'44734','','web113_thumb.jpg',130, 98,18,'							photo_1207150.html');
												thumbnails[457107] = new thumbnail(457107,'10142','','web115_1_thumb.jpg',130, 179,18,'							photo_457107.html');
												thumbnails[1207156] = new thumbnail(1207156,'44734','','web114_thumb.jpg',130, 98,18,'							photo_1207156.html');
												thumbnails[457122] = new thumbnail(457122,'10142','','web107 copy_thumb.jpg',130, 179,18,'							photo_457122.html');
												thumbnails[1645860] = new thumbnail(1645860,'44734','','web116_thumb.jpg',130, 173,18,'							photo_1645860.html');
												thumbnails[457091] = new thumbnail(457091,'10142','','web82_thumb.jpg',130, 98,18,'							photo_457091.html');
												thumbnails[1645889] = new thumbnail(1645889,'44734','','web117_thumb.jpg',130, 173,18,'							photo_1645889.html');
												thumbnails[1011022] = new thumbnail(1011022,'10142','','web95_thumb.jpg',130, 98,18,'							photo_1011022.html');
												thumbnails[1645892] = new thumbnail(1645892,'44734','','web118_1_thumb.jpg',130, 173,18,'							photo_1645892.html');
												thumbnails[1793286] = new thumbnail(1793286,'44734','','web120_thumb.jpg',130, 98,18,'							photo_1793286.html');
												thumbnails[459592] = new thumbnail(459592,'10142','','web1012_thumb.jpg',130, 98,18,'							photo_459592.html');
												thumbnails[1793298] = new thumbnail(1793298,'44734','','web121_thumb.jpg',130, 98,18,'							photo_1793298.html');
												thumbnails[384301] = new thumbnail(384301,'10016','','new001_thumb.jpg',130, 179,18,'							photo_384301.html');
												thumbnails[1011932] = new thumbnail(1011932,'10018','','Untitled-11_thumb.jpg',130, 179,18,'							photo_1011932.html');
												thumbnails[5616589] = new thumbnail(5616589,'10016','','new045_thumb.jpg',130, 98,18,'							photo_5616589.html');
												thumbnails[5616591] = new thumbnail(5616591,'10016','','new039_thumb.jpg',130, 98,18,'							photo_5616591.html');
												thumbnails[5616595] = new thumbnail(5616595,'10016','','new047_thumb.jpg',130, 98,18,'							photo_5616595.html');
												thumbnails[380840] = new thumbnail(380840,'10016','','new003_thumb.jpg',130, 179,18,'							photo_380840.html');
												thumbnails[384441] = new thumbnail(384441,'10016','','new005_thumb.jpg',130, 179,18,'							photo_384441.html');
												thumbnails[384426] = new thumbnail(384426,'10016','','new016_thumb.jpg',130, 179,18,'							photo_384426.html');
												thumbnails[5642794] = new thumbnail(5642794,'10016','','web1_thumb.jpg',130, 87,18,'							photo_5642794.html');
												thumbnails[5642984] = new thumbnail(5642984,'10016','','web3_thumb.jpg',130, 87,18,'							photo_5642984.html');
												thumbnails[5643016] = new thumbnail(5643016,'10016','','web21_thumb.jpg',130, 87,18,'							photo_5643016.html');
												thumbnails[381445] = new thumbnail(381445,'10016','','web105_thumb.jpg',130, 179,18,'							photo_381445.html');
												thumbnails[384451] = new thumbnail(384451,'10016','','new009_thumb.jpg',130, 179,18,'							photo_384451.html');
												thumbnails[384560] = new thumbnail(384560,'10016','','new014_thumb.jpg',130, 179,18,'							photo_384560.html');
												thumbnails[273096] = new thumbnail(273096,'10018','','web52_thumb.jpg',130, 163,18,'							photo_273096.html');
												thumbnails[384496] = new thumbnail(384496,'10016','','new010_thumb.jpg',130, 98,18,'							photo_384496.html');
												thumbnails[384501] = new thumbnail(384501,'10016','','new013_thumb.jpg',130, 98,18,'							photo_384501.html');
												thumbnails[384513] = new thumbnail(384513,'10016','','new011_thumb.jpg',130, 98,18,'							photo_384513.html');
												thumbnails[384548] = new thumbnail(384548,'10016','','new020_thumb.jpg',130, 179,18,'							photo_384548.html');
												thumbnails[580739] = new thumbnail(580739,'44734','','web101_thumb.jpg',130, 98,18,'							photo_580739.html');
												thumbnails[580729] = new thumbnail(580729,'44734','','web100_thumb.jpg',130, 98,18,'							photo_580729.html');
												thumbnails[457095] = new thumbnail(457095,'44734','','web1041_thumb.jpg',130, 98,18,'							photo_457095.html');
												thumbnails[273111] = new thumbnail(273111,'10018','','web51_thumb.jpg',130, 163,18,'							photo_273111.html');
												thumbnails[273124] = new thumbnail(273124,'10018','','web53_thumb.jpg',130, 163,18,'							photo_273124.html');
												thumbnails[582994] = new thumbnail(582994,'44734','','web1071_thumb.jpg',130, 98,18,'							photo_582994.html');
												thumbnails[582992] = new thumbnail(582992,'44734','','web1082_thumb.jpg',130, 98,18,'							photo_582992.html');
												thumbnails[384558] = new thumbnail(384558,'10016','','new022_thumb.jpg',130, 179,18,'							photo_384558.html');
												thumbnails[583025] = new thumbnail(583025,'44734','','web118_thumb.jpg',130, 98,18,'							photo_583025.html');
												thumbnails[5616716] = new thumbnail(5616716,'44734','','new037_thumb.jpg',130, 98,18,'							photo_5616716.html');
												thumbnails[6876775] = new thumbnail(6876775,'44734','','new060_thumb.jpg',130, 179,18,'							photo_6876775.html');
												thumbnails[6876776] = new thumbnail(6876776,'44734','','new066_thumb.jpg',130, 179,18,'							photo_6876776.html');
												thumbnails[6876781] = new thumbnail(6876781,'44734','','new068_thumb.jpg',130, 179,18,'							photo_6876781.html');
												thumbnails[384454] = new thumbnail(384454,'10016','','new021_thumb.jpg',130, 179,18,'							photo_384454.html');
												thumbnails[2161659] = new thumbnail(2161659,'10016','','new065_thumb.jpg',130, 179,18,'							photo_2161659.html');
												thumbnails[2161661] = new thumbnail(2161661,'10016','','web112_1_thumb.jpg',130, 179,18,'							photo_2161661.html');
												thumbnails[2161664] = new thumbnail(2161664,'10016','','web113_1_thumb.jpg',130, 179,18,'							photo_2161664.html');
												thumbnails[5916712] = new thumbnail(5916712,'10016','','new0511_thumb.jpg',130, 98,18,'							photo_5916712.html');
												thumbnails[3348477] = new thumbnail(3348477,'10016','','new024_thumb.jpg',130, 98,18,'							photo_3348477.html');
												thumbnails[3348491] = new thumbnail(3348491,'10016','','new025_thumb.jpg',130, 98,18,'							photo_3348491.html');
												thumbnails[6876790] = new thumbnail(6876790,'10142','','new058_thumb.jpg',130, 98,18,'							photo_6876790.html');
												thumbnails[6876793] = new thumbnail(6876793,'10142','','new062_thumb.jpg',130, 98,18,'							photo_6876793.html');
												thumbnails[6876798] = new thumbnail(6876798,'10142','','new067_thumb.jpg',130, 98,18,'							photo_6876798.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[10016] = new gallery(10016,'384451','Weddings one','gallery',[5916050,5916047,2161752,5933515,5933518,5933520,5933576,5933580,5933586,6872062,6872064,6872067,6872082,6872087,6872092,106038,384321,384301,5616589,5616591,5616595,380840,384441,384426,5642794,5642984,5643016,381445,384451,384560,384496,384501,384513,384548,384558,384454,2161659,2161661,2161664,5916712,3348477,3348491],0, 0, '', '																																																																																																							gallery_10016.html',0,0);
				  					galleries[10142] = new gallery(10142,'3358698','Weddings Two','gallery',[3358698,3358661,3358725,5933528,5933551,5933552,3358765,3358785,3361863,3358867,3361864,3361862,3361963,3361979,3361980,459583,569980,116755,163482,163483,163484,1940424,1940409,1940463,108454,457107,457122,457091,1011022,459592,6876790,6876793,6876798],0, 0, '', '																																																																																																							gallery_10142.html',0,0);
				  					galleries[44734] = new gallery(44734,'5616662','Weddings three','gallery',[5616642,5616644,5616646,5616660,5616662,5616665,5616681,5616684,5616687,5933631,5933633,5933635,5643481,5643150,5643364,1011032,1078483,1078500,1207141,1207150,1207156,1645860,1645889,1645892,1793286,1793298,580739,580729,457095,582994,582992,583025,5616716,6876775,6876776,6876781],0, 0, '', '																																																																																																							gallery_44734.html',0,0);
				  					galleries[10018] = new gallery(10018,'1011932','Portrait Photography','gallery',[1063271,1063275,1063282,1063285,1063296,1063298,110464,1940371,1940397,1063317,1063321,210277,1011932,273096,273111,273124],0, 0, '', '																																																																																																							gallery_10018.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '6872064';
imageSets[2] = '5616662,3358698,1011932,384451';
imageSets[3] = '6876798,6876793,6876790,6876781,6876776,6876775,6872092,6872087,6872082,6872067,6872064,6872062,5933635,5933633,5933631,5933586,5933580,5933576,5933552,5933551,5933528,5933520,5933518,5933515,5916712,5916711,5916050,5916047,5643481,5643364,5643150,5643016,5642984,5642794,5616716,5616687,5616684,5616681,5616665,5616662,5616660,5616646,5616644,5616642,5616595,5616591,5616589,3361980,3361979,3361963';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/photoflair2/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/photoflair2/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));		}, 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 = 'Photoflair 2: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      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));    }        
    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;
	}
}

			

