window.thumbnails = new Object();
												thumbnails[6001751] = new thumbnail(6001751,'221053','Baggeridge Wood bluebells','IMG_2035_thumb.jpg',130, 87,15,'							photo_6001751.html');
												thumbnails[7230287] = new thumbnail(7230287,'212867','The Glyders in winter','P1030129_thumb.jpg',130, 98,15,'							photo_7230287.html');
												thumbnails[4645261] = new thumbnail(4645261,'221053','Caer Caradoc','IMG_0684_thumb.jpg',130, 87,15,'							photo_4645261.html');
												thumbnails[5041121] = new thumbnail(5041121,'213006','Grey Heron','IMG_4018_thumb.jpg',130, 87,15,'							photo_5041121.html');
												thumbnails[3483189] = new thumbnail(3483189,'213006','Moo!','IMG_1204_thumb.JPG',130, 87,15,'							photo_3483189.html');
												thumbnails[5414085] = new thumbnail(5414085,'221053','Evening light on The Lawley','IMG_45533_thumb.jpg',130, 87,15,'							photo_5414085.html');
												thumbnails[5706616] = new thumbnail(5706616,'212882','Pistyll Rhyd-y-meinciau','IMG_1421_thumb.jpg',130, 87,15,'							photo_5706616.html');
												thumbnails[5916734] = new thumbnail(5916734,'212867','Craig Cau over Llyn Cau','IMG_1723_thumb.jpg',130, 87,15,'							photo_5916734.html');
												thumbnails[3483203] = new thumbnail(3483203,'213006','Feed me!','IMG_1930_thumb.JPG',130, 87,15,'							photo_3483203.html');
												thumbnails[3483200] = new thumbnail(3483200,'213006','Robin','IMG_1929_thumb.JPG',130, 87,15,'							photo_3483200.html');
												thumbnails[4998108] = new thumbnail(4998108,'221053','Wombourne railway walk','IMG_3939_thumb.jpg',130, 87,15,'							photo_4998108.html');
												thumbnails[5965657] = new thumbnail(5965657,'212867','Moel Siabod','IMG_5105_thumb.jpg',130, 87,15,'							photo_5965657.html');
												thumbnails[3480624] = new thumbnail(3480624,'212882','Cadair Berwyn','IMG_1805_thumb.JPG',130, 87,15,'							photo_3480624.html');
												thumbnails[3483193] = new thumbnail(3483193,'221053','Crops','IMG_1210_thumb.JPG',130, 87,15,'							photo_3483193.html');
												thumbnails[4310873] = new thumbnail(4310873,'213006','Poppies','IMG_0035_thumb.jpg',130, 87,15,'							photo_4310873.html');
												thumbnails[5916904] = new thumbnail(5916904,'212867','On Cadair Idris','IMG_1804_thumb.jpg',130, 87,15,'							photo_5916904.html');
												thumbnails[5496017] = new thumbnail(5496017,'212867','Tryfan','IMG_1157_thumb.jpg',130, 87,15,'							photo_5496017.html');
												thumbnails[7230294] = new thumbnail(7230294,'212867','Winter sunset over Tryfan','P1030146_thumb.jpg',130, 98,15,'							photo_7230294.html');
												thumbnails[4310888] = new thumbnail(4310888,'221053','Sunset over Shropshire','IMG_0178_thumb.jpg',130, 87,15,'							photo_4310888.html');
												thumbnails[5496015] = new thumbnail(5496015,'212867','Glyder Fach','IMG_1192_thumb.jpg',130, 87,15,'							photo_5496015.html');
												thumbnails[5340371] = new thumbnail(5340371,'212867','Storm clouds roll in from Anglesey','IMG_4379_thumb.jpg',130, 87,15,'							photo_5340371.html');
												thumbnails[4461613] = new thumbnail(4461613,'212882','Llyn Lluncaws','IMG_0482_thumb.jpg',130, 87,15,'							photo_4461613.html');
												thumbnails[5686767] = new thumbnail(5686767,'212867','Aran Fawddwy over Creiglyn Dyfi','IMG_4738_thumb.jpg',130, 87,15,'							photo_5686767.html');
												thumbnails[6870296] = new thumbnail(6870296,'212867','Y Lliwedd and Snowdon over Llyn Llydaw','P1020393_thumb.jpg',130, 98,15,'							photo_6870296.html');
												thumbnails[5241873] = new thumbnail(5241873,'212867','Nant Bochlwyd','IMG_4060_thumb.jpg',130, 87,15,'							photo_5241873.html');
												thumbnails[5496028] = new thumbnail(5496028,'212867','Bristly Ridge from Cwm Tryfan','IMG_1159_thumb.jpg',130, 87,15,'							photo_5496028.html');
												thumbnails[3612598] = new thumbnail(3612598,'221053','Devil\'s Chair','IMG_2447_thumb.jpg',130, 87,15,'							photo_3612598.html');
												thumbnails[3814603] = new thumbnail(3814603,'212882','The Berwyns','IMG_2726_thumb.jpg',130, 87,15,'							photo_3814603.html');
												thumbnails[5025816] = new thumbnail(5025816,'212867','Afon Llugwy','IMG_3978_thumb.jpg',130, 87,15,'							photo_5025816.html');
												thumbnails[6870267] = new thumbnail(6870267,'212867','The Snowdon Horseshoe','Horseshoe_panorama_thumb.jpg',130, 61,15,'							photo_6870267.html');
												thumbnails[5496013] = new thumbnail(5496013,'212867','Tryfan over Llyn Idwal','IMG_1237_thumb.jpg',130, 87,15,'							photo_5496013.html');
												thumbnails[5589955] = new thumbnail(5589955,'212867','Glyder Fach emerges from cloud','IMG_1182_thumb.jpg',130, 87,15,'							photo_5589955.html');
												thumbnails[6870372] = new thumbnail(6870372,'212867','Crib Goch','P1020443_thumb.jpg',130, 98,15,'							photo_6870372.html');
												thumbnails[6870543] = new thumbnail(6870543,'212867','The Snowdon Horseshoe','P1020483_thumb.jpg',130, 98,15,'							photo_6870543.html');
												thumbnails[4890934] = new thumbnail(4890934,'212867','Y Garn and the Nant Ffrancon','IMG_3757_thumb.jpg',130, 87,15,'							photo_4890934.html');
												thumbnails[4874599] = new thumbnail(4874599,'212867','Tryfan from Llyn Caseg-fraith','IMG_3782_thumb.jpg',130, 87,15,'							photo_4874599.html');
												thumbnails[5599044] = new thumbnail(5599044,'212867','Aran Benllyn','IMG_4764_thumb.jpg',130, 87,15,'							photo_5599044.html');
												thumbnails[3814604] = new thumbnail(3814604,'212882','Cadair Berwyn summit','IMG_2721_thumb.jpg',130, 195,15,'							photo_3814604.html');
												thumbnails[5393891] = new thumbnail(5393891,'212867','Storm clouds over Moel Eilio','IMG_4371_thumb.jpg',130, 87,15,'							photo_5393891.html');
												thumbnails[3540307] = new thumbnail(3540307,'221053','Broadway Tower, the Cotswolds','IMG_2347_thumb.JPG',130, 87,15,'							photo_3540307.html');
												thumbnails[4889743] = new thumbnail(4889743,'212867','Tryfan & Llyn Caseg-fraith','IMG_3781_thumb.jpg',130, 87,15,'							photo_4889743.html');
												thumbnails[3480626] = new thumbnail(3480626,'212882','Moel Sych and Cadair Berwyn','IMG_1820_thumb.JPG',130, 195,15,'							photo_3480626.html');
												thumbnails[3725894] = new thumbnail(3725894,'212867','The West face of Tryfan','IMG_2629_thumb.jpg',130, 87,15,'							photo_3725894.html');
												thumbnails[4785429] = new thumbnail(4785429,'213006','Autumn leaves','IMG_0857_thumb.jpg',130, 195,15,'							photo_4785429.html');
												thumbnails[3480636] = new thumbnail(3480636,'212867','Cadair Idris','IMG_1900_thumb.JPG',130, 87,15,'							photo_3480636.html');
												thumbnails[4487693] = new thumbnail(4487693,'221053','Devil\'s Chair','IMG_0550_thumb.jpg',130, 195,15,'							photo_4487693.html');
												thumbnails[4521504] = new thumbnail(4521504,'221053','Ironbridge powerstation','IMG_0568_thumb.jpg',130, 195,15,'							photo_4521504.html');
												thumbnails[4890130] = new thumbnail(4890130,'212867','Bristly Ridge and Tryfan','IMG_3776_thumb.jpg',130, 87,15,'							photo_4890130.html');
												thumbnails[3725844] = new thumbnail(3725844,'212867','The Cantilever stone','IMG_2592_thumb.jpg',130, 87,15,'							photo_3725844.html');
												thumbnails[4487726] = new thumbnail(4487726,'221053','Stiperstones','IMG_0545_thumb.jpg',130, 195,15,'							photo_4487726.html');
												thumbnails[5271548] = new thumbnail(5271548,'212867','On Cadair Idris','IMG_4181_thumb.jpg',130, 87,15,'							photo_5271548.html');
												thumbnails[4385107] = new thumbnail(4385107,'212867','Y Garn across Cwm Idwal','IMG_3631_thumb.jpg',130, 87,15,'							photo_4385107.html');
												thumbnails[4725925] = new thumbnail(4725925,'212867','Crib Nantlle','IMG_3684_thumb.jpg',130, 87,15,'							photo_4725925.html');
												thumbnails[3725879] = new thumbnail(3725879,'212867','Glyder Fach\'s summit ','IMG_2614_thumb.jpg',130, 87,15,'							photo_3725879.html');
												thumbnails[3480618] = new thumbnail(3480618,'212882','Pistyll Rhaeadr','IMG_1673_thumb.JPG',130, 195,15,'							photo_3480618.html');
												thumbnails[3725811] = new thumbnail(3725811,'212867','Y Garn and Glyder Fawr','IMG_2570_thumb.jpg',130, 87,15,'							photo_3725811.html');
												thumbnails[3656386] = new thumbnail(3656386,'212867','Yr Wyddfa','IMG_2454_thumb.jpg',130, 87,15,'							photo_3656386.html');
												thumbnails[3656403] = new thumbnail(3656403,'212867','Snowdon marker stone','IMG_2479_thumb.jpg',130, 87,15,'							photo_3656403.html');
												thumbnails[3480645] = new thumbnail(3480645,'212867','Moel Siabod summit in winter','IMG_2164_thumb.JPG',130, 87,15,'							photo_3480645.html');
												thumbnails[4390707] = new thumbnail(4390707,'212867','Tryfan','IMG_3659_thumb.jpg',130, 87,15,'							photo_4390707.html');
												thumbnails[3480635] = new thumbnail(3480635,'212867','Mynydd Pencoed','IMG_1885_thumb.JPG',130, 87,15,'							photo_3480635.html');
												thumbnails[3480633] = new thumbnail(3480633,'212867','Glyder Fach','IMG_1843_thumb.JPG',130, 87,15,'							photo_3480633.html');
												thumbnails[3480631] = new thumbnail(3480631,'212867','Snowdon from the Glyders','IMG_1837_thumb.jpg',130, 87,15,'							photo_3480631.html');
												thumbnails[3480588] = new thumbnail(3480588,'212867','Tryfan & the Glyders','IMG_0608_thumb.JPG',130, 87,15,'							photo_3480588.html');
												thumbnails[5923045] = new thumbnail(5923045,'212867','Rhosydd slate mine ruins','IMG_1657_thumb.jpg',130, 195,15,'							photo_5923045.html');
												thumbnails[4890554] = new thumbnail(4890554,'212867','Y Garn','IMG_3758_thumb.jpg',130, 195,15,'							photo_4890554.html');
												thumbnails[6870480] = new thumbnail(6870480,'212867','A boat in Aberdyfi harbour','P1020315_thumb.jpg',130, 171,15,'							photo_6870480.html');
												thumbnails[5030081] = new thumbnail(5030081,'212867','Pont Cyfyng','IMG_3994_thumb.jpg',130, 195,15,'							photo_5030081.html');
												thumbnails[3725702] = new thumbnail(3725702,'212867','Y Garn from Tryfan','IMG_2571_thumb.jpg',130, 195,15,'							photo_3725702.html');
												thumbnails[5496096] = new thumbnail(5496096,'212867','Tryfan over Llyn Idwal','IMG_1238_thumb.jpg',130, 195,15,'							photo_5496096.html');
												thumbnails[3725700] = new thumbnail(3725700,'212867','Adam & Eve','IMG_2568_thumb.jpg',130, 195,15,'							photo_3725700.html');
												thumbnails[3656398] = new thumbnail(3656398,'212867','Snowdon above Glaslyn','IMG_2455_thumb.jpg',130, 195,15,'							photo_3656398.html');
												thumbnails[3480620] = new thumbnail(3480620,'212867','Cnicht','IMG_1713_thumb.JPG',130, 195,15,'							photo_3480620.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[212867] = new gallery(212867,'7230294,7230287,6870543,5965657,5916904,5916734,5686767,5599044,5589955,5496028,5496017,5496015,5496013,5393891,5340371,5271548,5241873,5025816,4890934,4890130,4889743,4874599,4725925,4390707,4385107,3725894,3725879,3725844,3725811,3656403,3656386,3480645,3480636,3480635,3480633,3480631,3480588','Snowdonia','gallery',[7230287,5916734,5965657,5916904,5496017,7230294,5496015,5340371,5686767,6870296,5241873,5496028,5025816,6870267,5496013,5589955,6870372,6870543,4890934,4874599,5599044,5393891,4889743,3725894,3480636,4890130,3725844,5271548,4385107,4725925,3725879,3725811,3656386,3656403,3480645,4390707,3480635,3480633,3480631,3480588,5923045,4890554,6870480,5030081,3725702,5496096,3725700,3656398,3480620],0, 1, '', '																																																																																																							gallery_212867.html',0,0);
				  					galleries[212882] = new gallery(212882,'5706616,4461613,3814603,3480624','North Wales','gallery',[5706616,3480624,4461613,3814603,3814604,3480626,3480618],0, 1, '', '																																																																																																							gallery_212882.html',0,0);
				  					galleries[221053] = new gallery(221053,'6001751,5414085,4998108,4645261,4310888,3612598,3540307,3483193','Shropshire & the Midlands','gallery',[6001751,4645261,5414085,4998108,3483193,4310888,3612598,3540307,4487693,4521504,4487726],0, 1, '', '																																																																																																							gallery_221053.html',0,0);
				  					galleries[213006] = new gallery(213006,'5041121,4310873,3483203,3483200,3483189','Nature','gallery',[5041121,3483189,3483203,3483200,4310873,4785429],0, 1, '', '																																																																																																							gallery_213006.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7230294,7230287,6870543,6870372,6870296,6870267,6001751,5965657,5916904,5916734,5706616,5686767,5599044,5589955,5496028,5496017,5496015,5496013,5414085,5393891,5340371,5271548,5241873,5041121,5025816,4998108,4890934,4890130,4889743,4874599,4725925,4645261,4461613,4390707,4385107,4310888,4310873,3814603,3725894,3725879,3725844,3725811,3656403,3656386,3612598,3540307,3483200,3483193,3480645,3480636,3480635,3480633,3480631,3480624,3480588';
imageSets[2] = '7230294,7230287,6870543,6001751,5965657,5916904,5916734,5706616,5686767,5599044,5589955,5496028,5496017,5496015,5496013,5414085,5393891,5340371,5271548,5241873,5041121,5025816,4998108,4890934,4890130,4889743,4874599,4725925,4645261,4461613,4390707,4385107,4310888,4310873,3814603,3725894,3725879,3725844,3725811,3656403,3656386,3612598,3540307,3483203,3483200,3483193,3483189,3480645,3480636,3480635,3480633,3480631,3480624,3480588';
imageSets[3] = '5414085,5393891,5340371,5271548,5241873,5041121,5030081,5025816,4998108,4890934,4890554,4890130,4889743,4874599,4785429,4725925,4645261,4521504,4487726,4487693,4461613,4390707,4385107,4310888,4310873,3814604,3814603,3725894,3725879,3725844,3725811,3725702,3725700,3656403,3656398,3656386,3612598,3540307,3483203,3483200,3483193,3483189,3480645,3480636';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://www.clikchurch.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/the57cartwrights/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/the57cartwrights/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 = 'julian cartwright 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>';
	}
					
	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="THE57CARTWRIGHTS">';
		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;
	}
}

		

