window.thumbnails = new Object();
												thumbnails[7932494] = new thumbnail(7932494,'','','Picture-1_thumb.jpg',130, 56,32,'#');
												thumbnails[2368588] = new thumbnail(2368588,'217488','Towards Poldhu','Landscape-1_thumb.jpg',130, 99,32,'photo_2368588.html');
												thumbnails[2371794] = new thumbnail(2371794,'217488','Mullion Cove','Landscape-2_thumb.jpg',130, 83,32,'photo_2371794.html');
												thumbnails[2371797] = new thumbnail(2371797,'217488','St Ives','Landscape-3_thumb.jpg',130, 96,32,'photo_2371797.html');
												thumbnails[2371802] = new thumbnail(2371802,'217487','Thames in Flood','Landscape-5_thumb.jpg',130, 92,32,'photo_2371802.html');
												thumbnails[2371806] = new thumbnail(2371806,'217488','Towards Carbis Bay','Landscape-6_thumb.jpg',130, 87,32,'photo_2371806.html');
												thumbnails[2371816] = new thumbnail(2371816,'217488','Towards Polurrian Cove','Landscape-9_thumb.jpg',130, 107,32,'photo_2371816.html');
												thumbnails[2371844] = new thumbnail(2371844,'217489','Eynsham Hollyhocks<br>\r\n','Floral-41_thumb.jpg',130, 171,32,'photo_2371844.html');
												thumbnails[2371847] = new thumbnail(2371847,'217489','Red Primula','Floral-61_thumb.jpg',130, 165,32,'photo_2371847.html');
												thumbnails[2371852] = new thumbnail(2371852,'217489','Red Tulips','Floral-33_thumb.jpg',130, 177,32,'photo_2371852.html');
												thumbnails[2371854] = new thumbnail(2371854,'217489','Purple Primula','Floral-51_thumb.jpg',130, 146,32,'photo_2371854.html');
												thumbnails[2371857] = new thumbnail(2371857,'217489','Purple Tulips','Floral-23_thumb.jpg',130, 130,32,'photo_2371857.html');
												thumbnails[2371893] = new thumbnail(2371893,'217488','Seagull St Ives','Landscape-41_thumb.jpg',130, 153,32,'photo_2371893.html');
												thumbnails[2371895] = new thumbnail(2371895,'217488','Lighthouse','Landscape-81_thumb.jpg',130, 127,32,'photo_2371895.html');
												thumbnails[2371896] = new thumbnail(2371896,'217488','St Ives Lighthouse','Landscape-101_thumb.jpg',130, 130,32,'photo_2371896.html');
												thumbnails[2371899] = new thumbnail(2371899,'217488','Harbour','Abstract-41_thumb.jpg',130, 132,32,'photo_2371899.html');
												thumbnails[2372747] = new thumbnail(2372747,'217490','Bottle & Jug','Abstract-11_thumb.jpg',130, 124,32,'photo_2372747.html');
												thumbnails[2466014] = new thumbnail(2466014,'217487','River Autumn','S11_thumb.jpg',130, 95,32,'photo_2466014.html');
												thumbnails[2466015] = new thumbnail(2466015,'217487','River Barn','S2_thumb.jpg',130, 94,32,'photo_2466015.html');
												thumbnails[2466016] = new thumbnail(2466016,'217488','Polurrian Cove','S3_thumb.jpg',130, 121,32,'photo_2466016.html');
												thumbnails[2466020] = new thumbnail(2466020,'217489','Yellow Lillies','S41_thumb.jpg',130, 179,32,'photo_2466020.html');
												thumbnails[2466021] = new thumbnail(2466021,'217489','Yellow Primula','S5a_thumb.jpg',130, 194,32,'photo_2466021.html');
												thumbnails[2466022] = new thumbnail(2466022,'217489','Azalea in patterned Pot','S5b_thumb.jpg',130, 173,32,'photo_2466022.html');
												thumbnails[2466023] = new thumbnail(2466023,'217489','Purple Flowers','S6a_thumb.jpg',130, 147,32,'photo_2466023.html');
												thumbnails[2466025] = new thumbnail(2466025,'217487','Spring Tree','S6b_thumb.jpg',130, 163,32,'photo_2466025.html');
												thumbnails[2466026] = new thumbnail(2466026,'217489','Yellow Primroses','S7a_thumb.jpg',130, 149,32,'photo_2466026.html');
												thumbnails[2466028] = new thumbnail(2466028,'217487','River Spring','S7b_thumb.jpg',130, 92,32,'photo_2466028.html');
												thumbnails[2466030] = new thumbnail(2466030,'217487','Two Narrow Boats','S8a_thumb.jpg',130, 88,32,'photo_2466030.html');
												thumbnails[2466031] = new thumbnail(2466031,'217489','Purple Primula in Yellow Pot','S8b_thumb.jpg',130, 168,32,'photo_2466031.html');
												thumbnails[2466033] = new thumbnail(2466033,'217487','River Tree','S8c_thumb.jpg',130, 189,32,'photo_2466033.html');
												thumbnails[2466034] = new thumbnail(2466034,'217489','Purple Tulips in Yellow Vase','S9_thumb.jpg',130, 186,32,'photo_2466034.html');
												thumbnails[2466041] = new thumbnail(2466041,'217487','River Trees','S10_thumb.jpg',130, 102,32,'photo_2466041.html');
												thumbnails[2466077] = new thumbnail(2466077,'217489','Yellow and Purple Primula','S111_thumb.jpg',130, 88,32,'photo_2466077.html');
												thumbnails[2466078] = new thumbnail(2466078,'217487','Bird Tree','S12_thumb.jpg',130, 191,32,'photo_2466078.html');
												thumbnails[2466085] = new thumbnail(2466085,'217490','Snowdrops','S13a_thumb.jpg',130, 206,32,'photo_2466085.html');
												thumbnails[2466087] = new thumbnail(2466087,'217490','Early Snowdrops','S13b_thumb.jpg',130, 134,32,'photo_2466087.html');
												thumbnails[2466089] = new thumbnail(2466089,'217488','Cornish Tree','S14_thumb.jpg',130, 129,32,'photo_2466089.html');
												thumbnails[2466093] = new thumbnail(2466093,'217489','White Lilies','S15_thumb.jpg',130, 173,32,'photo_2466093.html');
												thumbnails[2710104] = new thumbnail(2710104,'217488','Boat and Buoy','boat_thumb.jpg',130, 84,32,'photo_2710104.html');
												thumbnails[3059799] = new thumbnail(3059799,'217488','From Polurrian Cliff','test-n1_thumb.jpg',130, 126,32,'photo_3059799.html');
												thumbnails[3059803] = new thumbnail(3059803,'217488','From Mullion Cove Hotel','test-n2_thumb.jpg',130, 100,32,'photo_3059803.html');
												thumbnails[3059807] = new thumbnail(3059807,'217489','Window Sill Flowers','test-n3_thumb.jpg',130, 130,32,'photo_3059807.html');
												thumbnails[3059812] = new thumbnail(3059812,'217488','Mullion Cove Harbour','test-n5_thumb.jpg',130, 170,32,'photo_3059812.html');
												thumbnails[3059815] = new thumbnail(3059815,'217488','View from Coast Guard Cottage','test-n6_thumb.jpg',130, 101,32,'photo_3059815.html');
												thumbnails[3059820] = new thumbnail(3059820,'217488','Coast Guard Cottage View','test-n7_thumb.jpg',130, 142,32,'photo_3059820.html');
												thumbnails[3554675] = new thumbnail(3554675,'217489','Red Cyclamen','proof--crop-mont-flowers_thumb.jpg',130, 134,32,'photo_3554675.html');
												thumbnails[3560731] = new thumbnail(3560731,'217487','Dutch Barge','dutch-barge_thumb.jpg',130, 116,32,'photo_3560731.html');
												thumbnails[5153201] = new thumbnail(5153201,'217488','Predannack','click-Predannack_thumb.jpg',130, 119,32,'photo_5153201.html');
												thumbnails[5563861] = new thumbnail(5563861,'217489','Daffodil One','Daffodil-One_thumb.jpg',130, 104,32,'photo_5563861.html');
												thumbnails[5563865] = new thumbnail(5563865,'217489','Daffodil Two','Daffodil-Two_thumb.jpg',130, 170,32,'photo_5563865.html');
												thumbnails[5563906] = new thumbnail(5563906,'217489','Flowers and Pebbles','Flowers-and-pecbbles_thumb.jpg',130, 163,32,'photo_5563906.html');
												thumbnails[5563911] = new thumbnail(5563911,'217488','Carag Luz  (Love Rock)','Caragg-Luv-_thumb.jpg',130, 100,32,'photo_5563911.html');
												thumbnails[5563924] = new thumbnail(5563924,'217488','Mullion Cove Hotel','Mullion-Cove-Hotel_thumb.jpg',130, 104,32,'photo_5563924.html');
												thumbnails[5563935] = new thumbnail(5563935,'217488','Mullion Cove Hotel 2','tMullion-Cove-Hotel-Two_thumb.jpg',130, 170,32,'photo_5563935.html');
												thumbnails[5609103] = new thumbnail(5609103,'217489','Yellow Flowers in Blue Glass','Yellow_Fowers_in_Blue_Glass_thumb.jpg',130, 188,32,'photo_5609103.html');
												thumbnails[2371805] = new thumbnail(2371805,'217488','Carbis Bay','Landscape-6--CROP-3_thumb.jpg',130, 107,32,'photo_2371805.html');
												thumbnails[2372751] = new thumbnail(2372751,'217490','Bottle & Jug Blue','Abstract-23_thumb.jpg',130, 124,32,'photo_2372751.html');
												thumbnails[2371819] = new thumbnail(2371819,'217488','Sand Ripples 2','Landscape6---Crop-2_thumb.jpg',130, 107,32,'photo_2371819.html');
												thumbnails[2371803] = new thumbnail(2371803,'217488','Sand Ripples 1','Landscape-6---CROP-1_thumb.jpg',130, 107,32,'photo_2371803.html');
												thumbnails[2371809] = new thumbnail(2371809,'217488','Mullion Island','Landscape-7-crop-2_thumb.jpg',130, 104,32,'photo_2371809.html');
												thumbnails[2371808] = new thumbnail(2371808,'217488','Sea and Sand 1','Landscape-7-crop-1_thumb.jpg',130, 104,32,'photo_2371808.html');
												thumbnails[2371812] = new thumbnail(2371812,'217488','Sea and Sand 2','Landscape-7-crop-4-_thumb.jpg',130, 103,32,'photo_2371812.html');
												thumbnails[2371799] = new thumbnail(2371799,'217488','St Ives<br>\r\nRed Buoy','Landscape-4-cottages-two_thumb.jpg',130, 120,32,'photo_2371799.html');
												thumbnails[2371800] = new thumbnail(2371800,'217488','St Ives<br>\r\nDetail','Landscape-4-long-cottages_thumb.jpg',130, 55,32,'photo_2371800.html');
												thumbnails[2371810] = new thumbnail(2371810,'217488','Polurrian Detail','Landscape-7-crop-3-_thumb.jpg',130, 42,32,'photo_2371810.html');
												thumbnails[6236892] = new thumbnail(6236892,'347229','Carnations in Cornish Vase','BLU-WHITE-VASE--PEBBLES_thumb.jpg',130, 116,32,'photo_6236892.html');
												thumbnails[6236893] = new thumbnail(6236893,'347229','Spring Flowers in Blue Jug','Flowers-blue-vase-pebbles_thumb.jpg',130, 131,32,'photo_6236893.html');
												thumbnails[6236894] = new thumbnail(6236894,'347229','Primula in Blue Striped Bowl','Fowers-Red-Background_thumb.jpg',130, 129,32,'photo_6236894.html');
												thumbnails[6236896] = new thumbnail(6236896,'347229','White Chrysanthemums','Oide-Daisies-with-pebbles_thumb.jpg',130, 158,32,'photo_6236896.html');
												thumbnails[6236903] = new thumbnail(6236903,'347229','Flowers and Pebbles','test-p2_thumb.jpg',130, 163,32,'photo_6236903.html');
												thumbnails[6237001] = new thumbnail(6237001,'347229','Mixed Flowers in Yellow Vase','Vase-Flowers_thumb.jpg',130, 157,32,'photo_6237001.html');
												thumbnails[6255481] = new thumbnail(6255481,'347229','Green Palm','SMALL_Green_Palm_thumb.jpg',130, 129,32,'photo_6255481.html');
												thumbnails[7413011] = new thumbnail(7413011,'347229','Godrevy, Winter Sunset','Godrevey-Winter-Sunset_thumb.jpg',130, 131,32,'photo_7413011.html');
												thumbnails[7413020] = new thumbnail(7413020,'347229','Pink and Yellow Roses','Pink-and-Yellow-Roses_thumb.jpg',130, 130,32,'photo_7413020.html');
												thumbnails[7413023] = new thumbnail(7413023,'347229','Mullion Island, Winter','Mullion-Island-Winter_thumb.jpg',130, 104,32,'photo_7413023.html');
												thumbnails[7413026] = new thumbnail(7413026,'347229','Polurrian Cove, Winter','Polurrian-Cove-Winter_thumb.jpg',130, 111,32,'photo_7413026.html');
												thumbnails[7413028] = new thumbnail(7413028,'347229','Flowers and Mussel Shell','Flowers-ans-Mussel-Shell_thumb.jpg',130, 157,32,'photo_7413028.html');
												thumbnails[6236897] = new thumbnail(6236897,'347229','Polurrian with Big Clouds','Polurrian-Cove_thumb.jpg',130, 102,32,'photo_6236897.html');
												thumbnails[6236902] = new thumbnail(6236902,'347229','Carag Luz (Love Rock)','test-p1_thumb.jpg',130, 100,32,'photo_6236902.html');
												thumbnails[6237002] = new thumbnail(6237002,'347229','Cat with Eiderdown','test-Crackers-11_thumb.jpg',130, 100,32,'photo_6237002.html');
												thumbnails[6236898] = new thumbnail(6236898,'347229','Cat with Quilt','SUE-CROP-test-Crackers-2_thumb.jpg',130, 97,32,'photo_6236898.html');
												thumbnails[6236899] = new thumbnail(6236899,'347229','Cat with Newspaper','test-Crackers-3_thumb.jpg',130, 106,32,'photo_6236899.html');
												thumbnails[6236900] = new thumbnail(6236900,'347229','Cat with Pink Stripes','test-Crackers-4_thumb.jpg',130, 92,32,'photo_6236900.html');
												thumbnails[6243801] = new thumbnail(6243801,'347229','Cat with Cushion','test-Nimble_thumb.jpg',130, 93,32,'photo_6243801.html');
												thumbnails[7027903] = new thumbnail(7027903,'347229','Flowers in Blue Vase','Flowers-grey-vase_thumb.jpg',130, 153,32,'photo_7027903.html');
												thumbnails[7027904] = new thumbnail(7027904,'347229','Flowers in Blue Jug','Flowers-blue-vase_thumb.jpg',130, 154,32,'photo_7027904.html');
												thumbnails[7030214] = new thumbnail(7030214,'347229','Carnations in Glass Vase','Framed-Flowers_thumb.jpg',130, 156,32,'photo_7030214.html');
												thumbnails[7027905] = new thumbnail(7027905,'347229','Flowers with Blue Stripe','Flowers-small_thumb.jpg',130, 129,32,'photo_7027905.html');
												thumbnails[7027908] = new thumbnail(7027908,'347229','Cowparsley towards Poldhu','alt-building-Seascape-One_thumb.jpg',130, 107,32,'photo_7027908.html');
												thumbnails[7027909] = new thumbnail(7027909,'347229','Cowparsley towards Mullion Island','Seascape-two_thumb.jpg',130, 128,32,'photo_7027909.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[217488] = new gallery(217488,'2371799,2368588','Cornish Sea and Landscapes','section199393',[2368588,2371794,2371797,2371806,2371816,2371893,2371895,2371896,2371899,2466016,2466089,2710104,3059799,3059803,3059812,3059815,3059820,5153201,5563911,5563924,5563935,2371805,2371819,2371803,2371809,2371808,2371812,2371799,2371800,2371810],0, 1, '', 'section199393_217488.html',0,0);
				  					galleries[217489] = new gallery(217489,'2371847','Flora','section199393',[2371844,2371847,2371852,2371854,2371857,2466020,2466021,2466022,2466023,2466026,2466031,2466034,2466077,2466093,3059807,3554675,5563861,5563865,5563906,5609103],0, 1, '', 'section199393_217489.html',0,0);
				  					galleries[347229] = new gallery(347229,'7413028,7413026,7413023,7413020,7413011,7030214,7027909,7027908,7027905,7027904','New Work','section414524',[6236892,6236893,6236894,6236896,6236903,6237001,6255481,7413011,7413020,7413023,7413026,7413028,6236897,6236902,6237002,6236898,6236899,6236900,6243801,7027903,7027904,7030214,7027905,7027908,7027909],0, 1, '', 'section414524.html',0,1);
				  					galleries[217487] = new gallery(217487,'3560731,2466078,2466041,2466033,2466030,2466028,2466025,2466015,2466014,2371802','River Views','section199393',[2371802,2466014,2466015,2466025,2466028,2466030,2466033,2466041,2466078,3560731],0, 1, '', 'section199393_217487.html',0,0);
				  					galleries[217490] = new gallery(217490,'2466087,2466085,2372751,2372747','Other Work','section199393',[2372747,2466085,2466087,2372751],0, 1, '', 'section199393_217490.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7413028,7413026,7413023,7413020,7413011';
imageSets[2] = '2371847,2371799,2368588';
imageSets[3] = '7932494,7413028,7413026,7413023,7413020,7413011,7030214,7027909,7027908,7027905,7027904,7027903,6255481,6243801,6237002,6237001,6236903,6236902,6236900,6236899,6236898,6236897,6236896,6236894,6236893,6236892,5609103,5563935,5563924,5563911,5563906,5563865,5563861,5153201,3560731,3554675,3059820,3059815,3059812,3059807,3059803,3059799,2710104,2466093,2466089,2466087,2466085,2466078,2466077,2466041';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/grendonsue/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/grendonsue/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 += 'section199393.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 && 'section199393' != '') {
					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));		  $('body').trigger('clikUpdate');		}, 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 = 'SUE TEMPLEMAN: ' + 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));      $('body').trigger('clikUpdate');    }        
    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 == undefined) {
    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="updateCartValue(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
				
		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">';
	temp = temp + '	<input type="hidden" name="item_option" value="' + item_option + '">';
	temp = temp + '	<input type="hidden" name="site" value="GRENDONSUE">';
		temp = temp + '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp = temp + '	<input type="hidden" name="quantity" value="1">';
								temp = temp + '	<input value="Add to cart" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
			temp = temp + '	<input value="View cart" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
	temp = temp + '</form>';
		temp = temp + '<div class="clearing">&nbsp;</div>';
	temp = temp + '<div id="confirmContainer">';
	temp = temp + '<div id="paymentConfirm">Item added to cart</div>';
	temp = temp + '</div>';
			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;
	}
}

			

