window.thumbnails = {};
thumbnails[7205850] = clik.newPhoto({"link":"photo_7205850.html","caption":"","height":173,"id":7205850,"server_id":21,"src":"108-0850_IMG_thumb.JPG","galleries_id":387761,"width":130});
thumbnails[7205852] = clik.newPhoto({"link":"photo_7205852.html","caption":"","height":173,"id":7205852,"server_id":21,"src":"108-0860_IMG_thumb.JPG","galleries_id":387761,"width":130});
thumbnails[7205853] = clik.newPhoto({"link":"photo_7205853.html","caption":"","height":173,"id":7205853,"server_id":21,"src":"108-0862_IMG_2_thumb.JPG","galleries_id":387761,"width":130});
thumbnails[7205866] = clik.newPhoto({"link":"photo_7205866.html","caption":"Breakout","height":87,"id":7205866,"server_id":21,"src":"DSC_0055_thumb.jpg","galleries_id":475692,"width":130});
thumbnails[9028531] = clik.newPhoto({"link":"photo_9028531.html","caption":"","height":102,"id":9028531,"server_id":21,"src":"world_321145_big_thumb.jpg","galleries_id":475742,"width":130});
thumbnails[9028714] = clik.newPhoto({"link":"photo_9028714.html","caption":"","height":173,"id":9028714,"server_id":21,"src":"Image79_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9028736] = clik.newPhoto({"link":"photo_9028736.html","caption":"","height":173,"id":9028736,"server_id":21,"src":"Image63_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9028768] = clik.newPhoto({"link":"photo_9028768.html","caption":"","height":173,"id":9028768,"server_id":21,"src":"Image24_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9028776] = clik.newPhoto({"link":"photo_9028776.html","caption":"","height":220,"id":9028776,"server_id":21,"src":"Image71_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9028838] = clik.newPhoto({"link":"photo_9028838.html","caption":"","height":173,"id":9028838,"server_id":21,"src":"Image30_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9032859] = clik.newPhoto({"link":"photo_9032859.html","caption":"Meeting Room","height":196,"id":9032859,"server_id":21,"src":"DSC_0067_2_thumb.jpg","galleries_id":475692,"width":130});
thumbnails[9032890] = clik.newPhoto({"link":"photo_9032890.html","caption":"","height":102,"id":9032890,"server_id":21,"src":"cli_Rus_219521_big_thumb.jpg","galleries_id":475742,"width":130});
thumbnails[9032892] = clik.newPhoto({"link":"photo_9032892.html","caption":"","height":102,"id":9032892,"server_id":21,"src":"cli_Rus_194751_big_thumb.jpg","galleries_id":475742,"width":130});
thumbnails[9032948] = clik.newPhoto({"link":"photo_9032948.html","caption":"","height":142,"id":9032948,"server_id":21,"src":"cli_Rus_195435_big_thumb.jpg","galleries_id":475742,"width":130});
thumbnails[9032950] = clik.newPhoto({"link":"photo_9032950.html","caption":"","height":142,"id":9032950,"server_id":21,"src":"cli_Rus_169945_big_thumb.jpg","galleries_id":475742,"width":130});
thumbnails[9033228] = clik.newPhoto({"link":"photo_9033228.html","caption":"","height":177,"id":9033228,"server_id":21,"src":"Image75_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9033236] = clik.newPhoto({"link":"photo_9033236.html","caption":"","height":98,"id":9033236,"server_id":21,"src":"Image65_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9033240] = clik.newPhoto({"link":"photo_9033240.html","caption":"","height":98,"id":9033240,"server_id":21,"src":"Image64_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9033245] = clik.newPhoto({"link":"photo_9033245.html","caption":"","height":98,"id":9033245,"server_id":21,"src":"Image27_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[9033248] = clik.newPhoto({"link":"photo_9033248.html","caption":"","height":173,"id":9033248,"server_id":21,"src":"Image68_thumb.jpg","galleries_id":475701,"width":130});
thumbnails[7205856] = clik.newPhoto({"link":"photo_7205856.html","caption":"Reception","height":87,"id":7205856,"server_id":21,"src":"DSC_0001_2_thumb.jpg","galleries_id":475692,"width":130});
thumbnails[7205859] = clik.newPhoto({"link":"photo_7205859.html","caption":"Corridor","height":164,"id":7205859,"server_id":21,"src":"DSC_0031a_2_thumb.jpg","galleries_id":475692,"width":130});
thumbnails[7205857] = clik.newPhoto({"link":"photo_7205857.html","caption":"Corridor ","height":87,"id":7205857,"server_id":21,"src":"DSC_0031_2_thumb.jpg","galleries_id":475692,"width":130});
thumbnails[7205641] = clik.newPhoto({"link":"photo_7205641.html","caption":"","height":77,"id":7205641,"server_id":21,"src":"0013_thumb.jpg","galleries_id":387760,"width":130});
thumbnails[7205652] = clik.newPhoto({"link":"photo_7205652.html","caption":"","height":105,"id":7205652,"server_id":21,"src":"002_thumb.jpg","galleries_id":387760,"width":130});
thumbnails[7205838] = clik.newPhoto({"link":"photo_7205838.html","caption":"","height":174,"id":7205838,"server_id":21,"src":"004_thumb.jpg","galleries_id":387760,"width":130});
thumbnails[7205843] = clik.newPhoto({"link":"photo_7205843.html","caption":"","height":174,"id":7205843,"server_id":21,"src":"006_thumb.jpg","galleries_id":387760,"width":130});
thumbnails[7205845] = clik.newPhoto({"link":"photo_7205845.html","caption":"","height":173,"id":7205845,"server_id":21,"src":"007_thumb.jpg","galleries_id":387760,"width":130});
thumbnails[7205846] = clik.newPhoto({"link":"photo_7205846.html","caption":"","height":98,"id":7205846,"server_id":21,"src":"008_thumb.jpg","galleries_id":387760,"width":130});
thumbnails[9027868] = clik.newPhoto({"link":"photo_9027868.html","caption":"Before","height":98,"id":9027868,"server_id":21,"src":"Barnes_1_thumb.JPG","galleries_id":475702,"width":130});
thumbnails[9032189] = clik.newPhoto({"link":"photo_9032189.html","caption":"","height":97,"id":9032189,"server_id":21,"src":"Tarbert_Road_front1_thumb.jpg","galleries_id":475710,"width":130});
thumbnails[9032192] = clik.newPhoto({"link":"photo_9032192.html","caption":"","height":97,"id":9032192,"server_id":21,"src":"Tarbert_Road_kitchen1_thumb.jpg","galleries_id":475710,"width":130});
thumbnails[9032195] = clik.newPhoto({"link":"photo_9032195.html","caption":"","height":97,"id":9032195,"server_id":21,"src":"Tarbert_Road_kitchen_21_thumb.jpg","galleries_id":475710,"width":130});
thumbnails[9032198] = clik.newPhoto({"link":"photo_9032198.html","caption":"","height":97,"id":9032198,"server_id":21,"src":"Tarbert_Road_sitting_room1_thumb.jpg","galleries_id":475710,"width":130});
thumbnails[9032200] = clik.newPhoto({"link":"photo_9032200.html","caption":"","height":98,"id":9032200,"server_id":21,"src":"Tarbert_Road_bed_11_thumb.jpg","galleries_id":475710,"width":130});
thumbnails[9032201] = clik.newPhoto({"link":"photo_9032201.html","caption":"","height":96,"id":9032201,"server_id":21,"src":"Tarbert_Road_bath_11_thumb.jpg","galleries_id":475710,"width":130});
thumbnails[9032208] = clik.newPhoto({"link":"photo_9032208.html","caption":"","height":97,"id":9032208,"server_id":21,"src":"Tarbert_Road_bath_21_thumb.jpg","galleries_id":475710,"width":130});
thumbnails[9032211] = clik.newPhoto({"link":"photo_9032211.html","caption":"","height":98,"id":9032211,"server_id":21,"src":"Tarbert_Road_bed_412_thumb.jpg","galleries_id":475710,"width":130});
thumbnails[9033056] = clik.newPhoto({"link":"photo_9033056.html","caption":"Glass splash back - detail","height":173,"id":9033056,"server_id":21,"src":"004_9BE240BB-24E8-5EC4-4F63401B12D763BE_thumb.JPG","galleries_id":475939,"width":130});
thumbnails[9027870] = clik.newPhoto({"link":"photo_9027870.html","caption":"After","height":86,"id":9027870,"server_id":21,"src":"Barnes_2_thumb.JPG","galleries_id":475702,"width":130});
thumbnails[7205746] = clik.newPhoto({"link":"photo_7205746.html","caption":"","height":78,"id":7205746,"server_id":21,"src":"003_thumb.jpg","galleries_id":387760,"width":130});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
galleries[387760] = clik.newGallery({"photoIDs":[7205641,7205652,7205838,7205843,7205845,7205846,7205746],"link":"section579170_387760.html","skipIndex":0,"section_code":"section579170","id":387760,"parentGallery":"","featured_images":"7205846,7205845,7205843,7205838,7205746,7205652,7205641","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Beckenham"});galleries[475710] = clik.newGallery({"photoIDs":[9032189,9032192,9032195,9032198,9032200,9032201,9032208,9032211],"link":"section579170_475710.html","skipIndex":0,"section_code":"section579170","id":475710,"parentGallery":"","featured_images":"9032211,9032208,9032201,9032200,9032198,9032195,9032192,9032189","maxRecords":0,"usePopups":false,"singleSection":false,"title":"East Dulwich"});galleries[475702] = clik.newGallery({"photoIDs":[9027868,9027870],"link":"section579170_475702.html","skipIndex":0,"section_code":"section579170","id":475702,"parentGallery":"","featured_images":"9027870,9027868","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Barnes"});galleries[475939] = clik.newGallery({"photoIDs":[9033056],"link":"section579170_475939.html","skipIndex":0,"section_code":"section579170","id":475939,"parentGallery":"","featured_images":9033056,"maxRecords":0,"usePopups":false,"singleSection":false,"title":"Details"});galleries[475701] = clik.newGallery({"photoIDs":[9028714,9028736,9028768,9028776,9028838,9033228,9033236,9033240,9033245,9033248],"link":"gallery_475701.html","skipIndex":0,"section_code":"gallery","id":475701,"parentGallery":"","featured_images":"9033248,9033245,9033240,9033236,9033228,9028838,9028776,9028768,9028736,9028714","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Bedrock"});galleries[475692] = clik.newGallery({"photoIDs":[7205866,9032859,7205856,7205859,7205857],"link":"gallery_475692.html","skipIndex":0,"section_code":"gallery","id":475692,"parentGallery":"","featured_images":"9032859,7205866,7205859,7205857,7205856","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Opodo "});galleries[387761] = clik.newGallery({"photoIDs":[7205850,7205852,7205853],"link":"gallery_387761.html","skipIndex":0,"section_code":"gallery","id":387761,"parentGallery":"","featured_images":"7205853,7205852,7205850","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Hines"});galleries[475742] = clik.newGallery({"photoIDs":[9028531,9032890,9032892,9032948,9032950],"link":"gallery_475742.html","skipIndex":0,"section_code":"gallery","id":475742,"parentGallery":"","featured_images":"9032950,9032948,9032892,9032890,9028531","maxRecords":0,"usePopups":false,"singleSection":false,"title":"Russell"});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[3] = '9033248,9033245,9033240,9033236,9033228,9033056,9032950,9032948,9032892,9032890,9032859,9032211,9032208,9032201,9032200,9032198,9032195,9032192,9032189,9028838,9028776,9028768,9028736,9028714,9028531,9027868,7205866,7205853,7205852,7205850,7205846,7205845,7205843,7205838,7205652,7205641,9027870,7205856,7205859,7205746,7205857';
imageSets[2] = '9033248,9033245,9033240,9033236,9033228,9033056,9032950,9032948,9032892,9032890,9032859,9032211,9032208,9032201,9032200,9032198,9032195,9032192,9032189,9028838,9028776,9028768,9028736,9028714,9028531,9027868,7205866,7205853,7205852,7205850,9027870,7205856,7205859,7205857';
imageSets[1] = '7205846,7205845,7205843,7205838,7205652,7205641,7205746';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/faylawrence/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/faylawrence/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 = 'Fay Lawrence Interiors: ' + 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;
	}
}

		

