window.thumbnails = new Object();
												thumbnails[6932847] = new thumbnail(6932847,'250380','','Steelworks_D3A7D946-1D09-001F-99CEFC1EA39D7FD3_thumb.jpg',130, 60,15,'							photo_6932847.html');
												thumbnails[6932863] = new thumbnail(6932863,'250380','','Porthcawl10_thumb.jpg',130, 76,15,'							photo_6932863.html');
												thumbnails[6932904] = new thumbnail(6932904,'250380','','Edinburgh_600_thumb.jpg',130, 62,15,'							photo_6932904.html');
												thumbnails[3854479] = new thumbnail(3854479,'250380','','Loch_Ness_near_Fort_Augustus_thumb.jpg',130, 62,15,'							photo_3854479.html');
												thumbnails[5177760] = new thumbnail(5177760,'250380','','Aberavon_cranes_thumb.jpg',130, 71,15,'							photo_5177760.html');
												thumbnails[4218032] = new thumbnail(4218032,'250380','','IMGP0174PEF_thumb.jpg',80, 120,15,'							photo_4218032.html');
												thumbnails[3855543] = new thumbnail(3855543,'250380','','IMGP0041PEF1_thumb.jpg',130, 78,15,'							photo_3855543.html');
												thumbnails[5177780] = new thumbnail(5177780,'250380','','No_swimming_thumb.jpg',130, 89,15,'							photo_5177780.html');
												thumbnails[3978588] = new thumbnail(3978588,'250380','','Just_Hanging1_thumb.jpg',120, 120,15,'							photo_3978588.html');
												thumbnails[4218100] = new thumbnail(4218100,'250380','','IMGP0223PEF_thumb.jpg',80, 120,15,'							photo_4218100.html');
												thumbnails[6932717] = new thumbnail(6932717,'375978','','sAberavon_cranes_thumb.jpg',130, 71,15,'							photo_6932717.html');
												thumbnails[6932720] = new thumbnail(6932720,'375978','','sBaglan1_thumb.jpg',130, 63,15,'							photo_6932720.html');
												thumbnails[6932728] = new thumbnail(6932728,'375978','','sMumbles1_1_thumb.jpg',130, 57,15,'							photo_6932728.html');
												thumbnails[6932731] = new thumbnail(6932731,'375978','','sMumbles2_1_thumb.jpg',130, 69,15,'							photo_6932731.html');
												thumbnails[6932737] = new thumbnail(6932737,'375978','','sMumbles3_1_thumb.jpg',130, 73,15,'							photo_6932737.html');
												thumbnails[6932739] = new thumbnail(6932739,'375978','','sPorthcawl1_thumb.jpg',130, 59,15,'							photo_6932739.html');
												thumbnails[5177764] = new thumbnail(5177764,'375978','','Black_and_white_sea_thumb.jpg',80, 120,15,'							photo_5177764.html');
												thumbnails[5177761] = new thumbnail(5177761,'375978','','Birds_head_home_thumb.jpg',130, 77,15,'							photo_5177761.html');
												thumbnails[5177767] = new thumbnail(5177767,'375978','','Cranes_and_dogs_thumb.jpg',130, 40,15,'							photo_5177767.html');
												thumbnails[5177777] = new thumbnail(5177777,'375978','','Lighthouse_rocks_thumb.jpg',130, 86,15,'							photo_5177777.html');
												thumbnails[5177783] = new thumbnail(5177783,'375978','','Porthcawl_lighthouse_1_thumb.jpg',130, 68,15,'							photo_5177783.html');
												thumbnails[5177784] = new thumbnail(5177784,'375978','','Porthcawl_lighthouse_2_thumb.jpg',130, 79,15,'							photo_5177784.html');
												thumbnails[5177786] = new thumbnail(5177786,'375978','','Porthcawl_lighthouse_3_thumb.jpg',130, 50,15,'							photo_5177786.html');
												thumbnails[5177788] = new thumbnail(5177788,'375978','','Porthcawl_prom_thumb.jpg',130, 86,15,'							photo_5177788.html');
												thumbnails[5177792] = new thumbnail(5177792,'375978','','Porthcawl_rocks_1_thumb.jpg',130, 58,15,'							photo_5177792.html');
												thumbnails[5177794] = new thumbnail(5177794,'375978','','Porthcawl_view_thumb.jpg',130, 86,15,'							photo_5177794.html');
												thumbnails[5177795] = new thumbnail(5177795,'375978','','Southerndown_golf_course_thumb.jpg',130, 65,15,'							photo_5177795.html');
												thumbnails[5177797] = new thumbnail(5177797,'375978','','Steelworks_thumb.jpg',130, 60,15,'							photo_5177797.html');
												thumbnails[5177799] = new thumbnail(5177799,'375978','','Wintry_rocks_thumb.jpg',130, 72,15,'							photo_5177799.html');
												thumbnails[3854481] = new thumbnail(3854481,'375979','','Mallaig_from_Sleat_2_thumb.jpg',130, 69,15,'							photo_3854481.html');
												thumbnails[3854483] = new thumbnail(3854483,'375979','','24062008031_thumb.jpg',130, 74,15,'							photo_3854483.html');
												thumbnails[3855661] = new thumbnail(3855661,'375979','','21062008014_thumb.jpg',130, 65,15,'							photo_3855661.html');
												thumbnails[3855710] = new thumbnail(3855710,'375979','','Seal_island_view_copy_thumb.jpg',130, 56,15,'							photo_3855710.html');
												thumbnails[3855724] = new thumbnail(3855724,'375979','','Mallaig_from_Sleat_21_thumb.jpg',130, 73,15,'							photo_3855724.html');
												thumbnails[3864598] = new thumbnail(3864598,'375979','','Skye_to_the_Mainland_thumb.jpg',130, 87,15,'							photo_3864598.html');
												thumbnails[3864601] = new thumbnail(3864601,'375979','','From_the_South_of_Skye_thumb.jpg',130, 76,15,'							photo_3864601.html');
												thumbnails[6932746] = new thumbnail(6932746,'375979','','sEdinburgh1_1_thumb.jpg',130, 66,15,'							photo_6932746.html');
												thumbnails[6932747] = new thumbnail(6932747,'375979','','sEdinburgh2_1_thumb.jpg',130, 64,15,'							photo_6932747.html');
												thumbnails[6932748] = new thumbnail(6932748,'375979','','sEdinburgh3_1_thumb.jpg',130, 86,15,'							photo_6932748.html');
												thumbnails[6932749] = new thumbnail(6932749,'375979','','sEdinburgh4_1_thumb.jpg',130, 86,15,'							photo_6932749.html');
												thumbnails[6932750] = new thumbnail(6932750,'375979','','sEdinburgh5_1_thumb.jpg',80, 120,15,'							photo_6932750.html');
												thumbnails[6932752] = new thumbnail(6932752,'375979','','sEdinburgh6_1_thumb.jpg',60, 120,15,'							photo_6932752.html');
												thumbnails[6932753] = new thumbnail(6932753,'375979','','sNightime_Edi_Castle_thumb.jpg',130, 62,15,'							photo_6932753.html');
												thumbnails[3854535] = new thumbnail(3854535,'375979','','24062008035_thumb.jpg',130, 69,15,'							photo_3854535.html');
												thumbnails[6932744] = new thumbnail(6932744,'375979','','sCathedral_Edi_1_thumb.jpg',69, 120,15,'							photo_6932744.html');
												thumbnails[3864541] = new thumbnail(3864541,'375979','','Seal_Island_Light_thumb.jpg',130, 53,15,'							photo_3864541.html');
												thumbnails[4073457] = new thumbnail(4073457,'375980','','IMGP0127PEF1_thumb.jpg',130, 50,15,'							photo_4073457.html');
												thumbnails[6932438] = new thumbnail(6932438,'375980','','St_Marys_bw500_thumb.jpg',130, 86,15,'							photo_6932438.html');
												thumbnails[6932686] = new thumbnail(6932686,'375980','','sFord1_1_thumb.jpg',80, 120,15,'							photo_6932686.html');
												thumbnails[6932689] = new thumbnail(6932689,'375980','','sFord2_thumb.jpg',130, 78,15,'							photo_6932689.html');
												thumbnails[6932908] = new thumbnail(6932908,'375980','','Autumn_in_the_Chilterns500_thumb.jpg',130, 117,15,'							photo_6932908.html');
												thumbnails[6932909] = new thumbnail(6932909,'375980','','Autumn_Path_thumb.jpg',80, 120,15,'							photo_6932909.html');
												thumbnails[6932910] = new thumbnail(6932910,'375980','','Bird_thumb.jpg',130, 80,15,'							photo_6932910.html');
												thumbnails[6932913] = new thumbnail(6932913,'375980','','Chiltern_Field_thumb.jpg',130, 86,15,'							photo_6932913.html');
												thumbnails[6932633] = new thumbnail(6932633,'375981','','sDifferentkindofwork2_thumb.jpg',83, 120,15,'							photo_6932633.html');
												thumbnails[4218020] = new thumbnail(4218020,'375981','','IMGP0198PEF_thumb.jpg',130, 60,15,'							photo_4218020.html');
												thumbnails[4218025] = new thumbnail(4218025,'375981','','IMGP0210PEF_thumb.jpg',130, 60,15,'							photo_4218025.html');
												thumbnails[4218027] = new thumbnail(4218027,'375981','','IMGP0211PEF_thumb.jpg',130, 55,15,'							photo_4218027.html');
												thumbnails[4218037] = new thumbnail(4218037,'375981','','IMGP0178PEF_thumb.jpg',85, 120,15,'							photo_4218037.html');
												thumbnails[4218036] = new thumbnail(4218036,'375981','','IMGP0175PEF_thumb.jpg',130, 109,15,'							photo_4218036.html');
												thumbnails[4218040] = new thumbnail(4218040,'375981','','IMGP0201PEF_thumb.jpg',80, 120,15,'							photo_4218040.html');
												thumbnails[4218318] = new thumbnail(4218318,'375981','','IMGP0204PEF_thumb.jpg',130, 83,15,'							photo_4218318.html');
												thumbnails[4218029] = new thumbnail(4218029,'375981','','IMGP0212PEF_thumb.jpg',130, 64,15,'							photo_4218029.html');
												thumbnails[4218041] = new thumbnail(4218041,'375981','','IMGP0215PEF_thumb.jpg',130, 71,15,'							photo_4218041.html');
												thumbnails[4218338] = new thumbnail(4218338,'375981','','IMGP0221PEF_thumb.jpg',83, 120,15,'							photo_4218338.html');
												thumbnails[4218360] = new thumbnail(4218360,'375981','','IMGP0206PEF_thumb.jpg',130, 67,15,'							photo_4218360.html');
												thumbnails[4218098] = new thumbnail(4218098,'375981','','IMGP0217PEF_thumb.jpg',106, 120,15,'							photo_4218098.html');
												thumbnails[4218330] = new thumbnail(4218330,'375981','','IMGP0205PEF_thumb.jpg',130, 65,15,'							photo_4218330.html');
												thumbnails[6932627] = new thumbnail(6932627,'375982','','sDifferentkindofwork4_thumb.jpg',130, 99,15,'							photo_6932627.html');
												thumbnails[6932906] = new thumbnail(6932906,'375982','','Tree_thumb.jpg',130, 81,15,'							photo_6932906.html');
												thumbnails[3896911] = new thumbnail(3896911,'375982','','About_to_open_thumb.jpg',130, 66,15,'							photo_3896911.html');
												thumbnails[3854646] = new thumbnail(3854646,'375982','','IMGP0028PEF_thumb.jpg',130, 90,15,'							photo_3854646.html');
												thumbnails[3978598] = new thumbnail(3978598,'375982','','On_a_flower_thumb.jpg',120, 120,15,'							photo_3978598.html');
												thumbnails[3978864] = new thumbnail(3978864,'375982','','Blues_and_Pinks_thumb.jpg',130, 118,15,'							photo_3978864.html');
												thumbnails[3855501] = new thumbnail(3855501,'375982','','IMGP0042PEF_1_thumb.jpg',130, 86,15,'							photo_3855501.html');
												thumbnails[3978591] = new thumbnail(3978591,'375982','','On_Top12_thumb.jpg',130, 85,15,'							photo_3978591.html');
												thumbnails[4073442] = new thumbnail(4073442,'375982','','IMGP0128PEF1_thumb.jpg',130, 78,15,'							photo_4073442.html');
												thumbnails[4073984] = new thumbnail(4073984,'375982','','IMGP0124PEF1_thumb.jpg',80, 120,15,'							photo_4073984.html');
												thumbnails[3864540] = new thumbnail(3864540,'375982','','Reflections_thumb.jpg',130, 53,15,'							photo_3864540.html');
												thumbnails[3864537] = new thumbnail(3864537,'375982','','Reflections_2_thumb.jpg',130, 52,15,'							photo_3864537.html');
												thumbnails[3978880] = new thumbnail(3978880,'375982','','Lush_thumb.jpg',130, 89,15,'							photo_3978880.html');
												thumbnails[4074056] = new thumbnail(4074056,'375982','','IMGP0129PEF_thumb.jpg',130, 77,15,'							photo_4074056.html');
												thumbnails[4226124] = new thumbnail(4226124,'375982','','IMGP0267PEF_thumb.jpg',130, 91,15,'							photo_4226124.html');
												thumbnails[3978700] = new thumbnail(3978700,'375982','','IMGP0111PEF_1_thumb.jpg',130, 77,15,'							photo_3978700.html');
												thumbnails[3978885] = new thumbnail(3978885,'375982','','Safety_in_Numbers_thumb.jpg',130, 82,15,'							photo_3978885.html');
												thumbnails[7057257] = new thumbnail(7057257,'382037','','Heading_out_to_sea_thumb.jpg',130, 72,15,'							photo_7057257.html');
												thumbnails[7057266] = new thumbnail(7057266,'382037','','Monaco_to_the_Italian_coast_thumb.jpg',130, 80,15,'							photo_7057266.html');
												thumbnails[7057267] = new thumbnail(7057267,'382037','','Sunrise_off_the_coast_thumb.jpg',130, 88,15,'							photo_7057267.html');
												thumbnails[7057270] = new thumbnail(7057270,'382037','','Sunrise_over_Monaco_France_and_Italy_thumb.jpg',130, 80,15,'							photo_7057270.html');
												thumbnails[7057273] = new thumbnail(7057273,'382037','','Sunrise_over_the_Riviera_thumb.jpg',130, 73,15,'							photo_7057273.html');
												thumbnails[7057275] = new thumbnail(7057275,'382037','','Sunset_over_France_and_the_Italian_coast_thumb.jpg',130, 76,15,'							photo_7057275.html');
												thumbnails[7057276] = new thumbnail(7057276,'382037','','Sunset_over_the_sea_2_thumb.jpg',130, 83,15,'							photo_7057276.html');
												thumbnails[7057278] = new thumbnail(7057278,'382037','','Sunset_over_the_sea_thumb.jpg',130, 70,15,'							photo_7057278.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  	  					galleries[250380] = new gallery(250380,'6932904,6932863,6932847,5177780,5177760,4218100,4218032,3978588,3855543,3854479','Steve\'s Top 10','gallery',[6932847,6932863,6932904,3854479,5177760,4218032,3855543,5177780,3978588,4218100],0, 0, '', '																																																																																																							gallery_250380.html',0,0);
				  	  					galleries[375978] = new gallery(375978,'6932731','South Wales','gallery',[6932717,6932720,6932728,6932731,6932737,6932739,5177764,5177761,5177767,5177777,5177783,5177784,5177786,5177788,5177792,5177794,5177795,5177797,5177799],0, 0, '', '																																																																																																							gallery_375978.html',0,0);
				  	  					galleries[375979] = new gallery(375979,'6932749','Scotland','gallery',[3854481,3854483,3855661,3855710,3855724,3864598,3864601,6932746,6932747,6932748,6932749,6932750,6932752,6932753,3854535,6932744,3864541],0, 0, '', '																																																																																																							gallery_375979.html',0,0);
				  	  					galleries[375980] = new gallery(375980,'4073457','The Chilterns','gallery',[4073457,6932438,6932686,6932689,6932908,6932909,6932910,6932913],0, 0, '', '																																																																																																							gallery_375980.html',0,0);
				  	  					galleries[375981] = new gallery(375981,'6932633,4218360,4218338,4218330,4218318,4218098,4218041,4218040,4218037,4218036','Oxford and the Cotswolds','gallery',[6932633,4218020,4218025,4218027,4218037,4218036,4218040,4218318,4218029,4218041,4218338,4218360,4218098,4218330],0, 0, '', '																																																																																																							gallery_375981.html',0,0);
				  	  					galleries[375982] = new gallery(375982,'6932906,6932627,4226124,4074056,4073984,4073442,3978885,3978880,3978864,3978700','Nature','gallery',[6932627,6932906,3896911,3854646,3978598,3978864,3855501,3978591,4073442,4073984,3864540,3864537,3978880,4074056,4226124,3978700,3978885],0, 0, '', '																																																																																																							gallery_375982.html',0,0);
				  	  					galleries[382037] = new gallery(382037,'7057275,7057267','Monaco','gallery',[7057257,7057266,7057267,7057270,7057273,7057275,7057276,7057278],0, 0, '', '																																																																																																							gallery_382037.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7057275,7057267,6932847,6932749,6932731,5177792,4218318,4073457,3854646,3854535,3854483,3854481,3854479';
imageSets[2] = '7057275,7057267,6932749,6932731,4073457';
imageSets[3] = '5177799,5177797,5177795,5177794,5177792,5177788,5177786,5177784,5177783,5177780,5177777,5177767,5177764,5177761,4226124,4218360,4218338,4218330,4218318,4218098,4218041,4218040,4218037,4218029,4218027,4218025,4218020';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/stevendurbin/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/stevendurbin/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 = 'Steven Durbin Photography: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));    }        
    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;
	}
}

		

