window.thumbnails = {};
															thumbnails[7862821] = clik.newPhoto({"id":7862821,"src":"IMG_3784_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_7862821.html","width":130,"caption":"Flight (oil sketch) 330 x 230mm SOLD","height":93});
															thumbnails[7862822] = clik.newPhoto({"id":7862822,"src":"IMG_3786_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_7862822.html","width":130,"caption":"Sea Birds in Flight (oil sketch) 330 x 230mm SOLD","height":86});
															thumbnails[7918987] = clik.newPhoto({"id":7918987,"src":"Sea_Scape_Portmahonmack_III_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_7918987.html","width":130,"caption":"Seascape Portmahomack III oil on linen SOLD","height":114});
															thumbnails[7918974] = clik.newPhoto({"id":7918974,"src":"Seascape_Pormahomack_I_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_7918974.html","width":130,"caption":"Portmahomack I oil on linen SOLD","height":110});
															thumbnails[4589453] = clik.newPhoto({"id":4589453,"src":"Port_Moahomack_for_web_site_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_4589453.html","width":130,"caption":"Oil Sketch Portmahomack Scotland SOLD","height":99});
															thumbnails[4083239] = clik.newPhoto({"id":4083239,"src":"wave_01_09_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_4083239.html","width":130,"caption":"Framed oil sketch (SOLD)","height":89});
															thumbnails[1995353] = clik.newPhoto({"id":1995353,"src":"6 Water IIa_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_1995353.html","width":130,"caption":"'Water II' oil 30 x 34.5 cm SOLD","height":107});
															thumbnails[650664] = clik.newPhoto({"id":650664,"src":"St. Clare's Church Framlingham1.jpeg","galleries_id":49575,"server_id":1,"link":"photo_650664.html","width":97,"caption":"'Open Door' (oil on linen) 30 x 40cm ","height":130});
															thumbnails[650659] = clik.newPhoto({"id":650659,"src":"St. Paul's Church Herne Hill London3.jpeg","galleries_id":49575,"server_id":1,"link":"photo_650659.html","width":97,"caption":"'Resurrection' (oil on wooden panel) 120 x 170cm","height":130});
															thumbnails[1648339] = clik.newPhoto({"id":1648339,"src":"'Abstract Sky over Aldringham' monotype screen on canvas_thumb.jpeg","galleries_id":49575,"server_id":1,"link":"photo_1648339.html","width":130,"caption":"'Abstract Sky over Aldringham' monotype screen on canvas","height":114});
															thumbnails[7929053] = clik.newPhoto({"id":7929053,"src":"Light_and_Motion_oil_sketch_on_board_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_7929053.html","width":130,"caption":"Light and Motion (oil sketch on board) SOLD","height":91});
															thumbnails[7956431] = clik.newPhoto({"id":7956431,"src":"light_and_motion_1_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_7956431.html","width":130,"caption":"Light and Motion (oil on linen) 56 x 44cm","height":102});
															thumbnails[7918956] = clik.newPhoto({"id":7918956,"src":"1._sea_birds_study_in_flight_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_7918956.html","width":108,"caption":"Sea birds study in flight","height":130});
															thumbnails[7862583] = clik.newPhoto({"id":7862583,"src":"Aldeburgh_Beach_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_7862583.html","width":130,"caption":"Aldeburgh Beach (oil on linen) 1.2 x 1.0m","height":104});
															thumbnails[7267889] = clik.newPhoto({"id":7267889,"src":"IMG_3477_thumb.JPG","galleries_id":49575,"server_id":1,"link":"photo_7267889.html","width":130,"caption":"Aldeburgh Beach (oil)","height":127});
															thumbnails[7153297] = clik.newPhoto({"id":7153297,"src":"3._Aldringham_Sky_IV_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_7153297.html","width":130,"caption":"1.\t The Sky over Aldringham (oil on canvas 50 x 50 cm)","height":130});
															thumbnails[7153393] = clik.newPhoto({"id":7153393,"src":"IMG_3471_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_7153393.html","width":130,"caption":"2.\t Seascape (oil on linen 50 x 50cm)","height":127});
															thumbnails[4980919] = clik.newPhoto({"id":4980919,"src":"Leigh_on_sea_web1_thumb.jpeg","galleries_id":49575,"server_id":1,"link":"photo_4980919.html","width":130,"caption":"'Leigh on Sea' framed oil painting 42 x 30 cm","height":100});
															thumbnails[3509998] = clik.newPhoto({"id":3509998,"src":"Thorpeness_Seascape_thumb.jpg","galleries_id":28153,"server_id":1,"link":"photo_3509998.html","width":130,"caption":"Thorpeness before a storm (SOLD)","height":88});
															thumbnails[2779969] = clik.newPhoto({"id":2779969,"src":"IMG_1897iii_thumb.JPG","galleries_id":49575,"server_id":1,"link":"photo_2779969.html","width":130,"caption":"'From Thornhill' (oil) 0.7 x 1.2m","height":82});
															thumbnails[1996416] = clik.newPhoto({"id":1996416,"src":"13 air I_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_1996416.html","width":127,"caption":"air I (watercolour) 34 x 34 cm (SOLD)","height":130});
															thumbnails[7862601] = clik.newPhoto({"id":7862601,"src":"IMG_3752_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_7862601.html","width":99,"caption":"Wheat Field (oil on canvas) 440 x 340mm","height":130});
															thumbnails[7313614] = clik.newPhoto({"id":7313614,"src":"4._Aldringham_Sunrise_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_7313614.html","width":130,"caption":"Aldringham Sunrise 2011 (oil on linen) 300x250mm SOLD","height":108});
															thumbnails[1003181] = clik.newPhoto({"id":1003181,"src":"After the Harvest1.jpeg","galleries_id":49575,"server_id":1,"link":"photo_1003181.html","width":99,"caption":"'After the Harvest' 120 x 173 cm (oil on gesso secco)","height":130});
															thumbnails[7862608] = clik.newPhoto({"id":7862608,"src":"IMG_3756_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_7862608.html","width":130,"caption":"Sea Bird in Flight (monotype) SOLD","height":94});
															thumbnails[1995365] = clik.newPhoto({"id":1995365,"src":"7 Water IIIa_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_1995365.html","width":109,"caption":"'Water III' oil 29.5 x 25.0 cm (SOLD)","height":130});
															thumbnails[654856] = clik.newPhoto({"id":654856,"src":"The Sky over Aldringham (water-colour)1.jpeg","galleries_id":49575,"server_id":1,"link":"photo_654856.html","width":130,"caption":"The Sky over Aldringham (water-colour) 200 x 300mm painted for Roz Davies artist","height":93});
															thumbnails[8610628] = clik.newPhoto({"id":8610628,"src":"portmahomack_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_8610628.html","width":130,"caption":"Portmahomack (oil on canvas) 35 x 30 cm SOLD","height":111});
															thumbnails[4083226] = clik.newPhoto({"id":4083226,"src":"Aldeburgh_framed_oil_painting_540B4068-1EC9-DFB6-09575A29D32B2527_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_4083226.html","width":130,"caption":"Martello Tower Aldeburgh","height":107});
															thumbnails[4083244] = clik.newPhoto({"id":4083244,"src":"Aldringham_sky_late_sunlight_framed_oil_painting_thumb.JPG","galleries_id":28153,"server_id":1,"link":"photo_4083244.html","width":109,"caption":"Aldringham late sunlight SOLD","height":130});
															thumbnails[8648891] = clik.newPhoto({"id":8648891,"src":"Harbour_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_8648891.html","width":130,"caption":"Harbour (monotype) ","height":105});
															thumbnails[7862613] = clik.newPhoto({"id":7862613,"src":"Door_thumb.jpeg","galleries_id":28153,"server_id":1,"link":"photo_7862613.html","width":101,"caption":"Door (oil on canvas) 390 x 490mm (SOLD)","height":130});
															thumbnails[3536240] = clik.newPhoto({"id":3536240,"src":"Monotype_Cross_Currents_thumb.jpg","galleries_id":28153,"server_id":1,"link":"photo_3536240.html","width":86,"caption":"Monotype Cross Currents (SOLD)","height":130});
															thumbnails[412328] = clik.newPhoto({"id":412328,"src":"Nacton CV0805 1 002.jpg","galleries_id":33770,"server_id":1,"link":"photo_412328.html","width":130,"caption":"Artist in Residence for Nacton Primary School in Suffolk (photograph Lucy Taylor courtesy of the The Evening Star)","height":80});
															thumbnails[412327] = clik.newPhoto({"id":412327,"src":"Dennington 4_edited.jpg","galleries_id":33770,"server_id":1,"link":"photo_412327.html","width":128,"caption":"Interactive Panel System for Dennington Primary School in Suffolk","height":130});
															thumbnails[421667] = clik.newPhoto({"id":421667,"src":"Dennington Crop 11.jpg","galleries_id":33770,"server_id":1,"link":"photo_421667.html","width":130,"caption":"Interactive Mural","height":114});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[28153] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Paintings","link":"gallery_28153.html","maxRecords":0.0,"photoIDs":[7862821.0,7862822.0,7918987.0,7918974.0,4589453.0,4083239.0,1995353.0,7929053.0,7956431.0,7918956.0,7862583.0,7153297.0,7153393.0,3509998.0,1996416.0,7862601.0,7313614.0,7862608.0,1995365.0,8610628.0,4083226.0,4083244.0,8648891.0,7862613.0,3536240.0],"skipIndex":0,"section_code":"gallery","featured_images":"8648891,8610628,7956431,7929053,7918987,7918974,7918956,7862822,7862821,7862613","id":28153,"singleSection":false});				  						galleries[49575] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Commissions","link":"gallery_49575.html","maxRecords":0.0,"photoIDs":[650664.0,650659.0,1648339.0,7267889.0,4980919.0,2779969.0,1003181.0,654856.0],"skipIndex":0,"section_code":"gallery","featured_images":"2779969,654856,650659","id":49575,"singleSection":false});				  						galleries[33770] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Artist in Residence","link":"gallery_33770.html","maxRecords":0.0,"photoIDs":[412328.0,412327.0,421667.0],"skipIndex":0,"section_code":"gallery","featured_images":421667.0,"id":33770,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '1995353,3509998,2779969,1003181,1995365,4083244';
imageSets[2] = '650659,2779969,654856,421667';
imageSets[3] = '8648891,8610628,7956431,7929053,7918987,7918974,7918956,7862822,7862821,7862613,7862608,7862601,7862583,7313614,7267889,7153393,7153297,4980919,4589453,4083244,4083239,4083226,3536240,3509998,2779969,1996416,1995365,1995353,1648339,1003181,654856,650664,650659,421667,412328,412327';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/macart/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/macart/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/macart/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/macart/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/macart/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/macart/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/macart/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/macart/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 || photos || {})[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:'',$detailContainer:'',
                    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 (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
	}
		
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'christopher mcelhatton suffolk landscape artist: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      	temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
			if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
				toggleAddToCartConfirm(backgrounds, op.$detail);
			} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
				toggleAddToCartConfirm(photos, op.$detail);
			}
			$('body').trigger('clikUpdate.popup');
	    });
    }
        $(op.$detailContainer).find('.replaceable[class*=replaceable_photo-]').each(function(){
    	var field = clik.getPrefixedClass(this.className, 'replaceable_photo-');
    	if (field in op.nextPhoto) {
    		$(this).fadeGalleryDetails(op.nextPhoto[field], op.speed);
    	}
    }).end().find('.replaceable.photoPayment').fadeGalleryDetails(op.nextPhoto.fnGetPaymentInfo(), op.speed, function(){
		if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
			toggleAddToCartConfirm(backgrounds, op.$detailContainer);
		} else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
			toggleAddToCartConfirm(photos, op.$detailContainer);
		}
		$('body').trigger('clikUpdate.popup');
	});
		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.speed) {
      	clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));
    }
        
    return html;
	}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array, root){
	if (typeof(array) !== 'object' || array === null) {
	  	array = photos;
	}
	if (!$(root).length) {		root = $('body');	}	if($('#paymentConfirm', root).length > 0){
		$('#paymentConfirm', root).hide();
		$('#paymentAddButton', root)
		.unbind()
		.click(function(){
						form = $('#paymentForm', root)[0];
			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', root).text('Item added to cart').show();}
				else{
					$('#paymentConfirm', root).text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm', root).text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp +=  '<div id="imageDescription">' + this.description + '</div>';
	}
		if (this.photo_ref != '') {
		temp += '<div class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</div>';
	}
				
	temp += this.fnGetPaymentInfo();
				if (temp != '') {
		temp += '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
clik.photo.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
																		temp += '<p>Buy now using PayPal:</p>';
				temp += '<div class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else if (this.payment_groups_id !== '') {
		temp += '<p>Buy this print online:</p>';
				temp += '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp += '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
		
		temp += getPaymentOptions(this.payment_groups_id);
		temp += '</select>';
		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 += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			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 += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="c.mcelhatton@hotmail.co.uk">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="c.mcelhatton@hotmail.co.uk">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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({					title: galleries[gallery_id].title				}).filter(function(){return this.href;}).attr({					href: thumbnails[imageID].fnGalleryLink(gallery_id)				});
			}
		}
	}
}

/***************************************************************************
* 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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

