window.thumbnails = {};
															thumbnails[8417151] = clik.newPhoto({"id":8417151,"src":"20110904crosstri0329_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417151.html","width":87,"caption":"SIR MALCOM ROSS - OFFICIAL STARTER","height":130});
															thumbnails[8417140] = clik.newPhoto({"id":8417140,"src":"20110904crosstri0043_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417140.html","width":87,"caption":"READY FOR THE OFF...","height":130});
															thumbnails[8417152] = clik.newPhoto({"id":8417152,"src":"20110904crosstri0358_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417152.html","width":130,"caption":"RUNNING TO THE WATER","height":87});
															thumbnails[8417153] = clik.newPhoto({"id":8417153,"src":"20110904crosstri0369_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417153.html","width":130,"caption":"APPRECIATIVE AUDIENCE","height":87});
															thumbnails[8417141] = clik.newPhoto({"id":8417141,"src":"20110904crosstri0055_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417141.html","width":130,"caption":"SWIMMING ACROSS LOCH KEN","height":87});
															thumbnails[8417142] = clik.newPhoto({"id":8417142,"src":"20110904crosstri0062_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417142.html","width":130,"caption":"SWIMMING ACROSS LOCH KEN","height":87});
															thumbnails[8417143] = clik.newPhoto({"id":8417143,"src":"20110904crosstri0085_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417143.html","width":130,"caption":"THE SWIM LEADER","height":87});
															thumbnails[8417154] = clik.newPhoto({"id":8417154,"src":"20110904crosstri0389_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417154.html","width":130,"caption":"HALF-WAY POINT OF THE SWIM","height":87});
															thumbnails[8417155] = clik.newPhoto({"id":8417155,"src":"20110904crosstri0416_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417155.html","width":130,"caption":"HALF-WAY POINT OF THE SWIM","height":87});
															thumbnails[8417144] = clik.newPhoto({"id":8417144,"src":"20110904crosstri0137_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417144.html","width":130,"caption":"HALF-WAY POINT OF THE SWIM","height":87});
															thumbnails[8417145] = clik.newPhoto({"id":8417145,"src":"20110904crosstri0169_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417145.html","width":130,"caption":"LEAD SWIMMER OUT OF THE WATER","height":87});
															thumbnails[8417156] = clik.newPhoto({"id":8417156,"src":"20110904crosstri0448_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417156.html","width":87,"caption":"SWIM WINNER","height":130});
															thumbnails[8417157] = clik.newPhoto({"id":8417157,"src":"20110904crosstri0465_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417157.html","width":130,"caption":"STARTING ON THE CYCLE RUN...","height":87});
															thumbnails[8417158] = clik.newPhoto({"id":8417158,"src":"20110904crosstri0480_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417158.html","width":130,"caption":"WAITING FOR THE HANDOVER","height":87});
															thumbnails[8417159] = clik.newPhoto({"id":8417159,"src":"20110904crosstri0492_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417159.html","width":130,"caption":"GLAD ITS OVER!","height":87});
															thumbnails[8417160] = clik.newPhoto({"id":8417160,"src":"20110904crosstri0497_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417160.html","width":87,"caption":"HERE TO HELP","height":130});
															thumbnails[8417161] = clik.newPhoto({"id":8417161,"src":"20110904crosstri0509_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417161.html","width":130,"caption":"OFF TO CYCLE...","height":87});
															thumbnails[8417162] = clik.newPhoto({"id":8417162,"src":"20110904crosstri0514_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417162.html","width":130,"caption":"NOT WHAT IS SAYS ON THE ROAD...","height":87});
															thumbnails[8417163] = clik.newPhoto({"id":8417163,"src":"20110904crosstri0526_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417163.html","width":130,"caption":"SPECTATOR SPORT","height":87});
															thumbnails[8417164] = clik.newPhoto({"id":8417164,"src":"20110904crosstri0533_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417164.html","width":87,"caption":"CYCLING OVER WATER","height":130});
															thumbnails[8417165] = clik.newPhoto({"id":8417165,"src":"20110904crosstri0549_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417165.html","width":130,"caption":"THE TIME LORDS ARE REALLY LADIES","height":87});
															thumbnails[8417146] = clik.newPhoto({"id":8417146,"src":"20110904crosstri0229_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417146.html","width":130,"caption":"RUNNING INTO THE WOODS","height":87});
															thumbnails[8417166] = clik.newPhoto({"id":8417166,"src":"20110904crosstri0562_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417166.html","width":130,"caption":"LISTEN TO THE MUSIC","height":87});
															thumbnails[8417167] = clik.newPhoto({"id":8417167,"src":"20110904crosstri0574_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417167.html","width":130,"caption":"WINNING TEAM!","height":87});
															thumbnails[8417168] = clik.newPhoto({"id":8417168,"src":"20110904crosstri0585_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417168.html","width":130,"caption":"SECOND PLACED TEAM","height":87});
															thumbnails[8417147] = clik.newPhoto({"id":8417147,"src":"20110904crosstri0250_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417147.html","width":130,"caption":"RUNNING INTO 4TH","height":87});
															thumbnails[8417169] = clik.newPhoto({"id":8417169,"src":"20110904crosstri0594_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417169.html","width":130,"caption":"4TH TEAM","height":87});
															thumbnails[8417170] = clik.newPhoto({"id":8417170,"src":"20110904crosstri0601_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417170.html","width":130,"caption":"INDIVIDUAL WINNER!","height":87});
															thumbnails[8417171] = clik.newPhoto({"id":8417171,"src":"20110904crosstri0602_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417171.html","width":130,"caption":"SECOND PLACE MAN","height":87});
															thumbnails[8417148] = clik.newPhoto({"id":8417148,"src":"20110904crosstri0263_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417148.html","width":130,"caption":"THIRD PLACE MAN","height":87});
															thumbnails[8417172] = clik.newPhoto({"id":8417172,"src":"20110904crosstri0630_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417172.html","width":130,"caption":"SEVENTH PLACE","height":87});
															thumbnails[8417149] = clik.newPhoto({"id":8417149,"src":"20110904crosstri0293_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417149.html","width":130,"caption":"DANNY MCDOUGALL BARES HIS CHEST","height":87});
															thumbnails[8417173] = clik.newPhoto({"id":8417173,"src":"20110904crosstri0674_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417173.html","width":130,"caption":"DR DUCK COMES TO THE END!","height":87});
															thumbnails[8417174] = clik.newPhoto({"id":8417174,"src":"20110904crosstri0678_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417174.html","width":130,"caption":"FIVE DUCKS ALL IN A TRIATHLON!","height":87});
															thumbnails[8417150] = clik.newPhoto({"id":8417150,"src":"20110904crosstri0307_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417150.html","width":130,"caption":"RUNNING INTO THE VILLAGE","height":87});
															thumbnails[8417175] = clik.newPhoto({"id":8417175,"src":"20110904crosstri0693_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417175.html","width":130,"caption":"THE MAN WHO MADE IT HAPPEN","height":87});
															thumbnails[8417176] = clik.newPhoto({"id":8417176,"src":"20110904crosstri0696_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417176.html","width":130,"caption":"RUNNING TO THE LINE","height":87});
															thumbnails[8417177] = clik.newPhoto({"id":8417177,"src":"20110904crosstri0712_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417177.html","width":130,"caption":"TWA JIMS!","height":87});
															thumbnails[8417178] = clik.newPhoto({"id":8417178,"src":"20110904crosstri0714_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417178.html","width":130,"caption":"RUNNER AND EDITOR","height":87});
															thumbnails[8417179] = clik.newPhoto({"id":8417179,"src":"20110904crosstri0723_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417179.html","width":130,"caption":"COMMUNITY ACTION","height":87});
															thumbnails[8417182] = clik.newPhoto({"id":8417182,"src":"20110904crosstri0749_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417182.html","width":130,"caption":"ANDY SMITH & TONY CAIG","height":87});
															thumbnails[8417183] = clik.newPhoto({"id":8417183,"src":"20110904crosstri0759_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417183.html","width":130,"caption":"ANDY HOWAT, NICOAL BRUNTON & JOSEPH McGINLEY","height":87});
															thumbnails[8417184] = clik.newPhoto({"id":8417184,"src":"20110904crosstri0762_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417184.html","width":130,"caption":"JORDYN ARMSTRONG, JOCK ARMSTRONG & SCOTT PITKEATHLY","height":87});
															thumbnails[8417185] = clik.newPhoto({"id":8417185,"src":"20110904crosstri0763_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417185.html","width":130,"caption":"PAUL MADDOCKS & GRAHAM BANKS","height":87});
															thumbnails[8417186] = clik.newPhoto({"id":8417186,"src":"20110904crosstri0768_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417186.html","width":130,"caption":" BEN DREYER, STEPHEN DREYER & JO ZAKRZEWSKIJO ","height":87});
															thumbnails[8417187] = clik.newPhoto({"id":8417187,"src":"20110904crosstri0783_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417187.html","width":130,"caption":"DANNY McDOUGALL","height":87});
															thumbnails[8417188] = clik.newPhoto({"id":8417188,"src":"20110904crosstri0801_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417188.html","width":130,"caption":"BIG JIM!!!","height":87});
															thumbnails[8417189] = clik.newPhoto({"id":8417189,"src":"20110904crosstri0803_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417189.html","width":130,"caption":"FAMILY SUPPORT","height":87});
															thumbnails[8417190] = clik.newPhoto({"id":8417190,"src":"20110904crosstri0813_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417190.html","width":130,"caption":"FIRST LADY","height":87});
															thumbnails[8417191] = clik.newPhoto({"id":8417191,"src":"20110904crosstri0821_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417191.html","width":130,"caption":"TROPHY WINNER","height":87});
															thumbnails[8417180] = clik.newPhoto({"id":8417180,"src":"20110904crosstri0725_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417180.html","width":130,"caption":"INDIVIDUAL TIME SHEET","height":87});
															thumbnails[8417181] = clik.newPhoto({"id":8417181,"src":"20110904crosstri0726_thumb.JPG","galleries_id":445892,"server_id":32,"link":"photo_8417181.html","width":130,"caption":"TEAM TIME SHEET","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[445892] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"CROSSMICHAEL TRIATHLON 2011","link":"gallery.html","maxRecords":0.0,"photoIDs":[8417151.0,8417140.0,8417152.0,8417153.0,8417141.0,8417142.0,8417143.0,8417154.0,8417155.0,8417144.0,8417145.0,8417156.0,8417157.0,8417158.0,8417159.0,8417160.0,8417161.0,8417162.0,8417163.0,8417164.0,8417165.0,8417146.0,8417166.0,8417167.0,8417168.0,8417147.0,8417169.0,8417170.0,8417171.0,8417148.0,8417172.0,8417149.0,8417173.0,8417174.0,8417150.0,8417175.0,8417176.0,8417177.0,8417178.0,8417179.0,8417182.0,8417183.0,8417184.0,8417185.0,8417186.0,8417187.0,8417188.0,8417189.0,8417190.0,8417191.0,8417180.0,8417181.0],"skipIndex":0,"section_code":"gallery","featured_images":"8417191,8417190,8417189,8417188,8417187,8417186,8417185,8417184,8417183,8417182","id":445892,"singleSection":true});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8417191,8417190,8417189,8417188,8417187,8417186,8417185,8417184,8417183,8417182,8417181,8417180,8417179,8417178,8417177,8417176,8417175,8417174,8417173,8417172,8417171,8417170,8417169,8417168,8417167,8417166,8417165,8417164,8417163,8417162,8417161,8417160,8417159,8417158,8417157,8417156,8417155,8417154,8417153,8417152,8417151,8417150,8417149,8417148,8417147,8417146,8417145,8417144,8417143,8417142';
imageSets[3] = '8417191,8417190,8417189,8417188,8417187,8417186,8417185,8417184,8417183,8417182,8417181,8417180,8417179,8417178,8417177,8417176,8417175,8417174,8417173,8417172,8417171,8417170,8417169,8417168,8417167,8417166,8417165,8417164,8417163,8417162,8417161,8417160,8417159,8417158,8417157,8417156,8417155,8417154,8417153,8417152,8417151,8417150,8417149,8417148,8417147,8417146,8417145,8417144,8417143,8417142';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/petethecamera/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/petethecamera/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 = 'PETE WHITE - PHOTOGRAPHER: ' + 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 trolley :)').show();}
				else{
					$('#paymentConfirm', root).text('Item added to trolley :)').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>Image ref: </strong>' + this.photo_ref + '</div>';
	}
		if (this.takendate != '') {
		
		temp += '<div class="imageinfo" id="imageDate"><strong>Date exposed: </strong>' + this.takendate + '</div>';
	}
	
	if (this.location != '') {
		
		temp += '<div class="imageinfo" id="imageLocation"><strong>Camera location: </strong>' +  this.location + '</div>';
	}
	
	if (this.photographer != '') {
		
		temp += '<div class="imageinfo" id="imagePhotographer"><strong>Technical info: </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 Google Checkout:</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="updateCartValue($(this.form).next(\'#paymentForm\')[0],this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value); if(divShowing(\'paymentConfirm\')){fadeOut(\'paymentConfirm\', 3)};">';
		
		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">';
			temp += '	<input type="hidden" name="item_option" value="' + item_option + '">';
			temp += '	<input type="hidden" name="site" value="PETETHECAMERA">';
			temp += '	<input type="hidden" name="item_number" value="'+ this.id +'">';
			temp += '	<input type="hidden" name="quantity" value="1">';
						temp += '	<input value="Put into your trolley :)" id="paymentAddButton" class="button" onmouseover="this.className=\'buttonHi\'\;" onmouseout="this.className=\'button\'\;" type="Button">';
							temp += '	<input value="What\'s in your trolley?" id="paymentViewButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" type="Button" onclick="javascript:window.location=\'cart.html\'">';
			temp += '</form>';
						temp += '<div class="clearing">&nbsp;</div>';
			temp += '<div id="confirmContainer">';
			temp += '<div id="paymentConfirm">Item added to trolley :)</div>';
			temp += '</div>';
			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;
	}
}

			

