window.thumbnails = new Object();
												thumbnails[1315313] = new thumbnail(1315313,'90549','','wedding details_thumb.jpg',130, 130,1,'																			photo_1315313.html');
												thumbnails[4737059] = new thumbnail(4737059,'90549','','o1_thumb.jpg',130, 130,1,'																			photo_4737059.html');
												thumbnails[4737156] = new thumbnail(4737156,'90549','','s_thumb.jpg',130, 130,1,'																			photo_4737156.html');
												thumbnails[4737160] = new thumbnail(4737160,'90549','','u_thumb.jpg',130, 130,1,'																			photo_4737160.html');
												thumbnails[4737163] = new thumbnail(4737163,'90549','','100708d1_thumb.jpg',130, 130,1,'																			photo_4737163.html');
												thumbnails[4737165] = new thumbnail(4737165,'90549','','p1_thumb.jpg',130, 130,1,'																			photo_4737165.html');
												thumbnails[3111130] = new thumbnail(3111130,'90549','','a_thumb.jpg',130, 130,1,'																			photo_3111130.html');
												thumbnails[4677834] = new thumbnail(4677834,'90549','','n_thumb.jpg',130, 130,1,'																			photo_4677834.html');
												thumbnails[4737154] = new thumbnail(4737154,'90549','','r_thumb.jpg',130, 130,1,'																			photo_4737154.html');
												thumbnails[4737169] = new thumbnail(4737169,'90549','','x1_thumb.jpg',130, 130,1,'																			photo_4737169.html');
												thumbnails[3111135] = new thumbnail(3111135,'90549','','c_thumb.jpg',130, 130,1,'																			photo_3111135.html');
												thumbnails[3722597] = new thumbnail(3722597,'90549','','flowers_thumb.jpg',130, 130,1,'																			photo_3722597.html');
												thumbnails[4737159] = new thumbnail(4737159,'90549','','t_thumb.jpg',130, 130,1,'																			photo_4737159.html');
												thumbnails[6307410] = new thumbnail(6307410,'90549','','100708a_thumb.jpg',130, 130,1,'																			photo_6307410.html');
												thumbnails[4737170] = new thumbnail(4737170,'90549','','z_thumb.jpg',130, 130,1,'																			photo_4737170.html');
												thumbnails[6307409] = new thumbnail(6307409,'90549','','100708b_thumb.jpg',130, 130,1,'																			photo_6307409.html');
												thumbnails[3111519] = new thumbnail(3111519,'90549','','i_thumb.jpg',130, 130,1,'																			photo_3111519.html');
												thumbnails[6307557] = new thumbnail(6307557,'90549','','100708c1_thumb.jpg',130, 130,1,'																			photo_6307557.html');
												thumbnails[3111137] = new thumbnail(3111137,'90549','','e_thumb.jpg',130, 130,1,'																			photo_3111137.html');
												thumbnails[3111527] = new thumbnail(3111527,'90549','','j_thumb.jpg',130, 130,1,'																			photo_3111527.html');
												thumbnails[1873367] = new thumbnail(1873367,'90549','','2102g_thumb.jpg',130, 130,1,'																			photo_1873367.html');
												thumbnails[3722603] = new thumbnail(3722603,'90549','','flowers2_thumb.jpg',130, 130,1,'																			photo_3722603.html');
												thumbnails[3111136] = new thumbnail(3111136,'90549','','d_thumb.jpg',130, 130,1,'																			photo_3111136.html');
												thumbnails[1873369] = new thumbnail(1873369,'90549','','2102h_thumb.jpg',130, 130,1,'																			photo_1873369.html');
												thumbnails[3111142] = new thumbnail(3111142,'90549','','b2_thumb.jpg',130, 130,1,'																			photo_3111142.html');
												thumbnails[3111525] = new thumbnail(3111525,'90549','','k_thumb.jpg',130, 130,1,'																			photo_3111525.html');
												thumbnails[3111501] = new thumbnail(3111501,'90549','','g_thumb.jpg',130, 130,1,'																			photo_3111501.html');
												thumbnails[1248726] = new thumbnail(1248726,'90549','','brideg_thumb.jpg',130, 130,1,'																			photo_1248726.html');
												thumbnails[1997648] = new thumbnail(1997648,'90549','','ab_thumb.jpg',130, 130,1,'																			photo_1997648.html');
												thumbnails[1018368] = new thumbnail(1018368,'90549','','m_thumb.jpg',130, 130,1,'																			photo_1018368.html');
												thumbnails[1348239] = new thumbnail(1348239,'190921','','photo1_thumb.jpg',130, 130,1,'																			photo_1348239.html');
												thumbnails[1390425] = new thumbnail(1390425,'190921','','beck32_thumb.jpg',130, 130,1,'																			photo_1390425.html');
												thumbnails[1841680] = new thumbnail(1841680,'190921','','pop1_thumb.jpg',130, 130,1,'																			photo_1841680.html');
												thumbnails[1841717] = new thumbnail(1841717,'190921','','mumandbabe_thumb.jpg',130, 130,1,'																			photo_1841717.html');
												thumbnails[1997651] = new thumbnail(1997651,'190921','','ab1_thumb.jpg',130, 130,1,'																			photo_1997651.html');
												thumbnails[6075845] = new thumbnail(6075845,'190921','','girl5_thumb.jpg',130, 130,1,'																			photo_6075845.html');
												thumbnails[6307441] = new thumbnail(6307441,'190921','','100708f_thumb.jpg',130, 130,1,'																			photo_6307441.html');
												thumbnails[6307424] = new thumbnail(6307424,'190921','','100708c_thumb.jpg',130, 130,1,'																			photo_6307424.html');
												thumbnails[6307419] = new thumbnail(6307419,'190921','','10708a_thumb.jpg',130, 130,1,'																			photo_6307419.html');
												thumbnails[6307433] = new thumbnail(6307433,'190921','','100708d_thumb.jpg',130, 130,1,'																			photo_6307433.html');
												thumbnails[6307422] = new thumbnail(6307422,'190921','','100708a1_thumb.jpg',130, 130,1,'																			photo_6307422.html');
												thumbnails[1248625] = new thumbnail(1248625,'190921','','mike1_thumb.jpg',130, 130,1,'																			photo_1248625.html');
												thumbnails[6307437] = new thumbnail(6307437,'190921','','100708e_thumb.jpg',130, 130,1,'																			photo_6307437.html');
												thumbnails[1348248] = new thumbnail(1348248,'190921','','photo5_thumb.jpg',130, 130,1,'																			photo_1348248.html');
												thumbnails[1673754] = new thumbnail(1673754,'127815','','baby2_1_thumb.jpg',130, 130,1,'																			photo_1673754.html');
												thumbnails[1873355] = new thumbnail(1873355,'127815','','2102e_thumb.jpg',130, 130,1,'																			photo_1873355.html');
												thumbnails[3111687] = new thumbnail(3111687,'127815','','IMG_5539a1_thumb.jpg',130, 130,1,'																			photo_3111687.html');
												thumbnails[3111692] = new thumbnail(3111692,'127815','','2102g3_thumb.jpg',130, 130,1,'																			photo_3111692.html');
												thumbnails[3111706] = new thumbnail(3111706,'127815','','2102c3_thumb.jpg',130, 130,1,'																			photo_3111706.html');
												thumbnails[3111710] = new thumbnail(3111710,'127815','','21022_thumb.jpg',130, 130,1,'																			photo_3111710.html');
												thumbnails[3111732] = new thumbnail(3111732,'127815','','IMG_56901_thumb.jpg',130, 130,1,'																			photo_3111732.html');
												thumbnails[3114658] = new thumbnail(3114658,'127815','','yo_thumb.jpg',130, 130,1,'																			photo_3114658.html');
												thumbnails[3114651] = new thumbnail(3114651,'127815','','IMG_54676X8CROPbwv1_thumb.jpg',130, 130,1,'																			photo_3114651.html');
												thumbnails[4798994] = new thumbnail(4798994,'274586','www.buggyboot.com','buggyboot_thumb.jpg',130, 130,1,'																			photo_4798994.html');
												thumbnails[4798998] = new thumbnail(4798998,'274586','Paul Steel Music Video','paulsteel_thumb.jpg',130, 130,1,'																			photo_4798998.html');
												thumbnails[4799001] = new thumbnail(4799001,'274586','Christina Barry Design','barrydesign2_thumb.jpg',130, 130,1,'																			photo_4799001.html');
												thumbnails[4799004] = new thumbnail(4799004,'274586','The Sinking','tvalbumart_thumb.jpg',130, 130,1,'																			photo_4799004.html');
												thumbnails[4799008] = new thumbnail(4799008,'274586','Anne Proctor Artist','apart2_thumb.jpg',130, 130,1,'																			photo_4799008.html');
												thumbnails[4799010] = new thumbnail(4799010,'274586','Wheaters Jewellery','whiskerjewellery_thumb.jpg',130, 130,1,'																			photo_4799010.html');
												thumbnails[4799011] = new thumbnail(4799011,'274586','Thames Valley University','TVfashionshow_thumb.jpg',130, 130,1,'																			photo_4799011.html');
												thumbnails[4799014] = new thumbnail(4799014,'274586','School Prosepectus Photography','wsrecordingstudio_thumb.jpg',130, 130,1,'																			photo_4799014.html');
												thumbnails[4798991] = new thumbnail(4798991,'274586','The Gonzaga Band','gonzagaband1_thumb.jpg',130, 130,1,'																			photo_4798991.html');
												thumbnails[1873308] = new thumbnail(1873308,'227416','','2102 copy_thumb.jpg',130, 130,1,'																			photo_1873308.html');
												thumbnails[3115723] = new thumbnail(3115723,'116663','','ROGER2_thumb.jpg',130, 130,1,'																			photo_3115723.html');
												thumbnails[3722427] = new thumbnail(3722427,'227416','','Leafy_view_thumb.jpg',130, 130,1,'																			photo_3722427.html');
												thumbnails[3722429] = new thumbnail(3722429,'227416','','lake_thumb.jpg',130, 130,1,'																			photo_3722429.html');
												thumbnails[3722430] = new thumbnail(3722430,'227416','','Prague_thumb.jpg',130, 130,1,'																			photo_3722430.html');
												thumbnails[3722431] = new thumbnail(3722431,'227416','','Flreonce_thumb.jpg',130, 130,1,'																			photo_3722431.html');
												thumbnails[3722432] = new thumbnail(3722432,'227416','','planes_thumb.jpg',130, 130,1,'																			photo_3722432.html');
												thumbnails[3722433] = new thumbnail(3722433,'227416','','station_thumb.jpg',130, 130,1,'																			photo_3722433.html');
												thumbnails[3722434] = new thumbnail(3722434,'227416','','violin_thumb.jpg',130, 130,1,'																			photo_3722434.html');
												thumbnails[3722679] = new thumbnail(3722679,'227416','','richmondpark_thumb.jpg',130, 130,1,'																			photo_3722679.html');
												thumbnails[3722695] = new thumbnail(3722695,'227416','','richmondpark2_thumb.jpg',130, 130,1,'																			photo_3722695.html');
												thumbnails[3722752] = new thumbnail(3722752,'227416','','birdlady_thumb.jpg',130, 130,1,'																			photo_3722752.html');
												thumbnails[3722760] = new thumbnail(3722760,'227416','','dave_thumb.jpg',130, 130,1,'																			photo_3722760.html');
												thumbnails[3723262] = new thumbnail(3723262,'227416','','Kingwood_Common_thumb.jpg',130, 130,1,'																			photo_3723262.html');
												thumbnails[3723266] = new thumbnail(3723266,'227416','','florentine_market_thumb.jpg',130, 130,1,'																			photo_3723266.html');
												thumbnails[1018280] = new thumbnail(1018280,'89004','','cherub_thumb.jpg',130, 130,1,'																			photo_1018280.html');
												thumbnails[1248630] = new thumbnail(1248630,'89004','','beck1_thumb.jpg',130, 130,1,'																			photo_1248630.html');
												thumbnails[1363385] = new thumbnail(1363385,'89004','','family_thumb.jpg',130, 130,1,'																			photo_1363385.html');
												thumbnails[1703315] = new thumbnail(1703315,'89004','','3kids_thumb.jpg',130, 130,1,'																			photo_1703315.html');
												thumbnails[1873385] = new thumbnail(1873385,'89004','','2102b3_thumb.jpg',130, 130,1,'																			photo_1873385.html');
												thumbnails[4737166] = new thumbnail(4737166,'89004','','w1_thumb.jpg',130, 130,1,'																			photo_4737166.html');
												thumbnails[3111143] = new thumbnail(3111143,'89004','','f_thumb.jpg',130, 130,1,'																			photo_3111143.html');
												thumbnails[1873314] = new thumbnail(1873314,'89004','','2102c2_thumb.jpg',130, 130,1,'																			photo_1873314.html');
												thumbnails[1273627] = new thumbnail(1273627,'89004','','wedding11_thumb.jpg',130, 130,1,'																			photo_1273627.html');
												thumbnails[1273658] = new thumbnail(1273658,'89004','','WEDDING3_thumb.jpg',130, 130,1,'																			photo_1273658.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[274586] = new gallery(274586,'4799014,4799011,4799010,4799008,4799004,4799001,4798998,4798994,4798991','Commercial','section329936',[4798994,4798998,4799001,4799004,4799008,4799010,4799011,4799014,4798991],0, 0, '', '																																																																																																																																	section329936.html',0,0);
				  					galleries[227416] = new gallery(227416,'3722427','Fine Art Portfolio','section152575',[1873308,3722427,3722429,3722430,3722431,3722432,3722433,3722434,3722679,3722695,3722752,3722760,3723262,3723266],0, 0, '', '																																																																																																							section152575_227416.html',0,0);
				  					galleries[89004] = new gallery(89004,'4737166','Not Shown','section121338',[1018280,1248630,1363385,1703315,1873385,4737166,3111143,1873314,1273627,1273658],0, 0, '', '																																																																																																																																	section121338.html',0,0);
				  					galleries[190921] = new gallery(190921,'6075845','Portraits','gallery',[1348239,1390425,1841680,1841717,1997651,6075845,6307441,6307424,6307419,6307433,6307422,1248625,6307437,1348248],0, 0, '', '																																																																																																																																	gallery.html',0,0);
				  					galleries[116663] = new gallery(116663,'3115723','Roger Proctor','section152575',[3115723],0, 0, '', '																																																																																																							section152575_116663.html',0,0);
				  					galleries[127815] = new gallery(127815,'3114651,1873355','Special Occasions','section236103',[1673754,1873355,3111687,3111692,3111706,3111710,3111732,3114658,3114651],0, 0, '', '																																																																																																																																	section236103.html',0,0);
				  					galleries[90549] = new gallery(90549,'4737170,4737169,4737165,4737163,4737160,4737159,4737154,3722597,3111137,3111135,3111130','Weddings','section173654',[1315313,4737059,4737156,4737160,4737163,4737165,3111130,4677834,4737154,4737169,3111135,3722597,4737159,6307410,4737170,6307409,3111519,6307557,3111137,3111527,1873367,3722603,3111136,1873369,3111142,3111525,3111501,1248726,1997648,1018368],0, 0, '', '																																																																																																																																	section173654.html',0,0);
				  					galleries[94524] = new gallery(94524,'','Zoe and Bruno\'s Wedding Story','section127930',[],0, 0, '', '																																																																																																							section127930_94524.html',0,0);
				  					galleries[94525] = new gallery(94525,'','Gael and Mike\'s Studio Story','section127930',[],0, 0, '', '																																																																																																							section127930_94525.html',0,0);
				  					galleries[94526] = new gallery(94526,'','Becky and Ian\'s Location Story','section127930',[],0, 0, '', '																																																																																																							section127930_94526.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[154282] = '6307441,6307433,6307424,6307422,6307419,1390425,1348239,1248625';
imageSets[154285] = '6307557,6307441,6307437,6307410,6307409,4737170,4737169,4737166,4737165,4737163,4737160,4737159,4737156,4737154,4737059,4677834,3111525,3111501,1315313';
imageSets[1] = '6307441,6307437,6307433,6307422,6307410,6307409,4798991,4737170,4737169,4737159,4677834,3722603,3722597,3111527,3111525,3111137,3111135,3111130,1348248,1248726';
imageSets[2] = '6075845,4737170,4737169,4737166,4737165,4737163,4737160,4737159,4737154,3722597,3722427,3114651,3111137,3111135,3111130,1873355';
imageSets[3] = '6307557,6307441,6307437,6307433,6307424,6307422,6307419,6307410,6307409,6075845,4799014,4799011,4799010,4799008,4799004,4799001,4798998,4798994,4798991,4737170,4737169,4737166,4737165,4737163,4737160,4737159,4737156,4737154,4737059,4677834,3723266,3723262,3722760,3722752,3722695,3722679,3722603,3722597,3722434,3722433,3722432,3722431,3722430,3722429,3722427,3115723,3114658,3114651,3111732,3111710';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rogerproctor/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rogerproctor/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 += 'section173654.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 && 'section173654' != '') {
					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 = 'Roger Proctor Photography of Reading, Berkshire: ' + 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>';
	}
					
	temp = temp + this.fnGetPaymentInfo();
				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>Buy now using PayPal:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> 				&pound;' + (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 + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="item_name" value="'+item_name+'">';
								ref = '';
				if(this.photo_ref != ''){
					ref = this.photo_ref+' - '+this.caption;
				}
				else{
					ref = this.id+' - '+this.caption;
				}
				price = amount;					temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="roger.proctor@yahoo.com">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="roger.proctor@yahoo.com">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							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;
	}
}

		

