window.thumbnails = new Object();
												thumbnails[1589709] = new thumbnail(1589709,'','','PhotoArt_logo_small_thumb.jpg',130, 37,15,'							photo_1589709.html');
												thumbnails[1410283] = new thumbnail(1410283,'97840','Renovated Boiler House','E_&_ B_9_thumb.jpg',130, 87,15,'							photo_1410283.html');
												thumbnails[1410361] = new thumbnail(1410361,'97840','','E_&_B_10_thumb.jpg',130, 87,15,'							photo_1410361.html');
												thumbnails[1410373] = new thumbnail(1410373,'97840','School Kitchen','E_&_B_111_thumb.jpg',130, 87,15,'							photo_1410373.html');
												thumbnails[1410374] = new thumbnail(1410374,'97840','','E_&_B_12_thumb.jpg',130, 87,15,'							photo_1410374.html');
												thumbnails[1410375] = new thumbnail(1410375,'97840','','E_&_B_13_thumb.jpg',130, 87,15,'							photo_1410375.html');
												thumbnails[1410380] = new thumbnail(1410380,'97840','','E_&_B_14_thumb.jpg',130, 87,15,'							photo_1410380.html');
												thumbnails[1589989] = new thumbnail(1589989,'97840','School Classroom - 2','E_&_ B_4_thumb.jpg',130, 87,15,'							photo_1589989.html');
												thumbnails[1608217] = new thumbnail(1608217,'97840','School Refrectory','15315C_thumb.jpg',130, 87,15,'							photo_1608217.html');
												thumbnails[1608251] = new thumbnail(1608251,'97844','Coffee table - puzzle','21687C_thumb.jpg',130, 87,15,'							photo_1608251.html');
												thumbnails[1608257] = new thumbnail(1608257,'97840','','18862C_thumb.jpg',130, 87,15,'							photo_1608257.html');
												thumbnails[1608260] = new thumbnail(1608260,'97840','Little Silver Country Hotel.','LS Front_thumb.jpg',130, 87,15,'							photo_1608260.html');
												thumbnails[1608296] = new thumbnail(1608296,'97840','Room 14, Little Silver Hotel','Room 14_thumb.jpg',130, 87,15,'							photo_1608296.html');
												thumbnails[1610285] = new thumbnail(1610285,'98007','Kitchen Showrooms','C19189_thumb.jpg',130, 184,15,'							photo_1610285.html');
												thumbnails[1610753] = new thumbnail(1610753,'97837','Boardwalk','Boardwalk_thumb.jpg',130, 191,15,'							photo_1610753.html');
												thumbnails[1610808] = new thumbnail(1610808,'97817','Pastel Orchid','Pastel Orchid_thumb.jpg',130, 93,15,'							photo_1610808.html');
												thumbnails[1611341] = new thumbnail(1611341,'97837','Kernal','Kernal_thumb.jpg',130, 180,15,'							photo_1611341.html');
												thumbnails[1611363] = new thumbnail(1611363,'97817','Viaduct Track','Viaduct Track_thumb.jpg',130, 79,15,'							photo_1611363.html');
												thumbnails[1611402] = new thumbnail(1611402,'97817','Wet & Windy','Wet and Windy_thumb.jpg',130, 73,15,'							photo_1611402.html');
												thumbnails[1611415] = new thumbnail(1611415,'97817','Memorial to Women of World War 2','Women\'s War Memorial_thumb.jpg',130, 87,15,'							photo_1611415.html');
												thumbnails[1632683] = new thumbnail(1632683,'98704','Copied from a Glass Lantern Slide','Glass_Slide1_thumb.jpg',130, 130,15,'							photo_1632683.html');
												thumbnails[1632698] = new thumbnail(1632698,'98704','Copied from a Glass Lantern Slide','Glass_Slide2_thumb.jpg',130, 130,15,'							photo_1632698.html');
												thumbnails[1632702] = new thumbnail(1632702,'97828','An example of our photo restoration work','Restoration_Sample1_thumb.jpg',130, 122,15,'							photo_1632702.html');
												thumbnails[1632704] = new thumbnail(1632704,'97828','An example of our photo restoration work work','Restoration_Sample2_thumb.jpg',130, 134,15,'							photo_1632704.html');
												thumbnails[6267065] = new thumbnail(6267065,'348359','The Memorial at Chickenden Farm Staplehurst','The_Memorial_thumb.jpg',130, 88,15,'							photo_6267065.html');
												thumbnails[6267123] = new thumbnail(6267123,'348359','The Wreaths laid at the Staplehurst ALG Memorial','The_Wreaths_thumb.jpg',130, 79,15,'							photo_6267123.html');
												thumbnails[6267071] = new thumbnail(6267071,'348359','The Inscription on the ALG Memorial Staplehurst.','Memorial_inscription_thumb.jpg',130, 162,15,'							photo_6267071.html');
												thumbnails[6286498] = new thumbnail(6286498,'348359','Guard of Honour','Guard_of_Honour_thumb.jpg',130, 92,15,'							photo_6286498.html');
												thumbnails[6286625] = new thumbnail(6286625,'348359','Waiting for the Guests','Waiting_for_the_Guests_-_2_A2E4D371-24E8-5EC4-4F06F7FCB727253F_thumb.jpg',130, 84,15,'							photo_6286625.html');
												thumbnails[1407820] = new thumbnail(1407820,'97817','\'A walk on the Wild Side\'','A_Walk_on_the_Wildside_temp_thumb.jpg',130, 57,15,'							photo_1407820.html');
												thumbnails[1407981] = new thumbnail(1407981,'97837','\'Red Roof\'','Red_Roof_thumb.jpg',130, 197,15,'							photo_1407981.html');
												thumbnails[1408167] = new thumbnail(1408167,'97840','','E_&_ B_2_thumb.jpg',130, 87,15,'							photo_1408167.html');
												thumbnails[1408197] = new thumbnail(1408197,'98007','School Corridor.','E_&_ B_6_thumb.jpg',130, 195,15,'							photo_1408197.html');
												thumbnails[1410276] = new thumbnail(1410276,'97839','Boiler House before','E_&_ B_7_thumb.jpg',130, 87,15,'							photo_1410276.html');
												thumbnails[1424408] = new thumbnail(1424408,'98704','Heraldic Artwork by Michael Perry','Victulars_Bicentenery_thumb.jpg',130, 173,15,'							photo_1424408.html');
												thumbnails[1424444] = new thumbnail(1424444,'97844','Trophy','Elsmore_Trophy_thumb.jpg',130, 182,15,'							photo_1424444.html');
												thumbnails[1610778] = new thumbnail(1610778,'97821','Lady Hill Silhouette','Lady Hill Silhouette_thumb.jpg',130, 92,15,'							photo_1610778.html');
												thumbnails[6286219] = new thumbnail(6286219,'348359','\'General Patton\' receives his instructions','General_Patton_receives_his_instructions_thumb.jpg',130, 82,15,'							photo_6286219.html');
												thumbnails[6286594] = new thumbnail(6286594,'348359','\'General \' Patton talks tactics with the Mayor','Patton_talks_tactics_with_the_Mayor_A2DAC49C-24E8-5EC4-4F6BCE6ED5FF6353_thumb.jpg',130, 198,15,'							photo_6286594.html');
												thumbnails[6286607] = new thumbnail(6286607,'348359','Colonel John R Ulricson arrives for the Service in  in USAAF Jeep','Colonel_John_R_Ulricson_arrives_thumb.jpg',130, 93,15,'							photo_6286607.html');
												thumbnails[6286605] = new thumbnail(6286605,'348359','Lt Colonel Bill Bullard arrives for the Service in USAAF Jeep','Lt_Colonel_Bill_Bullard_arrives_thumb.jpg',130, 85,15,'							photo_6286605.html');
												thumbnails[1407991] = new thumbnail(1407991,'97837','\'Blue Desolation\'','Blue_Desolation_thumb.jpg',130, 189,15,'							photo_1407991.html');
												thumbnails[1408184] = new thumbnail(1408184,'97840','School Classroom - 1','E_&_ B_5_thumb.jpg',130, 87,15,'							photo_1408184.html');
												thumbnails[1408199] = new thumbnail(1408199,'98007','Platinum Suite - 2','LS_3_thumb.jpg',130, 195,15,'							photo_1408199.html');
												thumbnails[1410279] = new thumbnail(1410279,'97839','Boiler House After','E_&_ B_8_thumb.jpg',130, 87,15,'							photo_1410279.html');
												thumbnails[1424418] = new thumbnail(1424418,'98704','Heraldic Artwork by Michael Perry','Kingsclere_Service_ Award_thumb.jpg',130, 193,15,'							photo_1424418.html');
												thumbnails[1428803] = new thumbnail(1428803,'97844','','HCP_1_thumb.jpg',130, 84,15,'							photo_1428803.html');
												thumbnails[1610754] = new thumbnail(1610754,'97821','Boardwalk Reflection','Boardwalk Reflections_thumb.jpg',130, 87,15,'							photo_1610754.html');
												thumbnails[6267100] = new thumbnail(6267100,'348359','Lighting the Candle at the Memorial Service','Lighting_the_Candle_thumb.jpg',130, 184,15,'							photo_6267100.html');
												thumbnails[6289460] = new thumbnail(6289460,'348359','Leaving Church','Lt_Colonel_Bill_Bullard_leaves_the_chuch_with_his_wife_and_daughter_thumb.jpg',130, 168,15,'							photo_6289460.html');
												thumbnails[6286193] = new thumbnail(6286193,'348359','Deep in conversation','Deep_in_conversation_thumb.jpg',130, 94,15,'							photo_6286193.html');
												thumbnails[6289470] = new thumbnail(6289470,'348359','Colonel John R Ulricson leaving the Church with his son.','Colonel_John_R_Ulricson_leaving_the_Church_thumb.jpg',130, 105,15,'							photo_6289470.html');
												thumbnails[6289480] = new thumbnail(6289480,'348359','Sharing a Joke','Sharing_a_Joke_thumb.jpg',130, 93,15,'							photo_6289480.html');
												thumbnails[1407838] = new thumbnail(1407838,'97817','\'Storm on the Horizon\'','Storm_on_the_horizon_thumb.jpg',130, 85,15,'							photo_1407838.html');
												thumbnails[1408187] = new thumbnail(1408187,'97840','Flower Shop','Barry_Jones_1_thumb.jpg',130, 87,15,'							photo_1408187.html');
												thumbnails[1408198] = new thumbnail(1408198,'98007','Cleaning High Windows','Heathcroft_1_thumb.jpg',130, 196,15,'							photo_1408198.html');
												thumbnails[1428811] = new thumbnail(1428811,'97844','','HCP_2_thumb.jpg',130, 86,15,'							photo_1428811.html');
												thumbnails[1610790] = new thumbnail(1610790,'97821','Lilies in the Sun','Lilies in the Sun_thumb.jpg',130, 95,15,'							photo_1610790.html');
												thumbnails[6289507] = new thumbnail(6289507,'348359','Lt Colonel Bill Bullard','Lt_Colonel_Bill_Bullard_thumb.jpg',130, 182,15,'							photo_6289507.html');
												thumbnails[6289524] = new thumbnail(6289524,'348359','Colonel John R Ulricson and Family arrive at ALG Memorial site','Colonel_John_R_Ulricson_and_Family_thumb.jpg',130, 80,15,'							photo_6289524.html');
												thumbnails[6289537] = new thumbnail(6289537,'348359','Colonel John R Ulricson and Lt Colonel Bill Bullard ','Colonel_John_R_Ulricson_and_Lt_Colonel_Bill_Bullard__thumb.jpg',130, 105,15,'							photo_6289537.html');
												thumbnails[1407824] = new thumbnail(1407824,'97817','\'Dales Morning\'','Dales_Morning_thumb.jpg',130, 87,15,'							photo_1407824.html');
												thumbnails[1408190] = new thumbnail(1408190,'97840','Platinum Suite - 1','LS_2_thumb.jpg',130, 87,15,'							photo_1408190.html');
												thumbnails[1428807] = new thumbnail(1428807,'97844','','Ice_1_thumb.jpg',130, 87,15,'							photo_1428807.html');
												thumbnails[1610762] = new thumbnail(1610762,'97821','Huts and Footprints','Huts & Footprints_thumb.jpg',130, 182,15,'							photo_1610762.html');
												thumbnails[6289565] = new thumbnail(6289565,'348359','The Unveiling','The_Unveiling_thumb.jpg',130, 92,15,'							photo_6289565.html');
												thumbnails[6289574] = new thumbnail(6289574,'348359','Studying the Inscription on the ALG Memorial','Studying_the_Inscription_thumb.jpg',130, 92,15,'							photo_6289574.html');
												thumbnails[6289585] = new thumbnail(6289585,'348359','The Silence','The_Silence_thumb.jpg',130, 93,15,'							photo_6289585.html');
												thumbnails[6289598] = new thumbnail(6289598,'348359','Saluting the fallen','Wreath_laying_-_2_thumb.jpg',130, 101,15,'							photo_6289598.html');
												thumbnails[6289612] = new thumbnail(6289612,'348359','Flypast over Chickenden farmhouse Staplehurst','Flypast_over_Chickenden_farmhouse_thumb.jpg',130, 90,15,'							photo_6289612.html');
												thumbnails[1408193] = new thumbnail(1408193,'97840','','E_&_ B_1_thumb.jpg',130, 87,15,'							photo_1408193.html');
												thumbnails[1424279] = new thumbnail(1424279,'97817','Limestone Pavement','Limestone_Pavement_thumb.jpg',130, 76,15,'							photo_1424279.html');
												thumbnails[1428100] = new thumbnail(1428100,'97821','The White House at Lunns','The_White_house_thumb.jpg',130, 157,15,'							photo_1428100.html');
												thumbnails[6267504] = new thumbnail(6267504,'348359','Mustang Flypast','Mustang_Flypast_thumb.jpg',130, 92,15,'							photo_6267504.html');
												thumbnails[6289659] = new thumbnail(6289659,'348359','The Bullard Family','Bullard_Family_thumb.jpg',130, 170,15,'							photo_6289659.html');
												thumbnails[6289670] = new thumbnail(6289670,'348359','Colonel John R Ulricson and Ted Sergison','Colonel_John_R_Ulricson_and_Ted_Sergison_thumb.jpg',130, 111,15,'							photo_6289670.html');
												thumbnails[6289684] = new thumbnail(6289684,'348359','Outside the Oasthouse at Chickenden','Outside_the_Oasthouse_at_Chickenden_thumb.jpg',130, 165,15,'							photo_6289684.html');
												thumbnails[6289698] = new thumbnail(6289698,'348359','Outside the Oasthouse at Chickenden - close-up','Outside_the_Oasthouse_at_Chickenden_-_close-up_thumb.jpg',130, 79,15,'							photo_6289698.html');
												thumbnails[1408195] = new thumbnail(1408195,'97840','','E_&_ B_3_thumb.jpg',130, 87,15,'							photo_1408195.html');
												thumbnails[1424336] = new thumbnail(1424336,'97817','Lover\'s Stroll','Lovers_Stroll_thumb.jpg',130, 93,15,'							photo_1424336.html');
												thumbnails[1610799] = new thumbnail(1610799,'97821','Narrowboat','Narrowboat_thumb.jpg',130, 182,15,'							photo_1610799.html');
												thumbnails[1428120] = new thumbnail(1428120,'97821','Evening Sentinals','Evening_Sentinals_thumb.jpg',130, 92,15,'							photo_1428120.html');
												thumbnails[6268380] = new thumbnail(6268380,'348359','Veterans at Chickenden Farm 2010','Veterans_at_Chickenden_2010_thumb.jpg',130, 92,15,'							photo_6268380.html');
												thumbnails[1428114] = new thumbnail(1428114,'97821','Cuckmere Blue','Cuckmere_Blue_thumb.jpg',130, 76,15,'							photo_1428114.html');
												thumbnails[6311722] = new thumbnail(6311722,'348359','Subsequent wreath laying on behalf of the Bullard family','Bullard_wreath_laying_-_2_thumb.jpg',130, 87,15,'							photo_6311722.html');
												thumbnails[1428091] = new thumbnail(1428091,'97821','Bow Kalidescope','Bow_Kalidescope_thumb.jpg',130, 238,15,'							photo_1428091.html');
												thumbnails[6268349] = new thumbnail(6268349,'348359','Memorial Construction','Memorial_Construction_thumb.jpg',130, 84,15,'							photo_6268349.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[348359] = new gallery(348359,'6311722,6289698,6289684,6289670,6289659,6289612,6289598,6289585,6289574,6289565','STAPLEHURST ALG MEMORIAL','gallery',[6267065,6267123,6267071,6286498,6286625,6286219,6286594,6286607,6286605,6267100,6289460,6286193,6289470,6289480,6289507,6289524,6289537,6289565,6289574,6289585,6289598,6289612,6267504,6289659,6289670,6289684,6289698,6268380,6311722,6268349],0, 0, '', '																																																																																																							gallery_348359.html',0,0);
				  					galleries[98704] = new gallery(98704,'1424408','Copy Work','gallery',[1632683,1632698,1424408,1424418],0, 0, '97827', '																																																																																																							gallery_98704.html',0,0);
				  					galleries[97828] = new gallery(97828,'1632702','Photo Restoration','gallery',[1632702,1632704],0, 0, '97827', '																																																																																																							gallery_97828.html',0,0);
				  					galleries[97822] = new gallery(97822,'1428091,1407981,1407824','PhotoArt','gallery',[],0, 0, '', '																																																																																																							gallery_97822.html',0,0);
				  					galleries[97817] = new gallery(97817,'1407824','PhotoArt - Mono','gallery',[1610808,1611363,1611402,1611415,1407820,1407838,1407824,1424279,1424336],0, 0, '97822', '																																																																																																							gallery_97817.html',0,0);
				  					galleries[97837] = new gallery(97837,'1407981','PhotoArt - Mono','gallery',[1610753,1611341,1407981,1407991],0, 0, '97822', '																																																																																																							gallery_97837.html',0,0);
				  					galleries[97821] = new gallery(97821,'1428091','PhotoArt - Colour','gallery',[1610778,1610754,1610790,1610762,1428100,1610799,1428120,1428114,1428091],0, 0, '97822', '																																																																																																							gallery_97821.html',0,0);
				  					galleries[97826] = new gallery(97826,'1424444,1410276,1408197,1408167','Commercial & Industrial','gallery',[],0, 0, '', '																																																																																																							gallery_97826.html',0,0);
				  					galleries[97840] = new gallery(97840,'1408167','C & I - General-1','gallery',[1410283,1410361,1410373,1410374,1410375,1410380,1589989,1608217,1608257,1608260,1608296,1408167,1408184,1408187,1408190,1408193,1408195],0, 0, '97826', '																																																																																																							gallery_97840.html',0,0);
				  					galleries[98007] = new gallery(98007,'1408197','C & I - General-2','gallery',[1610285,1408197,1408199,1408198],0, 0, '97826', '																																																																																																							gallery_98007.html',0,0);
				  					galleries[97839] = new gallery(97839,'1410276','Site Progress Work','gallery',[1410276,1410279],0, 0, '97826', '																																																																																																							gallery_97839.html',0,0);
				  					galleries[97844] = new gallery(97844,'1424444','Studio Photography','gallery',[1608251,1424444,1428803,1428811,1428807],0, 0, '97826', '																																																																																																							gallery_97844.html',0,0);
				  					galleries[97827] = new gallery(97827,'1632702,1424408','Restoration and Copy Work','gallery',[],0, 0, '', '																																																																																																							gallery_97827.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '1611415,1610808,1610778,1610754,1424279,1407838,1407824,1407820';
imageSets[2] = '1632702,1428091,1424444,1424408,1410276,1408197,1408167,1407981,1407824';
imageSets[3] = '6311722,6289698,6289684,6289670,6289659,6289612,6289598,6289585,6289574,6289565,6289537,6289524,6289507,6289480,6289470,6289460,6286625,6286607,6286605,6286594,6286498,6286219,6286193,6268380,6268349,6267504,6267123,6267100,6267071,6267065,1632704,1632702,1632698,1632683,1611415,1611402,1611363,1611341,1610808,1610799,1610790,1610778,1610762,1610754,1610753,1610285,1608296,1608260,1608257,1608251';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/FrankPhoto/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/FrankPhoto/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 = 'Frank Page Photographer: ' + 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));    }        
    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;
	}
}

			

