window.thumbnails = new Object();
												thumbnails[4029860] = new thumbnail(4029860,'243054','','playme-1_thumb.jpg',130, 87,15,'photo_4029860.html');
												thumbnails[4034647] = new thumbnail(4034647,'244925','','DSC_10911_thumb.jpg',130, 87,15,'photo_4034647.html');
												thumbnails[4034661] = new thumbnail(4034661,'244925','','DSC_1112_thumb.jpg',130, 87,15,'photo_4034661.html');
												thumbnails[4034676] = new thumbnail(4034676,'244925','','DSC_1131_thumb.jpg',130, 87,15,'photo_4034676.html');
												thumbnails[4034684] = new thumbnail(4034684,'244925','','DSC_1142_thumb.jpg',130, 87,15,'photo_4034684.html');
												thumbnails[4034752] = new thumbnail(4034752,'244925','','DSC_1174_thumb.jpg',130, 87,15,'photo_4034752.html');
												thumbnails[4034762] = new thumbnail(4034762,'244925','','DSC_1042_thumb.jpg',130, 87,15,'photo_4034762.html');
												thumbnails[4075712] = new thumbnail(4075712,'243054','','playme2_thumb.jpg',130, 87,15,'photo_4075712.html');
												thumbnails[4075713] = new thumbnail(4075713,'243054','','playme-3_thumb.jpg',130, 87,15,'photo_4075713.html');
												thumbnails[4076604] = new thumbnail(4076604,'245082','','pv0_thumb.jpg',130, 87,15,'photo_4076604.html');
												thumbnails[4076605] = new thumbnail(4076605,'245082','','pv5_thumb.jpg',130, 87,15,'photo_4076605.html');
												thumbnails[4076606] = new thumbnail(4076606,'245082','','pv7_thumb.jpg',130, 87,15,'photo_4076606.html');
												thumbnails[4076607] = new thumbnail(4076607,'245082','','pv1_thumb.jpg',130, 194,15,'photo_4076607.html');
												thumbnails[4076608] = new thumbnail(4076608,'245082','','pv2_thumb.jpg',130, 194,15,'photo_4076608.html');
												thumbnails[4076609] = new thumbnail(4076609,'245082','','pv3_thumb.jpg',130, 194,15,'photo_4076609.html');
												thumbnails[4076610] = new thumbnail(4076610,'245082','','pv56_thumb.jpg',130, 87,15,'photo_4076610.html');
												thumbnails[4076611] = new thumbnail(4076611,'245082','','pv9_thumb.jpg',130, 87,15,'photo_4076611.html');
												thumbnails[4076612] = new thumbnail(4076612,'245082','','pv8_thumb.jpg',130, 87,15,'photo_4076612.html');
												thumbnails[5805636] = new thumbnail(5805636,'328745','','ophelia_thumb.jpg',130, 86,15,'photo_5805636.html');
												thumbnails[5805765] = new thumbnail(5805765,'328745','','ophelai_amsterdam_exhbition_thumb.jpg',130, 98,15,'photo_5805765.html');
												thumbnails[4034655] = new thumbnail(4034655,'244925','','DSC_1109_thumb.jpg',130, 194,15,'photo_4034655.html');
												thumbnails[4075651] = new thumbnail(4075651,'245048','','TORist-trao-7_thumb.jpg',130, 194,15,'photo_4075651.html');
												thumbnails[4075789] = new thumbnail(4075789,'242423','','dont-taste-4_thumb.jpg',130, 87,15,'photo_4075789.html');
												thumbnails[4014063] = new thumbnail(4014063,'242423','','dontasthediff3_thumb.jpg',130, 87,15,'photo_4014063.html');
												thumbnails[4034748] = new thumbnail(4034748,'244925','','DSC_1167_thumb.jpg',130, 194,15,'photo_4034748.html');
												thumbnails[4075656] = new thumbnail(4075656,'245048','','torist-trap-2_thumb.jpg',130, 194,15,'photo_4075656.html');
												thumbnails[4034744] = new thumbnail(4034744,'244925','','DSC_1146_thumb.jpg',130, 194,15,'photo_4034744.html');
												thumbnails[4075658] = new thumbnail(4075658,'245048','','torist-trap-8-_thumb.jpg',130, 194,15,'photo_4075658.html');
												thumbnails[4075795] = new thumbnail(4075795,'242423','','dont-taste-5_thumb.jpg',130, 87,15,'photo_4075795.html');
												thumbnails[4014066] = new thumbnail(4014066,'242423','','domt21_thumb.jpg',130, 174,15,'photo_4014066.html');
												thumbnails[4075661] = new thumbnail(4075661,'245048','','torist-trap-1_thumb.jpg',130, 87,15,'photo_4075661.html');
												thumbnails[4075714] = new thumbnail(4075714,'243054','','playme-4_thumb.jpg',130, 194,15,'photo_4075714.html');
												thumbnails[4014251] = new thumbnail(4014251,'242423','','might-me-meat_thumb.jpg',130, 194,15,'photo_4014251.html');
												thumbnails[4075663] = new thumbnail(4075663,'245048','','torist-trap-3_thumb.jpg',130, 87,15,'photo_4075663.html');
												thumbnails[4075715] = new thumbnail(4075715,'243054','','playme-5_thumb.jpg',130, 194,15,'photo_4075715.html');
												thumbnails[4075665] = new thumbnail(4075665,'245048','','torist-trap-4_thumb.jpg',130, 87,15,'photo_4075665.html');
												thumbnails[4075716] = new thumbnail(4075716,'243054','','playme-6_thumb.jpg',130, 194,15,'photo_4075716.html');
												thumbnails[4075802] = new thumbnail(4075802,'242423','','donttaste6_thumb.jpg',130, 194,15,'photo_4075802.html');
												thumbnails[4075667] = new thumbnail(4075667,'245048','','torist-trap-51_thumb.jpg',130, 87,15,'photo_4075667.html');
												thumbnails[4075717] = new thumbnail(4075717,'243054','','playme-7_thumb.jpg',130, 104,15,'photo_4075717.html');
												thumbnails[4075806] = new thumbnail(4075806,'242423','','dont-taste-7_thumb.jpg',130, 87,15,'photo_4075806.html');
												thumbnails[4075669] = new thumbnail(4075669,'245048','','torist-traP-6_thumb.jpg',130, 87,15,'photo_4075669.html');
												thumbnails[4075719] = new thumbnail(4075719,'243054','','playme-8_thumb.jpg',130, 101,15,'photo_4075719.html');
												thumbnails[4075807] = new thumbnail(4075807,'242423','','dont-taste-8_thumb.jpg',130, 87,15,'photo_4075807.html');
												thumbnails[4075671] = new thumbnail(4075671,'245048','','torist-trap-8_thumb.jpg',130, 87,15,'photo_4075671.html');
												thumbnails[4075720] = new thumbnail(4075720,'243054','','playme-9_thumb.jpg',130, 87,15,'photo_4075720.html');
												thumbnails[4075825] = new thumbnail(4075825,'242423','','donttaste-9_thumb.jpg',130, 87,15,'photo_4075825.html');
												thumbnails[4014219] = new thumbnail(4014219,'242422','','business_man2123_thumb.jpg',130, 96,15,'photo_4014219.html');
												thumbnails[4014229] = new thumbnail(4014229,'242422','','desolate_window_1_thumb.jpg',130, 72,15,'photo_4014229.html');
												thumbnails[4029833] = new thumbnail(4029833,'242422','','entropia-screenshot2_thumb.jpg',130, 97,15,'photo_4029833.html');
												thumbnails[4033179] = new thumbnail(4033179,'242422','','shopping-centre1_thumb.jpg',130, 68,15,'photo_4033179.html');
												thumbnails[4033189] = new thumbnail(4033189,'242422','','epic-building11_thumb.jpg',130, 96,15,'photo_4033189.html');
												thumbnails[4033190] = new thumbnail(4033190,'242422','','scary-man-in-shadows-1_thumb.jpg',130, 96,15,'photo_4033190.html');
												thumbnails[4033191] = new thumbnail(4033191,'242422','','motorcylce-drive-of-1_thumb.jpg',130, 95,15,'photo_4033191.html');
												thumbnails[4033249] = new thumbnail(4033249,'242422','','shiny-scraper1_thumb.jpg',130, 72,15,'photo_4033249.html');
												thumbnails[4033369] = new thumbnail(4033369,'242422','','lights21_thumb.jpg',130, 94,15,'photo_4033369.html');
												thumbnails[7449561] = new thumbnail(7449561,'403820','','internet1-hoofs_thumb.jpg',130, 194,15,'photo_7449561.html');
												thumbnails[7449594] = new thumbnail(7449594,'403820','','internet-one-in-the-souk_thumb.jpg',130, 194,15,'photo_7449594.html');
												thumbnails[7449709] = new thumbnail(7449709,'403820','','internet3_thumb.jpg',130, 194,15,'photo_7449709.html');
												thumbnails[7449711] = new thumbnail(7449711,'403820','','internet5_thumb.jpg',130, 194,15,'photo_7449711.html');
												thumbnails[7449712] = new thumbnail(7449712,'403820','','internt6_thumb.jpg',130, 194,15,'photo_7449712.html');
												thumbnails[7449721] = new thumbnail(7449721,'403820','','internet2_thumb.jpg',130, 194,15,'photo_7449721.html');
												thumbnails[7449741] = new thumbnail(7449741,'403820','','internet-11_thumb.jpg',130, 194,15,'photo_7449741.html');
												thumbnails[7449743] = new thumbnail(7449743,'403820','','internet8_thumb.jpg',130, 194,15,'photo_7449743.html');
												thumbnails[7449747] = new thumbnail(7449747,'403820','','internt23_thumb.jpg',130, 194,15,'photo_7449747.html');
												thumbnails[7449749] = new thumbnail(7449749,'403820','','internet10_thumb.jpg',130, 87,15,'photo_7449749.html');
												thumbnails[7449752] = new thumbnail(7449752,'403820','','internet13_thumb.jpg',130, 87,15,'photo_7449752.html');
												thumbnails[7449758] = new thumbnail(7449758,'403820','','internet24_thumb.jpg',130, 87,15,'photo_7449758.html');
												thumbnails[4075928] = new thumbnail(4075928,'245062','','ophila1_thumb.jpg',130, 194,15,'photo_4075928.html');
												thumbnails[4075932] = new thumbnail(4075932,'245062','','ophilla3_thumb.jpg',130, 194,15,'photo_4075932.html');
												thumbnails[4075940] = new thumbnail(4075940,'245062','','ophila7_thumb.jpg',130, 87,15,'photo_4075940.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[328745] = new gallery(328745,'5805765,5805636','Amsterdam exhbibition \'This is for you ophelia\'','gallery',[5805636,5805765],0, 0, '243055', 'gallery_328745.html',0,0);
				  					galleries[348868] = new gallery(348868,'4076612,4076611,4076610,4076609,4076608,4076607,4076606,4076605,4076604,4075825','Collaborations','gallery',[],0, 0, '', 'gallery_348868.html',0,0);
				  					galleries[242423] = new gallery(242423,'4075825,4075807,4075806,4075802,4075795,4075789,4014251,4014066,4014063','Don\'t Taste The Difference','gallery',[4075789,4014063,4075795,4014066,4014251,4075802,4075806,4075807,4075825],0, 0, '348868', 'gallery_242423.html',0,0);
				  					galleries[244925] = new gallery(244925,'4034762,4034752,4034748,4034744,4034684,4034676,4034661,4034655,4034647','ENTROPIA','gallery',[4034647,4034661,4034676,4034684,4034752,4034762,4034655,4034748,4034744],0, 0, '348868', 'gallery_244925.html',0,0);
				  					galleries[245062] = new gallery(245062,'4075940,4075932,4075928','OPHELIA','section482567',[4075928,4075932,4075940],0, 0, '242374', 'section482567_245062.html',0,0);
				  					galleries[243054] = new gallery(243054,'4075720,4075719,4075717,4075716,4075715,4075714,4075713,4075712,4029860','Play Me','gallery',[4029860,4075712,4075713,4075714,4075715,4075716,4075717,4075719,4075720],0, 0, '242373', 'gallery_243054.html',0,0);
				  					galleries[245048] = new gallery(245048,'4075671,4075669,4075667,4075665,4075663,4075661,4075658,4075656,4075651','Tourist Trap','gallery',[4075651,4075656,4075658,4075661,4075663,4075665,4075667,4075669,4075671],0, 0, '348868', 'gallery_245048.html',0,0);
				  					galleries[245082] = new gallery(245082,'4076612,4076611,4076610,4076609,4076608,4076607,4076606,4076605,4076604','Viewing Point','gallery',[4076604,4076605,4076606,4076607,4076608,4076609,4076610,4076611,4076612],0, 0, '348868', 'gallery_245082.html',0,0);
				  					galleries[242374] = new gallery(242374,'4075940,4075932,4075928,4033369,4033249,4033191,4033190,4033189,4033179,4029833','Photography','section482567',[],0, 0, '', 'section482567_242374.html',0,0);
				  					galleries[242373] = new gallery(242373,'4075720,4075719,4075717,4075716,4075715,4075714,4075713,4075712,4029860','Activism','gallery',[],0, 0, '', 'gallery_242373.html',0,0);
				  					galleries[403820] = new gallery(403820,'7449758,7449752,7449749,7449747,7449743,7449741,7449721,7449712,7449711,7449709','Morrocco 2011','section482567',[7449561,7449594,7449709,7449711,7449712,7449721,7449741,7449743,7449747,7449749,7449752,7449758],0, 0, '', 'section482567_403820.html',0,0);
				  					galleries[243055] = new gallery(243055,'5805765,5805636','Exhibitions','gallery',[],0, 0, '', 'gallery_243055.html',0,0);
				  					galleries[242422] = new gallery(242422,'4033369,4033249,4033191,4033190,4033189,4033179,4029833,4014229,4014219','ENTROPIA','section482567',[4014219,4014229,4029833,4033179,4033189,4033190,4033191,4033249,4033369],0, 0, '242374', 'section482567_242422.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '7449758,7449752,7449749,7449747,7449743,7449741,7449721,7449712,7449711,7449709,7449594,7449561,5805765,5805636,4076612,4076611,4076610,4076609,4076608,4076607,4076606,4076605,4076604,4075940,4075932,4075928,4075825,4075807,4075806,4075802,4075795,4075789,4075720,4075719,4075717,4075716,4075715,4075714,4075713,4075712,4075671,4075669,4075667,4075665,4075663,4075661,4075658,4075656,4075651,4034762';
imageSets[3] = '7449758,7449752,7449749,7449747,7449743,7449741,7449721,7449712,7449711,7449709,7449594,7449561,5805765,5805636,4076612,4076611,4076610,4076609,4076608,4076607,4076606,4076605,4076604,4075940,4075932,4075928,4075825,4075807,4075806,4075802,4075795,4075789,4075720,4075719,4075717,4075716,4075715,4075714,4075713,4075712,4075671,4075669,4075667,4075665,4075663,4075661,4075658,4075656,4075651,4034762';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/hummingbird78/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/hummingbird78/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));		  $('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 = 'Charlotte Miller: ' + 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));      $('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 = 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> &pound;' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = temp + '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
				
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
																				temp = temp + '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="item_name" value="'+item_name+'">';
								ref = '';
				if(this.photo_ref != ''){
					ref = this.photo_ref+' - '+this.caption;
				}
				else{
					ref = this.id+' - '+this.caption;
				}
				price = amount;					temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="">';
	temp = temp + '<input type="hidden" name="currency_code" value="GBP">';
	temp = temp + '<input type="hidden" name="add" value="1">';
					temp = temp + '<input type="hidden" name="amount" value="'+amount+'">';
	temp = temp + '<input type="hidden" name="item_number" value="'+ref+'">';
					temp = temp + '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
									temp = temp + '</form>';
								temp = temp + '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	temp = temp + '<input type="hidden" name="cmd" value="_cart">';
	temp = temp + '<input type="hidden" name="business" value="">';
	temp = temp + '<input type="hidden" name="display" value="1">';
	temp = temp + '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
	temp = temp + '</form>';
							temp = temp + '<div class="clearing">&nbsp;</div>';
	}
	return temp;};

/***************************************************************************
* Pick a photo at random from the featured images of a gallery.            *
* Gallery_id = id of gallery to choose,                                    *
* img = reference to html image in                                         *
* which to show image                                                      *
***************************************************************************/
function showGalleryImage(gallery_id, img, updateLink) {
		
	if(img){
	      if (location.hash.match('galleries_id=' + gallery_id) && (imageID = location.hash.match('.*photos_id=(.+)$'))) {
        imageID = imageID[1];
      } else {
			  imageID = randomListVal(galleries[gallery_id].featured_images);
      }
							
			if (imageID != 0) {
				img.src = thumbnails[imageID].src;
				img.width = thumbnails[imageID].width;
				img.height = thumbnails[imageID].height;
				img.alt = galleries[gallery_id].title;
        if (updateLink) {
          $(img).parent().attr({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* If we have dynamic HTML, replace the galleries link with a list that     *
* doesn't include thecurrent gallery                                       *
***************************************************************************/
function showGalleries(gallery_id) {
		
	
	if (!basic) {
		temp = '';
		for (i = 0; i < galleries.length; i++) {
						
			
			if (galleries[i].id != gallery_id) {
								
				if (temp != '') {
					temp = temp + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

