window.thumbnails = {};
															thumbnails[4087874] = clik.newPhoto({"id":4087874,"src":"DT869StGeorge_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4087874.html","width":130,"caption":"","height":87});
															thumbnails[4088001] = clik.newPhoto({"id":4088001,"src":"DT870StGeorge_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088001.html","width":130,"caption":"","height":194});
															thumbnails[4088197] = clik.newPhoto({"id":4088197,"src":"DT871StGeorge_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088197.html","width":130,"caption":"","height":194});
															thumbnails[4088204] = clik.newPhoto({"id":4088204,"src":"DT873StGeorge_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088204.html","width":130,"caption":"","height":194});
															thumbnails[4088223] = clik.newPhoto({"id":4088223,"src":"DT874StGeorgespectators_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088223.html","width":130,"caption":"","height":194});
															thumbnails[4088249] = clik.newPhoto({"id":4088249,"src":"DT876BedofNails1_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088249.html","width":130,"caption":"","height":87});
															thumbnails[4088251] = clik.newPhoto({"id":4088251,"src":"DT879GodivaStatueStGeorgesDay_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088251.html","width":130,"caption":"","height":87});
															thumbnails[4088254] = clik.newPhoto({"id":4088254,"src":"DT880GodivaStatueStGeorgesDay_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088254.html","width":130,"caption":"","height":194});
															thumbnails[4088410] = clik.newPhoto({"id":4088410,"src":"DT872StGeorgeOgre1_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088410.html","width":130,"caption":"","height":194});
															thumbnails[4088414] = clik.newPhoto({"id":4088414,"src":"DT877SaintGeorgeandOgre_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_4088414.html","width":130,"caption":"","height":87});
															thumbnails[3543141] = clik.newPhoto({"id":3543141,"src":"Paul_and_Vicky_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_3543141.html","width":130,"caption":"Just one example of a photo book page that can be created as an alternative to single page images","height":184});
															thumbnails[3555264] = clik.newPhoto({"id":3555264,"src":"Paul_freeze_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_3555264.html","width":130,"caption":"","height":57});
															thumbnails[3555272] = clik.newPhoto({"id":3555272,"src":"Vicky_freeze2_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_3555272.html","width":130,"caption":"","height":57});
															thumbnails[3620827] = clik.newPhoto({"id":3620827,"src":"P09Jack6weeks_thumb.jpg","galleries_id":130220,"server_id":1,"link":"photo_3620827.html","width":130,"caption":"","height":87});
															thumbnails[3691832] = clik.newPhoto({"id":3691832,"src":"PICT0005_thumb.jpg","galleries_id":130220,"server_id":1,"link":"photo_3691832.html","width":130,"caption":"","height":196});
															thumbnails[3691836] = clik.newPhoto({"id":3691836,"src":"PICT0018_thumb.jpg","galleries_id":130220,"server_id":1,"link":"photo_3691836.html","width":130,"caption":"","height":196});
															thumbnails[3691840] = clik.newPhoto({"id":3691840,"src":"PICT0023_thumb.jpg","galleries_id":130220,"server_id":1,"link":"photo_3691840.html","width":130,"caption":"","height":196});
															thumbnails[3691844] = clik.newPhoto({"id":3691844,"src":"PICT0030_thumb.jpg","galleries_id":130220,"server_id":1,"link":"photo_3691844.html","width":130,"caption":"","height":196});
															thumbnails[3691846] = clik.newPhoto({"id":3691846,"src":"PICT0034_thumb.jpg","galleries_id":130220,"server_id":1,"link":"photo_3691846.html","width":130,"caption":"","height":196});
															thumbnails[2945311] = clik.newPhoto({"id":2945311,"src":"_DSC5382-Edit-3_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945311.html","width":130,"caption":"","height":194});
															thumbnails[2945074] = clik.newPhoto({"id":2945074,"src":"_DSC5413-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945074.html","width":130,"caption":"","height":194});
															thumbnails[2945984] = clik.newPhoto({"id":2945984,"src":"DT654-Fireworks-Kenilworth-_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_2945984.html","width":130,"caption":"Annual Fireworks display at Kenilworth Castle on Guy Fawkes or Bonfire night","height":194});
															thumbnails[2946142] = clik.newPhoto({"id":2946142,"src":"DA24-West-Highland-White-Te_thumb.jpg","galleries_id":136143,"server_id":1,"link":"photo_2946142.html","width":130,"caption":"West Highland White Terrier Dog ","height":194});
															thumbnails[2946419] = clik.newPhoto({"id":2946419,"src":"DSL207-Innocent-Child-copy_thumb.jpg","galleries_id":130220,"server_id":1,"link":"photo_2946419.html","width":130,"caption":"","height":194});
															thumbnails[2945526] = clik.newPhoto({"id":2945526,"src":"_DSC5569-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945526.html","width":130,"caption":"","height":194});
															thumbnails[2945557] = clik.newPhoto({"id":2945557,"src":"_DSC5601-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945557.html","width":130,"caption":"","height":87});
															thumbnails[2945562] = clik.newPhoto({"id":2945562,"src":"_DSC5612-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945562.html","width":130,"caption":"","height":194});
															thumbnails[2945583] = clik.newPhoto({"id":2945583,"src":"_DSC5552-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945583.html","width":130,"caption":"","height":194});
															thumbnails[2945996] = clik.newPhoto({"id":2945996,"src":"DT656-Fireworks-Kenilworth-_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_2945996.html","width":130,"caption":"Annual Fireworks display at Kenilworth Castle on Guy Fawkes or Bonfire night","height":194});
															thumbnails[2946163] = clik.newPhoto({"id":2946163,"src":"DA23-Cavalier-King-Charles-_thumb.jpg","galleries_id":136143,"server_id":1,"link":"photo_2946163.html","width":130,"caption":"Cavalier King Charles Spaniel Dog","height":87});
															thumbnails[2946102] = clik.newPhoto({"id":2946102,"src":"DT629-Tin-Man-copy_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_2946102.html","width":130,"caption":"Man dressed as the Tin Man from the film Wizard of OZ playing conkers at the World Conker Championships","height":194});
															thumbnails[2945597] = clik.newPhoto({"id":2945597,"src":"_DSC5559-Edit-2_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945597.html","width":130,"caption":"","height":87});
															thumbnails[2946175] = clik.newPhoto({"id":2946175,"src":"DA58-King-Charles-Spaniel-T_thumb.jpg","galleries_id":136143,"server_id":1,"link":"photo_2946175.html","width":130,"caption":"King Charles Spaniel Tricolour Dog","height":194});
															thumbnails[2945612] = clik.newPhoto({"id":2945612,"src":"_DSC5626-Edit-2-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945612.html","width":130,"caption":"","height":194});
															thumbnails[2946197] = clik.newPhoto({"id":2946197,"src":"DA44-Cavalier-King-Charles-_thumb.jpg","galleries_id":136143,"server_id":1,"link":"photo_2946197.html","width":130,"caption":"Cavalier King Charles Spaniel","height":194});
															thumbnails[2945167] = clik.newPhoto({"id":2945167,"src":"_DSC5472-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945167.html","width":130,"caption":"","height":194});
															thumbnails[2946323] = clik.newPhoto({"id":2946323,"src":"DA82-King-Charles-Spaniel-P_thumb.jpg","galleries_id":136143,"server_id":1,"link":"photo_2946323.html","width":130,"caption":"Cavalier Puppies","height":87});
															thumbnails[2945119] = clik.newPhoto({"id":2945119,"src":"_DSC5467-Edit_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945119.html","width":130,"caption":"","height":87});
															thumbnails[2946047] = clik.newPhoto({"id":2946047,"src":"DT641-David-Jakins-King-Con_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_2946047.html","width":130,"caption":"King Conker David Jakins at the annual World Conker Championships ","height":87});
															thumbnails[2946351] = clik.newPhoto({"id":2946351,"src":"DA52-King-Charles-Spaniel-P_thumb.jpg","galleries_id":136143,"server_id":1,"link":"photo_2946351.html","width":130,"caption":"Cavalier King Charles Spaniel Puppy","height":194});
															thumbnails[2946374] = clik.newPhoto({"id":2946374,"src":"DA63-King-Charles-Spaniel-P_thumb.jpg","galleries_id":136143,"server_id":1,"link":"photo_2946374.html","width":130,"caption":"Cavalier King Charles Puppy","height":194});
															thumbnails[2945275] = clik.newPhoto({"id":2945275,"src":"_DSC5483-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945275.html","width":130,"caption":"","height":194});
															thumbnails[2945573] = clik.newPhoto({"id":2945573,"src":"_DSC5617-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945573.html","width":130,"caption":"","height":194});
															thumbnails[2946407] = clik.newPhoto({"id":2946407,"src":"DT674-Offenham-Ladies-Maypo_thumb.jpg","galleries_id":136144,"server_id":1,"link":"photo_2946407.html","width":130,"caption":"Offenham Ladies Maypole dancing team","height":194});
															thumbnails[2944913] = clik.newPhoto({"id":2944913,"src":"_DSC5663-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2944913.html","width":130,"caption":"","height":87});
															thumbnails[2945061] = clik.newPhoto({"id":2945061,"src":"_DSC5669-Edit-copy_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2945061.html","width":130,"caption":"","height":194});
															thumbnails[2944905] = clik.newPhoto({"id":2944905,"src":"vicky02_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2944905.html","width":130,"caption":"","height":87});
															thumbnails[2944892] = clik.newPhoto({"id":2944892,"src":"vicky01_thumb.jpg","galleries_id":136137,"server_id":1,"link":"photo_2944892.html","width":130,"caption":"","height":194});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[136137] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wedding Photography","link":"gallery_136137.html","maxRecords":0.0,"photoIDs":[3543141.0,3555264.0,3555272.0,2945311.0,2945074.0,2945526.0,2945557.0,2945562.0,2945583.0,2945597.0,2945612.0,2945167.0,2945119.0,2945275.0,2945573.0,2944913.0,2945061.0,2944905.0,2944892.0],"skipIndex":0,"section_code":"gallery","featured_images":2944913.0,"id":136137,"singleSection":false});				  						galleries[130220] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Home Portraits","link":"gallery_130220.html","maxRecords":0.0,"photoIDs":[3620827.0,3691832.0,3691836.0,3691840.0,3691844.0,3691846.0,2946419.0],"skipIndex":0,"section_code":"gallery","featured_images":2946419.0,"id":130220,"singleSection":false});				  						galleries[136145] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portfolios","link":"gallery_136145.html","maxRecords":0.0,"photoIDs":[],"skipIndex":0,"section_code":"gallery","featured_images":"","id":136145,"singleSection":false});				  						galleries[136144] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Event Photography","link":"gallery_136144.html","maxRecords":0.0,"photoIDs":[4087874.0,4088001.0,4088197.0,4088204.0,4088223.0,4088249.0,4088251.0,4088254.0,4088410.0,4088414.0,2945984.0,2945996.0,2946102.0,2946047.0,2946407.0],"skipIndex":0,"section_code":"gallery","featured_images":2945984.0,"id":136144,"singleSection":false});				  						galleries[136143] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Animal Portraits","link":"gallery_136143.html","maxRecords":0.0,"photoIDs":[2946142.0,2946163.0,2946175.0,2946197.0,2946323.0,2946351.0,2946374.0],"skipIndex":0,"section_code":"gallery","featured_images":2946142.0,"id":136143,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '3555272,3555264';
imageSets[2] = '2946419,2946142,2945984,2944913';
imageSets[3] = '4088414,4088410,4088254,4088251,4088249,4088223,4088204,4088197,4088001,4087874,3691846,3691844,3691840,3691836,3691832,3620827,3555272,3555264,3543141,2946419,2946407,2946374,2946351,2946323,2946197,2946175,2946163,2946142,2946102,2946047,2945996,2945984,2945612,2945597,2945583,2945573,2945562,2945557,2945526,2945311,2945275,2945167,2945119,2945074,2945061,2944913,2944905,2944892';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/jmartin/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/jmartin/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/jmartin/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/jmartin/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/jmartin/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/jmartin/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/jmartin/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/jmartin/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 = 'John Martin 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> ' + (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.item_price !== '') {
			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;
	}
}

			

