window.thumbnails = {};
															thumbnails[7481053] = clik.newPhoto({"id":7481053,"src":"wcp-SunSet_thumb.jpg","galleries_id":97275,"server_id":1,"link":"photo_7481053.html","width":130,"caption":"","height":86});
															thumbnails[7481055] = clik.newPhoto({"id":7481055,"src":"wcp-HEN-1_thumb.jpg","galleries_id":97275,"server_id":1,"link":"photo_7481055.html","width":86,"caption":"","height":130});
															thumbnails[4604365] = clik.newPhoto({"id":4604365,"src":"W-CoffeeFroth_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_4604365.html","width":86,"caption":"Coffee Froth (Ltd Ed of 10. 2 sold)","height":130});
															thumbnails[7083185] = clik.newPhoto({"id":7083185,"src":"W_BirchesInTheSnow_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_7083185.html","width":130,"caption":"Birches in the Snow","height":86});
															thumbnails[7083188] = clik.newPhoto({"id":7083188,"src":"W600_FoD_Into_Another_Future_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_7083188.html","width":130,"caption":"FoD - Into a Another Future","height":86});
															thumbnails[7083189] = clik.newPhoto({"id":7083189,"src":"W600-Aug-sixth_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_7083189.html","width":86,"caption":"August 6th","height":130});
															thumbnails[7083192] = clik.newPhoto({"id":7083192,"src":"W600-Into_a_Quieter_Future_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_7083192.html","width":130,"caption":"FoD-Into a Quieter Future","height":86});
															thumbnails[7083193] = clik.newPhoto({"id":7083193,"src":"W600-lavender-005_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_7083193.html","width":130,"caption":"Lavender 005","height":106});
															thumbnails[7481198] = clik.newPhoto({"id":7481198,"src":"wcp_FoD-ITF_The_Light_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_7481198.html","width":130,"caption":"FoD-ITF_The Light_Limited Ed2011","height":86});
															thumbnails[7481204] = clik.newPhoto({"id":7481204,"src":"wcp_FoD-ForestEyes_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_7481204.html","width":86,"caption":"FoD_ITF_Forest_Eyes_limited Edition 2011","height":130});
															thumbnails[8254857] = clik.newPhoto({"id":8254857,"src":"Wcp_Glads_thumb.jpg","galleries_id":439714,"server_id":19,"link":"photo_8254857.html","width":130,"caption":"","height":86});
															thumbnails[1399297] = clik.newPhoto({"id":1399297,"src":"W_Flurry_of_Foxgloves_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_1399297.html","width":130,"caption":"W Flurry of Foxgloves","height":87});
															thumbnails[1399298] = clik.newPhoto({"id":1399298,"src":"W_FoD_Into_the_Future_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_1399298.html","width":86,"caption":"W FoD Into the Future.  Sold Out.","height":130});
															thumbnails[1399301] = clik.newPhoto({"id":1399301,"src":"W_Leaves-imprinted-on-an-Az_thumb.jpg","galleries_id":304127,"server_id":1,"link":"photo_1399301.html","width":130,"caption":"W Leaves-imprinted-on-an-Azure Screen. 6 of 10 sold","height":87});
															thumbnails[8254861] = clik.newPhoto({"id":8254861,"src":"Wcp_IntoTheFutureSpace_thumb.jpg","galleries_id":439714,"server_id":19,"link":"photo_8254861.html","width":86,"caption":"","height":130});
															thumbnails[8254867] = clik.newPhoto({"id":8254867,"src":"Wcp_TwistingHelix_thumb.jpg","galleries_id":439714,"server_id":19,"link":"photo_8254867.html","width":86,"caption":"","height":130});
															thumbnails[8254876] = clik.newPhoto({"id":8254876,"src":"Wcp_GreatNews_thumb.jpg","galleries_id":439714,"server_id":19,"link":"photo_8254876.html","width":130,"caption":"","height":86});
															thumbnails[4604362] = clik.newPhoto({"id":4604362,"src":"W_adstractDartBoats-2_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_4604362.html","width":130,"caption":"Abstract Dart Boats 2 (open Edition)","height":95});
															thumbnails[4604363] = clik.newPhoto({"id":4604363,"src":"W_AdstractDartBoats2008_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_4604363.html","width":130,"caption":"Abstract Dart Boats (Open Edition)","height":95});
															thumbnails[4604364] = clik.newPhoto({"id":4604364,"src":"W_Quiet-moment-on-the-Dart_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_4604364.html","width":86,"caption":"Quiet Moment on the Dart (Open Edition)","height":130});
															thumbnails[5769637] = clik.newPhoto({"id":5769637,"src":"Wc-PinkBird3_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_5769637.html","width":92,"caption":"","height":130});
															thumbnails[5769640] = clik.newPhoto({"id":5769640,"src":"Wc-PinkBirds1_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_5769640.html","width":87,"caption":"","height":130});
															thumbnails[5769644] = clik.newPhoto({"id":5769644,"src":"Wc-PinkBirds2_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_5769644.html","width":85,"caption":"","height":130});
															thumbnails[5769647] = clik.newPhoto({"id":5769647,"src":"Wc-PinkBirds4_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_5769647.html","width":130,"caption":"","height":130});
															thumbnails[5769651] = clik.newPhoto({"id":5769651,"src":"Wc-PinkBirds5_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_5769651.html","width":130,"caption":"","height":91});
															thumbnails[7083194] = clik.newPhoto({"id":7083194,"src":"W600_ip-cockeral_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_7083194.html","width":130,"caption":"iP-cockeral","height":98});
															thumbnails[151227] = clik.newPhoto({"id":151227,"src":"TracedWhiteHelebore-11768_thumb.jpg","galleries_id":31252,"server_id":1,"link":"photo_151227.html","width":130,"caption":"Traced White Hellebore","height":86});
															thumbnails[353466] = clik.newPhoto({"id":353466,"src":"Shootin'TheRapids_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_353466.html","width":130,"caption":"Shootin'TheRapids","height":98});
															thumbnails[86501] = clik.newPhoto({"id":86501,"src":"Blue_Waterlillies_thumb.jpg","galleries_id":31252,"server_id":1,"link":"photo_86501.html","width":130,"caption":"Waterlillies","height":196});
															thumbnails[86596] = clik.newPhoto({"id":86596,"src":"blue_rowing_boat_IoS_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_86596.html","width":130,"caption":"Blue Rowing Boat","height":196});
															thumbnails[350177] = clik.newPhoto({"id":350177,"src":"Severn-Strolling-4241_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_350177.html","width":130,"caption":"Severn-Strolling-4241","height":85});
															thumbnails[86639] = clik.newPhoto({"id":86639,"src":"A_Clearing_Mist_2_Cannop_thumb.jpg","galleries_id":7759,"server_id":1,"link":"photo_86639.html","width":130,"caption":"A Clearing Mist at Cannop Ponds","height":173});
															thumbnails[350176] = clik.newPhoto({"id":350176,"src":"Severn-Strolling-4240_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_350176.html","width":130,"caption":"Severn-Strolling-4240","height":85});
															thumbnails[86620] = clik.newPhoto({"id":86620,"src":"field_of_daisies_1_thumb.jpg","galleries_id":31252,"server_id":1,"link":"photo_86620.html","width":130,"caption":"Field of Daisies","height":195});
															thumbnails[86600] = clik.newPhoto({"id":86600,"src":"peat_smoke_0908_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_86600.html","width":130,"caption":"Peat Smoke","height":195});
															thumbnails[86617] = clik.newPhoto({"id":86617,"src":"Bluebells_an_impression_thumb.jpg","galleries_id":31252,"server_id":1,"link":"photo_86617.html","width":130,"caption":"Blubells Impression","height":86});
															thumbnails[86641] = clik.newPhoto({"id":86641,"src":"Blazing_Treetops_7735_1_thumb.jpg","galleries_id":7759,"server_id":1,"link":"photo_86641.html","width":130,"caption":"Blazing Treetops","height":195});
															thumbnails[1399296] = clik.newPhoto({"id":1399296,"src":"W_Floating-around_thumb.jpg","galleries_id":31252,"server_id":1,"link":"photo_1399296.html","width":130,"caption":"W Floating-around","height":87});
															thumbnails[86647] = clik.newPhoto({"id":86647,"src":"little_brigde_0509_thumb.jpg","galleries_id":7759,"server_id":1,"link":"photo_86647.html","width":130,"caption":"Little Bridge","height":196});
															thumbnails[244579] = clik.newPhoto({"id":244579,"src":"A_D200_0976_lit_thumb.jpg","galleries_id":31252,"server_id":1,"link":"photo_244579.html","width":87,"caption":"A D200 0976 lit","height":130});
															thumbnails[86644] = clik.newPhoto({"id":86644,"src":"First_Light_-_Cannop_Ponds_1118_thumb.jpg","galleries_id":7759,"server_id":1,"link":"photo_86644.html","width":130,"caption":"First Light at Cannop Ponds","height":86});
															thumbnails[354200] = clik.newPhoto({"id":354200,"src":"Summer-scent_thumb.jpg","galleries_id":31252,"server_id":1,"link":"photo_354200.html","width":87,"caption":"Summer-scent","height":130});
															thumbnails[1399302] = clik.newPhoto({"id":1399302,"src":"W_Living_Sunshine_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_1399302.html","width":87,"caption":"W Living Sunshine","height":130});
															thumbnails[1399303] = clik.newPhoto({"id":1399303,"src":"W_Path-to-the-Sun_thumb.jpg","galleries_id":405547,"server_id":1,"link":"photo_1399303.html","width":87,"caption":"W Path-to-the-Sun","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[439714] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Cork Street","link":"section144493_439714.html","maxRecords":0.0,"photoIDs":[8254857.0,8254861.0,8254867.0,8254876.0],"skipIndex":0,"section_code":"section144493","featured_images":8254857.0,"id":439714,"singleSection":false});				  						galleries[304127] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ltd Ed Works","link":"section144493_304127.html","maxRecords":0.0,"photoIDs":[4604365.0,7083185.0,7083188.0,7083189.0,7083192.0,7083193.0,7481198.0,7481204.0,1399297.0,1399298.0,1399301.0],"skipIndex":0,"section_code":"section144493","featured_images":"7481204,7481198,7083193,7083192,7083189,7083188,7083185,4604365,1399301,1399298","id":304127,"singleSection":false});				  						galleries[97275] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"NEW WORKS","link":"section144493_97275.html","maxRecords":0.0,"photoIDs":[7481053.0,7481055.0],"skipIndex":0,"section_code":"section144493","featured_images":"7481055,7481053","id":97275,"singleSection":false});				  						galleries[405547] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Others","link":"gallery_405547.html","maxRecords":0.0,"photoIDs":[4604362.0,4604363.0,4604364.0,5769637.0,5769640.0,5769644.0,5769647.0,5769651.0,7083194.0,353466.0,86596.0,350177.0,350176.0,86600.0,1399302.0,1399303.0],"skipIndex":0,"section_code":"gallery","featured_images":"86600,86596","id":405547,"singleSection":false});				  						galleries[7759] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Forest of Dean","link":"gallery_7759.html","maxRecords":0.0,"photoIDs":[86639.0,86641.0,86647.0,86644.0],"skipIndex":0,"section_code":"gallery","featured_images":"86647,86641,86639","id":7759,"singleSection":false});				  						galleries[31252] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"flower power","link":"gallery_31252.html","maxRecords":0.0,"photoIDs":[151227.0,86501.0,86620.0,86617.0,1399296.0,244579.0,354200.0],"skipIndex":0,"section_code":"gallery","featured_images":"354200,244579,86620,86501","id":31252,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7481204,7481198,1399301,1399297';
imageSets[2] = '8254857,354200,244579,86647,86641,86639,86620,86600,86596,86501';
imageSets[3] = '4604365';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/iangorton/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/iangorton/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/iangorton/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/iangorton/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/iangorton/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/iangorton/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/iangorton/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 += 'section144493.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 && 'section144493' != '') {
					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 = 'Ian Gorton - Digital Art: ' + 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="ig.another@gmail.com">';
					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="ig.another@gmail.com">';
				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({					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 += '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
							}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

		

