window.thumbnails = {};
															thumbnails[1400247] = clik.newPhoto({"id":1400247,"src":"Stubbs_thumb.jpg","galleries_id":97068,"server_id":18,"link":"photo_1400247.html","width":130,"caption":"","height":130});
															thumbnails[1537513] = clik.newPhoto({"id":1537513,"src":"Nelsonthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1537513.html","width":130,"caption":"","height":130});
															thumbnails[1537516] = clik.newPhoto({"id":1537516,"src":"Roofthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1537516.html","width":130,"caption":"","height":130});
															thumbnails[1537518] = clik.newPhoto({"id":1537518,"src":"Grassesthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1537518.html","width":130,"caption":"","height":130});
															thumbnails[1537520] = clik.newPhoto({"id":1537520,"src":"birdthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1537520.html","width":130,"caption":"","height":130});
															thumbnails[1537571] = clik.newPhoto({"id":1537571,"src":"Grainthumb1.jpg","galleries_id":96959,"server_id":18,"link":"photo_1537571.html","width":130,"caption":"","height":130});
															thumbnails[1537573] = clik.newPhoto({"id":1537573,"src":"Lighthousethumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1537573.html","width":130,"caption":"","height":130});
															thumbnails[1537584] = clik.newPhoto({"id":1537584,"src":"Woodsthumb1.jpg","galleries_id":96959,"server_id":18,"link":"photo_1537584.html","width":130,"caption":"","height":130});
															thumbnails[1537585] = clik.newPhoto({"id":1537585,"src":"wavesthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1537585.html","width":130,"caption":"","height":130});
															thumbnails[1538835] = clik.newPhoto({"id":1538835,"src":"moonthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1538835.html","width":130,"caption":"","height":130});
															thumbnails[1550819] = clik.newPhoto({"id":1550819,"src":"barrierthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1550819.html","width":130,"caption":"","height":130});
															thumbnails[1550825] = clik.newPhoto({"id":1550825,"src":"doggerthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1550825.html","width":130,"caption":"","height":130});
															thumbnails[1550826] = clik.newPhoto({"id":1550826,"src":"satuethumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1550826.html","width":130,"caption":"","height":130});
															thumbnails[1550830] = clik.newPhoto({"id":1550830,"src":"trafalgarthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1550830.html","width":130,"caption":"","height":130});
															thumbnails[1559211] = clik.newPhoto({"id":1559211,"src":"buffersthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1559211.html","width":130,"caption":"","height":130});
															thumbnails[1559212] = clik.newPhoto({"id":1559212,"src":"horsethumb1.jpg","galleries_id":96959,"server_id":18,"link":"photo_1559212.html","width":130,"caption":"","height":130});
															thumbnails[1559213] = clik.newPhoto({"id":1559213,"src":"treessss_thumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1559213.html","width":130,"caption":"","height":130});
															thumbnails[1559214] = clik.newPhoto({"id":1559214,"src":"van4thumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1559214.html","width":130,"caption":"","height":130});
															thumbnails[1559217] = clik.newPhoto({"id":1559217,"src":"trackthumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1559217.html","width":130,"caption":"","height":130});
															thumbnails[1589979] = clik.newPhoto({"id":1589979,"src":"Strawb_thumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1589979.html","width":130,"caption":"","height":130});
															thumbnails[1852327] = clik.newPhoto({"id":1852327,"src":"tablesnow1_thumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_1852327.html","width":130,"caption":"","height":130});
															thumbnails[4001914] = clik.newPhoto({"id":4001914,"src":"freya-wed-copy_thumb.jpg","galleries_id":96959,"server_id":18,"link":"photo_4001914.html","width":130,"caption":"","height":130});
															thumbnails[5529774] = clik.newPhoto({"id":5529774,"src":"tb-barrymore_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_5529774.html","width":130,"caption":"","height":130});
															thumbnails[6516998] = clik.newPhoto({"id":6516998,"src":"Houston_thumb.jpg","galleries_id":97068,"server_id":18,"link":"photo_6516998.html","width":130,"caption":"","height":130});
															thumbnails[6517039] = clik.newPhoto({"id":6517039,"src":"tb-kane_thumb.jpg","galleries_id":97068,"server_id":18,"link":"photo_6517039.html","width":130,"caption":"","height":130});
															thumbnails[7433753] = clik.newPhoto({"id":7433753,"src":"parkin_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_7433753.html","width":130,"caption":"","height":130});
															thumbnails[7433886] = clik.newPhoto({"id":7433886,"src":"Gyllenhaal_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_7433886.html","width":130,"caption":"","height":130});
															thumbnails[8005069] = clik.newPhoto({"id":8005069,"src":"spencer_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_8005069.html","width":130,"caption":"","height":130});
															thumbnails[8005074] = clik.newPhoto({"id":8005074,"src":"ruth_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_8005074.html","width":130,"caption":"","height":130});
															thumbnails[8126253] = clik.newPhoto({"id":8126253,"src":"trapeze-_thumb.jpg","galleries_id":97068,"server_id":18,"link":"photo_8126253.html","width":130,"caption":"","height":130});
															thumbnails[8212403] = clik.newPhoto({"id":8212403,"src":"blair_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_8212403.html","width":130,"caption":"","height":130});
															thumbnails[8800915] = clik.newPhoto({"id":8800915,"src":"assou_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_8800915.html","width":130,"caption":"","height":130});
															thumbnails[8999318] = clik.newPhoto({"id":8999318,"src":"jerry_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_8999318.html","width":130,"caption":"","height":128});
															thumbnails[8999340] = clik.newPhoto({"id":8999340,"src":"McEwan_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_8999340.html","width":130,"caption":"","height":132});
															thumbnails[8999344] = clik.newPhoto({"id":8999344,"src":"gill_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_8999344.html","width":130,"caption":"","height":130});
															thumbnails[8999396] = clik.newPhoto({"id":8999396,"src":"Boyle_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_8999396.html","width":130,"caption":"","height":130});
															thumbnails[9002967] = clik.newPhoto({"id":9002967,"src":"Gervais-go_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9002967.html","width":130,"caption":"","height":130});
															thumbnails[9002970] = clik.newPhoto({"id":9002970,"src":"Gould_37217CEF-1EC9-DFB6-0976CE02C5DD4501_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9002970.html","width":130,"caption":"","height":130});
															thumbnails[9002975] = clik.newPhoto({"id":9002975,"src":"pots_thumb.jpg","galleries_id":97068,"server_id":18,"link":"photo_9002975.html","width":130,"caption":"","height":129});
															thumbnails[9004267] = clik.newPhoto({"id":9004267,"src":"Margolis_447EC996-24E8-5EC4-4F43358E727FA09B_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9004267.html","width":130,"caption":"","height":130});
															thumbnails[9004310] = clik.newPhoto({"id":9004310,"src":"tara_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9004310.html","width":130,"caption":"","height":130});
															thumbnails[9004367] = clik.newPhoto({"id":9004367,"src":"tb-har-lee_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9004367.html","width":130,"caption":"","height":130});
															thumbnails[9004369] = clik.newPhoto({"id":9004369,"src":"labute_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9004369.html","width":130,"caption":"","height":130});
															thumbnails[9004372] = clik.newPhoto({"id":9004372,"src":"tb-levete_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9004372.html","width":130,"caption":"","height":130});
															thumbnails[9004425] = clik.newPhoto({"id":9004425,"src":"almond_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9004425.html","width":130,"caption":"","height":130});
															thumbnails[9004430] = clik.newPhoto({"id":9004430,"src":"ackers_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9004430.html","width":130,"caption":"","height":130});
															thumbnails[9004432] = clik.newPhoto({"id":9004432,"src":"stewart_thumb.jpg","galleries_id":97067,"server_id":18,"link":"photo_9004432.html","width":130,"caption":"","height":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[97067] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_97067.html","maxRecords":0.0,"photoIDs":[5529774.0,7433753.0,7433886.0,8005069.0,8005074.0,8212403.0,8800915.0,8999318.0,8999340.0,8999344.0,8999396.0,9002967.0,9002970.0,9004267.0,9004310.0,9004367.0,9004369.0,9004372.0,9004425.0,9004430.0,9004432.0],"skipIndex":0,"section_code":"gallery","featured_images":"9004432,9004430,9004425,9004372,9004369,9004367,9004310,9004267,9002970,9002967","id":97067,"singleSection":false});				  						galleries[97068] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Features","link":"gallery_97068.html","maxRecords":0.0,"photoIDs":[1400247.0,6516998.0,6517039.0,8126253.0,9002975.0],"skipIndex":0,"section_code":"gallery","featured_images":"9002975,8126253,6517039,6516998,1400247","id":97068,"singleSection":false});				  						galleries[96959] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Personal.","link":"gallery_96959.html","maxRecords":0.0,"photoIDs":[1537513.0,1537516.0,1537518.0,1537520.0,1537571.0,1537573.0,1537584.0,1537585.0,1538835.0,1550819.0,1550825.0,1550826.0,1550830.0,1559211.0,1559212.0,1559213.0,1559214.0,1559217.0,1589979.0,1852327.0,4001914.0],"skipIndex":0,"section_code":"gallery","featured_images":"4001914,1852327,1589979,1559217,1559214,1559213,1559212,1559211,1550830,1550826","id":96959,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '9004432,9004430,9004425,9004372,9004369,9004367,9004310,9004267,9002975,9002970,9002967,8999396,8999344,8999340,8999318,8800915,8212403,8126253,8005074,8005069,7433886,7433753,6517039,6516998,5529774,4001914,1852327,1589979,1559217,1559214,1559213,1559212,1559211,1550830,1550826,1550825,1550819,1538835,1537585,1537584,1537573,1537571,1537520,1537518,1537516,1537513,1400247';
imageSets[3] = '9004432,9004430,9004425,9004372,9004369,9004367,9004310,9004267,9002975,9002970,9002967,8999396,8999344,8999340,8999318,8800915,8212403,8126253,8005074,8005069,7433886,7433753,6517039,6516998,5529774,4001914,1852327,1589979,1559217,1559214,1559213,1559212,1559211,1550830,1550826,1550825,1550819,1538835,1537585,1537584,1537573,1537571,1537520,1537518,1537516,1537513,1400247';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/tonybonus/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/tonybonus/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 = 'Tony Buckingham 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 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;
	}
}

			

