window.thumbnails = {};
															thumbnails[8426259] = clik.newPhoto({"id":8426259,"src":"_MG_6831copy_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426259.html","width":130,"caption":"","height":87});
															thumbnails[8426291] = clik.newPhoto({"id":8426291,"src":"_MG_6873_1_2hdr_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426291.html","width":130,"caption":"","height":83});
															thumbnails[8426305] = clik.newPhoto({"id":8426305,"src":"_MG_9030hdr_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426305.html","width":130,"caption":"","height":91});
															thumbnails[8426306] = clik.newPhoto({"id":8426306,"src":"IMG_1697web_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426306.html","width":130,"caption":"","height":85});
															thumbnails[8426328] = clik.newPhoto({"id":8426328,"src":"no_2_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426328.html","width":130,"caption":"","height":81});
															thumbnails[8426386] = clik.newPhoto({"id":8426386,"src":"_MG_6410_1hdr_web_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426386.html","width":130,"caption":"","height":80});
															thumbnails[8426389] = clik.newPhoto({"id":8426389,"src":"_MG_7512web1_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426389.html","width":130,"caption":"","height":87});
															thumbnails[8426391] = clik.newPhoto({"id":8426391,"src":"_MG_9059copy_-_Copy_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426391.html","width":130,"caption":"","height":73});
															thumbnails[8426392] = clik.newPhoto({"id":8426392,"src":"barbican_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426392.html","width":130,"caption":"","height":102});
															thumbnails[8426395] = clik.newPhoto({"id":8426395,"src":"barbican_fishmarket_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426395.html","width":130,"caption":"","height":103});
															thumbnails[8426397] = clik.newPhoto({"id":8426397,"src":"_MG_8061web1_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426397.html","width":130,"caption":"","height":192});
															thumbnails[8426400] = clik.newPhoto({"id":8426400,"src":"_MG_9034copy_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426400.html","width":130,"caption":"","height":213});
															thumbnails[8426402] = clik.newPhoto({"id":8426402,"src":"DPP_0001web_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426402.html","width":130,"caption":"","height":189});
															thumbnails[8426405] = clik.newPhoto({"id":8426405,"src":"IMG_0520copy_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426405.html","width":130,"caption":"","height":198});
															thumbnails[8426407] = clik.newPhoto({"id":8426407,"src":"row_of_yachts_thumb.jpg","galleries_id":322183,"server_id":18,"link":"photo_8426407.html","width":130,"caption":"","height":195});
															thumbnails[8426435] = clik.newPhoto({"id":8426435,"src":"_MG_3974web_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8426435.html","width":130,"caption":"","height":76});
															thumbnails[8426439] = clik.newPhoto({"id":8426439,"src":"_MG_73689hdr_-_Copy_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8426439.html","width":130,"caption":"","height":87});
															thumbnails[8426443] = clik.newPhoto({"id":8426443,"src":"_MG_7601web_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8426443.html","width":130,"caption":"","height":85});
															thumbnails[8426446] = clik.newPhoto({"id":8426446,"src":"IMG_3092copy_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8426446.html","width":130,"caption":"","height":86});
															thumbnails[8426450] = clik.newPhoto({"id":8426450,"src":"storm_clouds_plymouth_sound_devon_thumb.JPG","galleries_id":330253,"server_id":18,"link":"photo_8426450.html","width":130,"caption":"","height":76});
															thumbnails[8426455] = clik.newPhoto({"id":8426455,"src":"_MG_7843web_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8426455.html","width":130,"caption":"","height":81});
															thumbnails[8426459] = clik.newPhoto({"id":8426459,"src":"plymouth_pier_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8426459.html","width":130,"caption":"","height":95});
															thumbnails[8426464] = clik.newPhoto({"id":8426464,"src":"ThePierWithDrakesIslandPlymouth_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8426464.html","width":130,"caption":"","height":97});
															thumbnails[8426469] = clik.newPhoto({"id":8426469,"src":"IMG_1275_thumb.JPG","galleries_id":330253,"server_id":18,"link":"photo_8426469.html","width":130,"caption":"","height":79});
															thumbnails[8426474] = clik.newPhoto({"id":8426474,"src":"IMG_5680copy_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8426474.html","width":130,"caption":"","height":71});
															thumbnails[8734881] = clik.newPhoto({"id":8734881,"src":"_MG_9518soft_web_thumb.jpg","galleries_id":330253,"server_id":18,"link":"photo_8734881.html","width":130,"caption":"","height":87});
															thumbnails[6673407] = clik.newPhoto({"id":6673407,"src":"_MG_3531web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_6673407.html","width":130,"caption":"","height":82});
															thumbnails[6673412] = clik.newPhoto({"id":6673412,"src":"IMG_0379web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_6673412.html","width":130,"caption":"","height":84});
															thumbnails[6673415] = clik.newPhoto({"id":6673415,"src":"IMG_1391web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_6673415.html","width":130,"caption":"","height":55});
															thumbnails[6673418] = clik.newPhoto({"id":6673418,"src":"IMG_1378web2_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_6673418.html","width":130,"caption":"","height":62});
															thumbnails[6673419] = clik.newPhoto({"id":6673419,"src":"IMG_3470web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_6673419.html","width":130,"caption":"","height":73});
															thumbnails[6680969] = clik.newPhoto({"id":6680969,"src":"IMG_9709web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_6680969.html","width":130,"caption":"","height":71});
															thumbnails[7149265] = clik.newPhoto({"id":7149265,"src":"_MG_6447web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_7149265.html","width":130,"caption":"","height":82});
															thumbnails[7149266] = clik.newPhoto({"id":7149266,"src":"_MG_6482web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_7149266.html","width":130,"caption":"","height":65});
															thumbnails[7288361] = clik.newPhoto({"id":7288361,"src":"_MG_7160web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_7288361.html","width":130,"caption":"","height":63});
															thumbnails[8255566] = clik.newPhoto({"id":8255566,"src":"_MG_8825web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_8255566.html","width":130,"caption":"","height":87});
															thumbnails[8734883] = clik.newPhoto({"id":8734883,"src":"IMG_2445web_thumb.jpg","galleries_id":328107,"server_id":18,"link":"photo_8734883.html","width":130,"caption":"","height":76});
															thumbnails[8744449] = clik.newPhoto({"id":8744449,"src":"8x21_binos_thumb.jpg","galleries_id":329361,"server_id":18,"link":"photo_8744449.html","width":130,"caption":"8x21 binoculars","height":130});
															thumbnails[8744455] = clik.newPhoto({"id":8744455,"src":"meade_10x50_thumb.jpg","galleries_id":329361,"server_id":18,"link":"photo_8744455.html","width":130,"caption":"10x50 binoculars","height":130});
															thumbnails[8744375] = clik.newPhoto({"id":8744375,"src":"41i7mxwHxTL__SL500_SS120__thumb.jpg","galleries_id":329361,"server_id":18,"link":"photo_8744375.html","width":130,"caption":"15x70 binoculars","height":130});
															thumbnails[8744433] = clik.newPhoto({"id":8744433,"src":"BRESSERVENUS_thumb.jpg","galleries_id":329361,"server_id":18,"link":"photo_8744433.html","width":130,"caption":"reflector telescopes","height":172});
															thumbnails[8744398] = clik.newPhoto({"id":8744398,"src":"7931_0_thumb.jpg","galleries_id":329361,"server_id":18,"link":"photo_8744398.html","width":130,"caption":"refractor telescopes","height":92});
															thumbnails[8744445] = clik.newPhoto({"id":8744445,"src":"konus_50mm_thumb.jpg","galleries_id":329361,"server_id":18,"link":"photo_8744445.html","width":130,"caption":"spotting scopes","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[328107] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"coastal","link":"section393236.html","maxRecords":0.0,"photoIDs":[6673407.0,6673412.0,6673415.0,6673418.0,6673419.0,6680969.0,7149265.0,7149266.0,7288361.0,8255566.0,8734883.0],"skipIndex":0,"section_code":"section393236","featured_images":"8734883,8255566,7288361,7149266,7149265,6680969,6673419,6673418,6673415,6673412","id":328107,"singleSection":true});				  						galleries[322183] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"plymouth barbican","link":"section386548.html","maxRecords":0.0,"photoIDs":[8426259.0,8426291.0,8426305.0,8426306.0,8426328.0,8426386.0,8426389.0,8426391.0,8426392.0,8426395.0,8426397.0,8426400.0,8426402.0,8426405.0,8426407.0],"skipIndex":0,"section_code":"section386548","featured_images":"8426407,8426405,8426402,8426400,8426397,8426395,8426392,8426391,8426389,8426386","id":322183,"singleSection":true});				  						galleries[330253] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"plymouth sound","link":"section395777.html","maxRecords":0.0,"photoIDs":[8426435.0,8426439.0,8426443.0,8426446.0,8426450.0,8426455.0,8426459.0,8426464.0,8426469.0,8426474.0,8734881.0],"skipIndex":0,"section_code":"section395777","featured_images":"8734881,8426474,8426469,8426464,8426459,8426455,8426450,8426446,8426443,8426439","id":330253,"singleSection":true});				  						galleries[329361] = clik.newGallery({"parentGallery":"","usePopups":true,"title":"shop","link":"section394621.html","maxRecords":0.0,"photoIDs":[8744449.0,8744455.0,8744375.0,8744433.0,8744398.0,8744445.0],"skipIndex":0,"section_code":"section394621","featured_images":"8744455,8744449,8744445,8744433,8744398,8744375","id":329361,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8744455,8744449,8744445,8744433,8744398,8744375,8734883,8734881,8426474,8426469,8426464,8426459,8426455,8426450,8426446,8426443,8426439,8426435,8426407,8426405,8426402,8426400,8426397,8426395,8426392,8426391,8426389,8426386,8426328,8426306,8426305,8426291,8426259,8255566,7288361,7149266,7149265,6680969,6673419,6673418,6673415,6673412,6673407';
imageSets[3] = '8744455,8744449,8744445,8744433,8744398,8744375,8734883,8734881,8426474,8426469,8426464,8426459,8426455,8426450,8426446,8426443,8426439,8426435,8426407,8426405,8426402,8426400,8426397,8426395,8426392,8426391,8426389,8426386,8426328,8426306,8426305,8426291,8426259,8255566,7288361,7149266,7149265,6680969,6673419,6673418,6673415,6673412,6673407';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/davefry/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/davefry/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/davefry/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/davefry/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/davefry/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/davefry/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/davefry/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/davefry/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 += 'section386548.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 && 'section386548' != '') {
					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 = 'south west views: ' + 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="dfryphotography@aol.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="dfryphotography@aol.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({					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;
	}
}

			

