window.thumbnails = new Object();
												thumbnails[4442454] = new thumbnail(4442454,'258732','Waters Edge','100_1245_edited_thumb.jpg',130, 83,18,'							photo_4442454.html');
												thumbnails[4442607] = new thumbnail(4442607,'258732','Sunny Bay','100_1283_thumb.jpg',130, 87,18,'							photo_4442607.html');
												thumbnails[4442628] = new thumbnail(4442628,'258732','The Path<br>\r\n','100_1144_thumb.jpg',130, 87,18,'							photo_4442628.html');
												thumbnails[4442640] = new thumbnail(4442640,'258732','Lulworth Bay','100_1315_thumb.jpg',130, 87,18,'							photo_4442640.html');
												thumbnails[4442642] = new thumbnail(4442642,'258732','Man O War Bay','100_1324_edited_thumb.jpg',130, 87,18,'							photo_4442642.html');
												thumbnails[4442646] = new thumbnail(4442646,'258732','Durdle Door ','100_1345_edited_thumb.jpg',130, 91,18,'							photo_4442646.html');
												thumbnails[4442653] = new thumbnail(4442653,'258732','Paradise the Dorset Way','100_1732_edited_thumb.jpg',130, 88,18,'							photo_4442653.html');
												thumbnails[4449309] = new thumbnail(4449309,'258732','At Rest.....','100_1602_thumb.jpg',87, 130,18,'							photo_4449309.html');
												thumbnails[4449322] = new thumbnail(4449322,'258732','Weymouth ','100_1715_thumb.jpg',130, 87,18,'							photo_4449322.html');
												thumbnails[4449332] = new thumbnail(4449332,'258732','Dorset Sat Nav!','100_2069_thumb.jpg',130, 87,18,'							photo_4449332.html');
												thumbnails[4449339] = new thumbnail(4449339,'258732','West Bay','100_2098_thumb.jpg',130, 87,18,'							photo_4449339.html');
												thumbnails[4451326] = new thumbnail(4451326,'258732','Paradise','100_1128_533x800_thumb.jpg',87, 130,18,'							photo_4451326.html');
												thumbnails[4451331] = new thumbnail(4451331,'258732','Lazy Sunday','100_1294_533x800_thumb.jpg',87, 130,18,'							photo_4451331.html');
												thumbnails[4451332] = new thumbnail(4451332,'258732','Rolling fields....','100_1397_800x533_thumb.jpg',130, 87,18,'							photo_4451332.html');
												thumbnails[4451334] = new thumbnail(4451334,'258732','Boat Hire','100_1637_533x800_thumb.jpg',87, 130,18,'							photo_4451334.html');
												thumbnails[4451335] = new thumbnail(4451335,'258732','Red Arrows','100_1787_edited_800x658_thumb.jpg',130, 107,18,'							photo_4451335.html');
												thumbnails[4451336] = new thumbnail(4451336,'258732','Dorset Sunset','100_1801_533x800_thumb.jpg',87, 130,18,'							photo_4451336.html');
												thumbnails[4451337] = new thumbnail(4451337,'258732','Old Brewery','100_1850_800x570_thumb.jpg',130, 93,18,'							photo_4451337.html');
												thumbnails[4451339] = new thumbnail(4451339,'258732','Seating Plan','100_2114_800x533_thumb.jpg',130, 87,18,'							photo_4451339.html');
												thumbnails[4451340] = new thumbnail(4451340,'258732','Fishing Fleet','100_2214_800x533_thumb.jpg',130, 87,18,'							photo_4451340.html');
												thumbnails[4451344] = new thumbnail(4451344,'258732','West Bay ','100_2225_800x533_thumb.jpg',130, 87,18,'							photo_4451344.html');
												thumbnails[4451345] = new thumbnail(4451345,'258732','Hardy\'s Monument','100_2249_800x533_thumb.jpg',130, 87,18,'							photo_4451345.html');
												thumbnails[4984967] = new thumbnail(4984967,'258732','Lyme ','DSC01075_552x800_thumb.jpg',90, 130,18,'							photo_4984967.html');
												thumbnails[6366006] = new thumbnail(6366006,'258732','Harbour ','DSC00520_480x640_thumb.jpg',98, 130,18,'							photo_6366006.html');
												thumbnails[6366039] = new thumbnail(6366039,'258732','Sunset Sunday','DSC01385_640x480_thumb.jpg',130, 98,18,'							photo_6366039.html');
												thumbnails[6756489] = new thumbnail(6756489,'258732','Dorset Sundown','DSC00709_480x640_thumb.jpg',98, 130,18,'							photo_6756489.html');
												thumbnails[4442615] = new thumbnail(4442615,'258733','Sleeping Beauty','100_1367_thumb.jpg',87, 130,18,'							photo_4442615.html');
												thumbnails[4442768] = new thumbnail(4442768,'258733','Young Style','DSC00275_edited_thumb.JPG',77, 130,18,'							photo_4442768.html');
												thumbnails[4449284] = new thumbnail(4449284,'258733','Water Sport !','005_thumb.JPG',130, 87,18,'							photo_4449284.html');
												thumbnails[4449295] = new thumbnail(4449295,'258733','Hitching a ride !','100_1352_edited_thumb.jpg',94, 130,18,'							photo_4449295.html');
												thumbnails[4449369] = new thumbnail(4449369,'258733','Cornish Delight','351_800x533_thumb.jpg',130, 87,18,'							photo_4449369.html');
												thumbnails[4449378] = new thumbnail(4449378,'258733','Mousehole','417_thumb.JPG',130, 87,18,'							photo_4449378.html');
												thumbnails[4449392] = new thumbnail(4449392,'258733','Sacred Family','100_2864_thumb.jpg',87, 130,18,'							photo_4449392.html');
												thumbnails[4449459] = new thumbnail(4449459,'258733','Eggs!','100_2945_thumb.jpg',87, 130,18,'							photo_4449459.html');
												thumbnails[4449529] = new thumbnail(4449529,'258733','Carrots ','100_2946_533x800_thumb.jpg',87, 130,18,'							photo_4449529.html');
												thumbnails[4449540] = new thumbnail(4449540,'258733','Sunny Days!','100_2981_thumb.jpg',87, 130,18,'							photo_4449540.html');
												thumbnails[4449551] = new thumbnail(4449551,'258733','Dolphin ','100_3035_thumb.jpg',87, 130,18,'							photo_4449551.html');
												thumbnails[4449565] = new thumbnail(4449565,'258733','Big Wheel ','100_3234_thumb.jpg',130, 87,18,'							photo_4449565.html');
												thumbnails[4449578] = new thumbnail(4449578,'258733','Orange Market','100_3290_thumb.jpg',130, 87,18,'							photo_4449578.html');
												thumbnails[4449590] = new thumbnail(4449590,'258733','Trattoria','florence1_thumb.jpg',130, 98,18,'							photo_4449590.html');
												thumbnails[4449621] = new thumbnail(4449621,'258733','Helter Skelter','DSC00798_800x600_thumb.jpg',130, 98,18,'							photo_4449621.html');
												thumbnails[4449628] = new thumbnail(4449628,'258733','Sunny Window','DSC00804_600x800_thumb.jpg',98, 130,18,'							photo_4449628.html');
												thumbnails[4449646] = new thumbnail(4449646,'258733','Natural Light ','DSC00765_800x600_thumb.jpg',130, 98,18,'							photo_4449646.html');
												thumbnails[4449658] = new thumbnail(4449658,'258733','The Light of Heaven .......','DSC00766_600x800_thumb.jpg',98, 130,18,'							photo_4449658.html');
												thumbnails[4449665] = new thumbnail(4449665,'258733','Holy Light','DSC00767_800x600_thumb.jpg',130, 98,18,'							photo_4449665.html');
												thumbnails[4449671] = new thumbnail(4449671,'258733','Drinks','DSC00718_800x600_thumb.jpg',130, 98,18,'							photo_4449671.html');
												thumbnails[4449680] = new thumbnail(4449680,'258733','Old Living','DSC00670_600x800_thumb.jpg',98, 130,18,'							photo_4449680.html');
												thumbnails[4449706] = new thumbnail(4449706,'258733','Sunset Majorca','008_800x600_thumb.jpg',130, 98,18,'							photo_4449706.html');
												thumbnails[4449718] = new thumbnail(4449718,'258733','Reflecting Times','028_800x600_thumb.jpg',130, 98,18,'							photo_4449718.html');
												thumbnails[4449725] = new thumbnail(4449725,'258733','Stables','081_800x600_thumb.jpg',130, 98,18,'							photo_4449725.html');
												thumbnails[4449731] = new thumbnail(4449731,'258733','Field of Dreams','200_600x800_thumb.jpg',98, 130,18,'							photo_4449731.html');
												thumbnails[4449808] = new thumbnail(4449808,'258733','Cells','321_800x533_thumb.jpg',130, 87,18,'							photo_4449808.html');
												thumbnails[4449841] = new thumbnail(4449841,'258733','Skyline ','325_800x533_thumb.jpg',130, 87,18,'							photo_4449841.html');
												thumbnails[4449853] = new thumbnail(4449853,'258733','At Rest','511_533x800_thumb.jpg',87, 130,18,'							photo_4449853.html');
												thumbnails[4449862] = new thumbnail(4449862,'258733','Boats at Rest','418_533x800_thumb.jpg',87, 130,18,'							photo_4449862.html');
												thumbnails[4451292] = new thumbnail(4451292,'258733','Juices','100_2936_533x800_thumb.jpg',87, 130,18,'							photo_4451292.html');
												thumbnails[4451295] = new thumbnail(4451295,'258733','Lemon','100_2955_533x800_thumb.jpg',87, 130,18,'							photo_4451295.html');
												thumbnails[4451297] = new thumbnail(4451297,'258733','Elephant','100_3125_533x800_thumb.jpg',87, 130,18,'							photo_4451297.html');
												thumbnails[4451301] = new thumbnail(4451301,'258733','Tongue Tied','100_3135_533x800_thumb.jpg',87, 130,18,'							photo_4451301.html');
												thumbnails[4451305] = new thumbnail(4451305,'258733','Peachy!','100_3286_533x800_thumb.jpg',87, 130,18,'							photo_4451305.html');
												thumbnails[4451307] = new thumbnail(4451307,'258733','Window Views ','100_1512_533x800_thumb.jpg',87, 130,18,'							photo_4451307.html');
												thumbnails[4451313] = new thumbnail(4451313,'258733','Chimney Pots','barca17_480x360_thumb.jpg',130, 98,18,'							photo_4451313.html');
												thumbnails[4451325] = new thumbnail(4451325,'258733','Disney Magic','100_2564_edited_501x800_thumb.jpg',81, 130,18,'							photo_4451325.html');
												thumbnails[4451346] = new thumbnail(4451346,'258733','Bridesmaid','100_1942_533x800_thumb.jpg',87, 130,18,'							photo_4451346.html');
												thumbnails[4451347] = new thumbnail(4451347,'258733','Bride n Groom','100_1974_edited_610x800_thumb.jpg',99, 130,18,'							photo_4451347.html');
												thumbnails[4451376] = new thumbnail(4451376,'258733','Porthcurno Bay','STA70039_600x800_thumb.jpg',98, 130,18,'							photo_4451376.html');
												thumbnails[4451379] = new thumbnail(4451379,'258733','Tides Out','STA70025_1024x768_thumb.jpg',130, 98,18,'							photo_4451379.html');
												thumbnails[4451386] = new thumbnail(4451386,'258733','Mynack Theatre','STA70049_600x800_thumb.jpg',98, 130,18,'							photo_4451386.html');
												thumbnails[4451392] = new thumbnail(4451392,'258733','St Michaels Mount','STA70038_800x476_thumb.jpg',130, 77,18,'							photo_4451392.html');
												thumbnails[4984907] = new thumbnail(4984907,'258733','Glorious Dartmoor','DSC01165_800x600_thumb.jpg',130, 98,18,'							photo_4984907.html');
												thumbnails[4984923] = new thumbnail(4984923,'258733','Life on Mars .....','DSC01119_800x600_thumb.jpg',130, 98,18,'							photo_4984923.html');
												thumbnails[4984933] = new thumbnail(4984933,'258733','The Beach ','DSC01125_600x800_thumb.jpg',98, 130,18,'							photo_4984933.html');
												thumbnails[4984946] = new thumbnail(4984946,'258733','Surfers Bay','DSC01123_600x800_thumb.jpg',98, 130,18,'							photo_4984946.html');
												thumbnails[6365879] = new thumbnail(6365879,'258733','St Ives Tide','DSC00106_640x480_thumb.jpg',130, 98,18,'							photo_6365879.html');
												thumbnails[6365907] = new thumbnail(6365907,'258733','No Fishing','DSC00108_640x480_thumb.jpg',130, 98,18,'							photo_6365907.html');
												thumbnails[6365918] = new thumbnail(6365918,'258733','Purple!','DSC00296_480x640_thumb.jpg',98, 130,18,'							photo_6365918.html');
												thumbnails[6365930] = new thumbnail(6365930,'258733','Flower Pot','DSC00302_640x480_thumb.jpg',130, 98,18,'							photo_6365930.html');
												thumbnails[6365983] = new thumbnail(6365983,'258733','Plaza de Palma','DSC00399_640x480_thumb.jpg',130, 98,18,'							photo_6365983.html');
												thumbnails[6365993] = new thumbnail(6365993,'258733','Market Time','DSC00468_640x480_thumb.jpg',130, 98,18,'							photo_6365993.html');
												thumbnails[6366007] = new thumbnail(6366007,'258733','Beached......','DSC00524_640x480_thumb.jpg',130, 98,18,'							photo_6366007.html');
												thumbnails[6366011] = new thumbnail(6366011,'258733','Place to rest......','DSC00526_640x480_thumb.jpg',130, 98,18,'							photo_6366011.html');
												thumbnails[6366022] = new thumbnail(6366022,'258733','Beer in Bloom','DSC00530_640x480_thumb.jpg',130, 98,18,'							photo_6366022.html');
												thumbnails[7096092] = new thumbnail(7096092,'258733','Roller','DSC00865_thumb.JPG',130, 98,18,'							photo_7096092.html');
												thumbnails[7096101] = new thumbnail(7096101,'258733','Roller!','DSC008651_thumb.JPG',130, 98,18,'							photo_7096101.html');
												thumbnails[7096177] = new thumbnail(7096177,'258733','Tiggy','DSC00794_640x480_thumb.jpg',130, 98,18,'							photo_7096177.html');
												thumbnails[7096180] = new thumbnail(7096180,'258733','Windows','DSC00816_640x480_thumb.jpg',130, 98,18,'							photo_7096180.html');
												thumbnails[7096188] = new thumbnail(7096188,'258733','Fountain','DSC00874_480x640_thumb.jpg',98, 130,18,'							photo_7096188.html');
												thumbnails[7096197] = new thumbnail(7096197,'258733','Roller!','DSC008652_thumb.JPG',130, 98,18,'							photo_7096197.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[258732] = new gallery(258732,'6756489,6366039,6366006,4984967,4451345,4451344,4451340,4451339,4451337,4451336','Dorset','gallery',[4442454,4442607,4442628,4442640,4442642,4442646,4442653,4449309,4449322,4449332,4449339,4451326,4451331,4451332,4451334,4451335,4451336,4451337,4451339,4451340,4451344,4451345,4984967,6366006,6366039,6756489],0, 1, '', '																																																																																																							gallery_258732.html',0,0);
				  					galleries[258733] = new gallery(258733,'7096197,7096188,7096180,7096177,7096101,7096092,6366022,6366011,6366007,6365993','People and Places','gallery',[4442615,4442768,4449284,4449295,4449369,4449378,4449392,4449459,4449529,4449540,4449551,4449565,4449578,4449590,4449621,4449628,4449646,4449658,4449665,4449671,4449680,4449706,4449718,4449725,4449731,4449808,4449841,4449853,4449862,4451292,4451295,4451297,4451301,4451305,4451307,4451313,4451325,4451346,4451347,4451376,4451379,4451386,4451392,4984907,4984923,4984933,4984946,6365879,6365907,6365918,6365930,6365983,6365993,6366007,6366011,6366022,7096092,7096101,7096177,7096180,7096188,7096197],0, 1, '', '																																																																																																							gallery_258733.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7096197,7096188,7096180,7096177,7096101,7096092,6756489,6366039,6366022,6366011,6366007,6366006,6365993,6365983,6365930,6365918,6365907,6365879,4984967,4984946,4984933,4984923,4984907,4451392,4451386,4451379,4451376,4451347,4451346,4451345,4451344,4451340,4451339,4451337,4451336,4451335,4451334,4451332,4451331,4451326,4451325,4451313,4451307,4451305,4451301,4451297,4451295,4451292,4449862,4449853';
imageSets[3] = '7096197,7096188,7096180,7096177,7096101,7096092,6756489,6366039,6366022,6366011,6366007,6366006,6365993,6365983,6365930,6365918,6365907,6365879,4984967,4984946,4984933,4984923,4984907,4451392,4451386,4451379,4451376,4451347,4451346,4451345,4451344,4451340,4451339,4451337,4451336,4451335,4451334,4451332,4451331,4451326,4451325,4451313,4451307,4451305,4451301,4451297,4451295,4451292,4449862,4449853';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/domski/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/domski/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/domski/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/domski/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/domski/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/domski/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/domski/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 = 'dominictancock: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {photoinfominwidth:200};	    		options.photoinfoadjacent = true;			      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object') {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			option_id = 0;
			if(form.item_option.value){
				option_id = form.item_option.value;
			}
			if(addItemToBasket(form.item_number.value,array,form.site.value,parseInt(form.quantity.value, 10),option_id)){
				if($.browser.msie){$('#paymentConfirm').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> 							' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = temp + '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
				
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp = temp + '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
		
	if(img){
	      if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
        imageID = imageID[1];
      } else {
			  imageID = randomListVal(galleries[gallery_id].featured_images);
      }
							
			if (imageID != 0) {
				img.src = thumbnails[imageID].src;
				img.width = thumbnails[imageID].width;
				img.height = thumbnails[imageID].height;
				img.alt = galleries[gallery_id].title;
        if (updateLink) {
          $(img).parent().attr({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp = temp + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

