window.thumbnails = {};
															thumbnails[690001] = clik.newPhoto({"id":690001,"src":"Pipe_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[690007] = clik.newPhoto({"id":690007,"src":"Cowboy2_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[690016] = clik.newPhoto({"id":690016,"src":"Uncle Dewi_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":188});
															thumbnails[690032] = clik.newPhoto({"id":690032,"src":"spades_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":195});
															thumbnails[697649] = clik.newPhoto({"id":697649,"src":"Penned in_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1499807] = clik.newPhoto({"id":1499807,"src":"choir_2011_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Newtown Male Voice Choir 2011","height":88});
															thumbnails[1962328] = clik.newPhoto({"id":1962328,"src":"web_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Brecknockshire and Radnorshire District Sports Awards","height":90});
															thumbnails[2160426] = clik.newPhoto({"id":2160426,"src":"Hockey Sponsorship_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Framewise LTD Openday","height":195});
															thumbnails[2160432] = clik.newPhoto({"id":2160432,"src":"The Launch_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Framewise LTD Openday","height":87});
															thumbnails[2160434] = clik.newPhoto({"id":2160434,"src":"Gwernyfed High School brecon_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"BT Schools Question Time","height":88});
															thumbnails[6881131] = clik.newPhoto({"id":6881131,"src":"IMG_8320_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Elephant & Castle Football Team, Newtown","height":87});
															thumbnails[7675839] = clik.newPhoto({"id":7675839,"src":"IMG_2351_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"Radnor, Winning County  2351","height":89});
															thumbnails[1476637] = clik.newPhoto({"id":1476637,"src":"green1_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_1476637.html","width":130,"caption":"","height":195});
															thumbnails[2372763] = clik.newPhoto({"id":2372763,"src":"max_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_2372763.html","width":130,"caption":"","height":87});
															thumbnails[2372766] = clik.newPhoto({"id":2372766,"src":"mal_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_2372766.html","width":130,"caption":"","height":195});
															thumbnails[3059810] = clik.newPhoto({"id":3059810,"src":"204_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_3059810.html","width":130,"caption":"","height":87});
															thumbnails[4927084] = clik.newPhoto({"id":4927084,"src":"061_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_4927084.html","width":130,"caption":"","height":87});
															thumbnails[5969751] = clik.newPhoto({"id":5969751,"src":"IMG_6309_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_5969751.html","width":130,"caption":"","height":87});
															thumbnails[5969753] = clik.newPhoto({"id":5969753,"src":"IMG_6319_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_5969753.html","width":130,"caption":"","height":195});
															thumbnails[6162473] = clik.newPhoto({"id":6162473,"src":"IMG_6801_1_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_6162473.html","width":130,"caption":"","height":87});
															thumbnails[6162475] = clik.newPhoto({"id":6162475,"src":"IMG_6805_1_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_6162475.html","width":130,"caption":"","height":87});
															thumbnails[6857037] = clik.newPhoto({"id":6857037,"src":"IMG_8060_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_6857037.html","width":130,"caption":"","height":187});
															thumbnails[6857038] = clik.newPhoto({"id":6857038,"src":"IMG_8068_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_6857038.html","width":130,"caption":"","height":195});
															thumbnails[6857043] = clik.newPhoto({"id":6857043,"src":"IMG_8066_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_6857043.html","width":130,"caption":"","height":195});
															thumbnails[6865987] = clik.newPhoto({"id":6865987,"src":"janet_boys_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_6865987.html","width":130,"caption":"","height":85});
															thumbnails[6891037] = clik.newPhoto({"id":6891037,"src":"montage_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_6891037.html","width":130,"caption":"","height":98});
															thumbnails[6903786] = clik.newPhoto({"id":6903786,"src":"IMG_9041_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_6903786.html","width":130,"caption":"","height":185});
															thumbnails[6903788] = clik.newPhoto({"id":6903788,"src":"IMG_9046_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_6903788.html","width":130,"caption":"","height":195});
															thumbnails[6903789] = clik.newPhoto({"id":6903789,"src":"IMG_9053_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_6903789.html","width":130,"caption":"","height":187});
															thumbnails[6951521] = clik.newPhoto({"id":6951521,"src":"IMG_8022_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_6951521.html","width":130,"caption":"","height":86});
															thumbnails[6951525] = clik.newPhoto({"id":6951525,"src":"IMG_8105_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_6951525.html","width":130,"caption":"","height":87});
															thumbnails[6951527] = clik.newPhoto({"id":6951527,"src":"IMG_8866_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_6951527.html","width":130,"caption":"","height":195});
															thumbnails[7003005] = clik.newPhoto({"id":7003005,"src":"IMG_9781_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7003005.html","width":130,"caption":"","height":195});
															thumbnails[7004864] = clik.newPhoto({"id":7004864,"src":"IMG_8880_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7004864.html","width":130,"caption":"","height":195});
															thumbnails[7043343] = clik.newPhoto({"id":7043343,"src":"IMG_9632_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7043343.html","width":130,"caption":"","height":87});
															thumbnails[7043347] = clik.newPhoto({"id":7043347,"src":"IMG_9621_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7043347.html","width":130,"caption":"","height":195});
															thumbnails[7056617] = clik.newPhoto({"id":7056617,"src":"IMG_8966_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7056617.html","width":130,"caption":"","height":87});
															thumbnails[7175031] = clik.newPhoto({"id":7175031,"src":"archie_web_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7175031.html","width":130,"caption":"","height":36});
															thumbnails[7203526] = clik.newPhoto({"id":7203526,"src":"IMG_1287_bw_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_7203526.html","width":130,"caption":"","height":87});
															thumbnails[7203527] = clik.newPhoto({"id":7203527,"src":"IMG_1478_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7203527.html","width":130,"caption":"","height":198});
															thumbnails[7203529] = clik.newPhoto({"id":7203529,"src":"IMG_1699_bw_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7203529.html","width":130,"caption":"","height":195});
															thumbnails[7797469] = clik.newPhoto({"id":7797469,"src":"IMG_2535_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7797469.html","width":130,"caption":"","height":86});
															thumbnails[7910945] = clik.newPhoto({"id":7910945,"src":"IMG_2584_square_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7910945.html","width":130,"caption":"","height":129});
															thumbnails[7910947] = clik.newPhoto({"id":7910947,"src":"IMG_2637_bw_thumb.jpg","galleries_id":344615,"server_id":18,"link":"photo_7910947.html","width":130,"caption":"","height":201});
															thumbnails[8530504] = clik.newPhoto({"id":8530504,"src":"Digger3_thumb.jpg","galleries_id":344615,"server_id":35,"link":"photo_8530504.html","width":130,"caption":"","height":86});
															thumbnails[8530537] = clik.newPhoto({"id":8530537,"src":"IMG_33301_thumb.jpg","galleries_id":344615,"server_id":35,"link":"photo_8530537.html","width":130,"caption":"","height":87});
															thumbnails[8530566] = clik.newPhoto({"id":8530566,"src":"IMG_33801_thumb.jpg","galleries_id":344615,"server_id":35,"link":"photo_8530566.html","width":130,"caption":"","height":85});
															thumbnails[5969471] = clik.newPhoto({"id":5969471,"src":"IMG_6277_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_5969471.html","width":130,"caption":"","height":195});
															thumbnails[5969371] = clik.newPhoto({"id":5969371,"src":"IMG_6258_BW_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_5969371.html","width":130,"caption":"","height":87});
															thumbnails[5968540] = clik.newPhoto({"id":5968540,"src":"IMG_5975_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_5968540.html","width":130,"caption":"","height":200});
															thumbnails[4927082] = clik.newPhoto({"id":4927082,"src":"048_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_4927082.html","width":130,"caption":"","height":202});
															thumbnails[4851202] = clik.newPhoto({"id":4851202,"src":"093_bw_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_4851202.html","width":130,"caption":"","height":195});
															thumbnails[5969533] = clik.newPhoto({"id":5969533,"src":"IMG_6288_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_5969533.html","width":130,"caption":"","height":195});
															thumbnails[5969536] = clik.newPhoto({"id":5969536,"src":"IMG_6293_thumb.jpg","galleries_id":74654,"server_id":18,"link":"photo_5969536.html","width":130,"caption":"","height":195});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[344615] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Children and Families in the studio","link":"gallery_344615.html","maxRecords":0.0,"photoIDs":[6162473.0,6162475.0,6891037.0,6903786.0,6903788.0,6903789.0,6951527.0,7003005.0,7004864.0,7043343.0,7043347.0,7056617.0,7175031.0,7203527.0,7203529.0,7797469.0,7910945.0,7910947.0,8530504.0,8530537.0,8530566.0],"skipIndex":0,"section_code":"gallery","featured_images":"7910947,7910945,7797469,7203529,7056617,7043347,7004864,7003005,6951527,6903788,6903786","id":344615,"singleSection":false});				  						galleries[74654] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Children and Families on Location","link":"gallery_74654.html","maxRecords":0.0,"photoIDs":[1476637.0,2372763.0,2372766.0,3059810.0,4927084.0,5969751.0,5969753.0,6857037.0,6857038.0,6857043.0,6865987.0,6951521.0,6951525.0,7203526.0,5969471.0,5969371.0,5968540.0,4927082.0,4851202.0,5969533.0,5969536.0],"skipIndex":0,"section_code":"gallery","featured_images":"7203526,6951521,5969533,5969471,4851202,3059810","id":74654,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '7910947,7910945,7797469,7203529,7056617,7004864,5969533,4851202';
imageSets[2] = '7910947,7910945,7797469,7675839,7203529,7203526,7056617,7043347,7004864,7003005,6951527,6951521,6903788,6903786,5969533,5969471,4851202,3059810,1962328';
imageSets[3] = '8530566,8530537,8530504,7910947,7910945,7797469,7675839,7203529,7203527,7203526,7175031,7056617,7043347,7043343,7004864,7003005,6951527,6951525,6951521,6903789,6903788,6903786,6891037,6881131,6865987,6857043,6857038,6857037,6162475,6162473,5969753,5969751,5969536,5969533,5969471,5969371,5968540,4927084,4927082,4851202,3059810,2372766,2372763,2160434,2160432,2160426,1962328,1499807,1476637,697649';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'www12.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/joycejones/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/joycejones/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/joycejones/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/joycejones/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/joycejones/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/joycejones/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/joycejones/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:'',$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 = 'Joyce Jones Photography: ' + 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>';
	}
				
				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>Order this print:</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="jonesjoyce@tiscali.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="jonesjoyce@tiscali.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;
	}
}

			

