window.thumbnails = {};
															thumbnails[1900926] = clik.newPhoto({"id":1900926,"src":"30710029_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":196});
															thumbnails[1923095] = clik.newPhoto({"id":1923095,"src":"web 035_thumb.jpg","galleries_id":"","server_id":18,"link":"#","width":130,"caption":"","height":87});
															thumbnails[1900933] = clik.newPhoto({"id":1900933,"src":"27950033_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1900933.html","width":130,"caption":"","height":196});
															thumbnails[1900935] = clik.newPhoto({"id":1900935,"src":"Cyfarddfa-Castle-3_thumb.8.07-033.jpg","galleries_id":127415,"server_id":18,"link":"photo_1900935.html","width":130,"caption":"","height":98});
															thumbnails[1900940] = clik.newPhoto({"id":1900940,"src":"30700029-copy_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1900940.html","width":130,"caption":"","height":196});
															thumbnails[1922928] = clik.newPhoto({"id":1922928,"src":"web 002_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1922928.html","width":130,"caption":"","height":86});
															thumbnails[1922957] = clik.newPhoto({"id":1922957,"src":"web 007_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1922957.html","width":130,"caption":"","height":196});
															thumbnails[1922967] = clik.newPhoto({"id":1922967,"src":"web 010_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1922967.html","width":130,"caption":"","height":86});
															thumbnails[1923000] = clik.newPhoto({"id":1923000,"src":"web 032_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1923000.html","width":130,"caption":"","height":86});
															thumbnails[1923014] = clik.newPhoto({"id":1923014,"src":"web 011_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1923014.html","width":130,"caption":"","height":196});
															thumbnails[1923023] = clik.newPhoto({"id":1923023,"src":"web 014_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_1923023.html","width":130,"caption":"","height":196});
															thumbnails[1923029] = clik.newPhoto({"id":1923029,"src":"web 023_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_1923029.html","width":130,"caption":"","height":196});
															thumbnails[1923032] = clik.newPhoto({"id":1923032,"src":"web 015_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_1923032.html","width":130,"caption":"","height":196});
															thumbnails[1923039] = clik.newPhoto({"id":1923039,"src":"web 029_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_1923039.html","width":130,"caption":"","height":196});
															thumbnails[1923043] = clik.newPhoto({"id":1923043,"src":"web 031_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_1923043.html","width":130,"caption":"","height":196});
															thumbnails[1923050] = clik.newPhoto({"id":1923050,"src":"web 019_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_1923050.html","width":130,"caption":"","height":86});
															thumbnails[1923057] = clik.newPhoto({"id":1923057,"src":"web 0301_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_1923057.html","width":130,"caption":"","height":86});
															thumbnails[1923059] = clik.newPhoto({"id":1923059,"src":"web 018_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1923059.html","width":130,"caption":"","height":86});
															thumbnails[1923061] = clik.newPhoto({"id":1923061,"src":"web 025_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1923061.html","width":130,"caption":"","height":98});
															thumbnails[1923064] = clik.newPhoto({"id":1923064,"src":"web 033_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1923064.html","width":130,"caption":"","height":86});
															thumbnails[1923192] = clik.newPhoto({"id":1923192,"src":"72350015_thumb.JPG","galleries_id":127415,"server_id":18,"link":"photo_1923192.html","width":130,"caption":"","height":196});
															thumbnails[1923194] = clik.newPhoto({"id":1923194,"src":"IMG_2474_thumb.JPG","galleries_id":127431,"server_id":18,"link":"photo_1923194.html","width":130,"caption":"","height":195});
															thumbnails[1932427] = clik.newPhoto({"id":1932427,"src":"72350019_thumb.JPG","galleries_id":127415,"server_id":18,"link":"photo_1932427.html","width":130,"caption":"","height":86});
															thumbnails[2227939] = clik.newPhoto({"id":2227939,"src":" (3 of 3)_thumb.JPG","galleries_id":127415,"server_id":2,"link":"photo_2227939.html","width":130,"caption":"","height":86});
															thumbnails[2227940] = clik.newPhoto({"id":2227940,"src":" (1 of 3)_thumb.JPG","galleries_id":127415,"server_id":2,"link":"photo_2227940.html","width":130,"caption":"","height":196});
															thumbnails[2323448] = clik.newPhoto({"id":2323448,"src":"IMG_3472_thumb.JPG","galleries_id":127415,"server_id":18,"link":"photo_2323448.html","width":130,"caption":"","height":87});
															thumbnails[2411495] = clik.newPhoto({"id":2411495,"src":"88130015_thumb.JPG","galleries_id":127415,"server_id":18,"link":"photo_2411495.html","width":130,"caption":"","height":86});
															thumbnails[2802469] = clik.newPhoto({"id":2802469,"src":"14130013_thumb.JPG","galleries_id":127415,"server_id":18,"link":"photo_2802469.html","width":130,"caption":"","height":86});
															thumbnails[3041047] = clik.newPhoto({"id":3041047,"src":"01790017_thumb.JPG","galleries_id":127415,"server_id":18,"link":"photo_3041047.html","width":130,"caption":"","height":86});
															thumbnails[5384471] = clik.newPhoto({"id":5384471,"src":"Cerys_Dog_011_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_5384471.html","width":130,"caption":"","height":87});
															thumbnails[5384475] = clik.newPhoto({"id":5384475,"src":"Studio_Nicky_006_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_5384475.html","width":130,"caption":"","height":87});
															thumbnails[5384491] = clik.newPhoto({"id":5384491,"src":"Studio_Nicky_038_thumb.jpg","galleries_id":127431,"server_id":18,"link":"photo_5384491.html","width":130,"caption":"","height":87});
															thumbnails[8885198] = clik.newPhoto({"id":8885198,"src":"_MG_0123_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_8885198.html","width":130,"caption":"","height":195});
															thumbnails[8885200] = clik.newPhoto({"id":8885200,"src":"Andys_Wed_119_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_8885200.html","width":130,"caption":"","height":194});
															thumbnails[8885201] = clik.newPhoto({"id":8885201,"src":"Del._Wed._101_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_8885201.html","width":130,"caption":"","height":194});
															thumbnails[8885202] = clik.newPhoto({"id":8885202,"src":"Derek_Wed._060_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_8885202.html","width":130,"caption":"","height":87});
															thumbnails[8885205] = clik.newPhoto({"id":8885205,"src":"Dereks_083_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_8885205.html","width":130,"caption":"","height":87});
															thumbnails[8885206] = clik.newPhoto({"id":8885206,"src":"IMG_0080_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_8885206.html","width":130,"caption":"","height":87});
															thumbnails[8885207] = clik.newPhoto({"id":8885207,"src":"R.O.Ponty_031_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_8885207.html","width":130,"caption":"","height":194});
															thumbnails[8885209] = clik.newPhoto({"id":8885209,"src":"Wed._St._Teilo_Derek_082_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_8885209.html","width":130,"caption":"","height":194});
															thumbnails[1900931] = clik.newPhoto({"id":1900931,"src":"30700029_thumb.jpg","galleries_id":127415,"server_id":18,"link":"photo_1900931.html","width":130,"caption":"","height":196});
															thumbnails[4171727] = clik.newPhoto({"id":4171727,"src":"Copy_003_thumb.jpg","galleries_id":248664,"server_id":18,"link":"photo_4171727.html","width":130,"caption":"","height":87});
															thumbnails[4171730] = clik.newPhoto({"id":4171730,"src":"Copy_003_2_thumb.jpg","galleries_id":248664,"server_id":18,"link":"photo_4171730.html","width":130,"caption":"","height":87});
															thumbnails[4172649] = clik.newPhoto({"id":4172649,"src":"Jenkins_copy_0021_thumb.jpg","galleries_id":248664,"server_id":18,"link":"photo_4172649.html","width":130,"caption":"","height":194});
															thumbnails[4172651] = clik.newPhoto({"id":4172651,"src":"Jenkins_copy_002_final1_thumb.jpg","galleries_id":248664,"server_id":18,"link":"photo_4172651.html","width":130,"caption":"","height":194});
															thumbnails[4353810] = clik.newPhoto({"id":4353810,"src":"renovation_1_orig_thumb.jpg","galleries_id":248664,"server_id":18,"link":"photo_4353810.html","width":130,"caption":"","height":87});
															thumbnails[4353813] = clik.newPhoto({"id":4353813,"src":"renovation_2_1_thumb.jpg","galleries_id":248664,"server_id":18,"link":"photo_4353813.html","width":130,"caption":"","height":87});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[248664] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Digital work","link":"section301190.html","maxRecords":0.0,"photoIDs":[4171727.0,4171730.0,4172649.0,4172651.0,4353810.0,4353813.0],"skipIndex":0,"section_code":"section301190","featured_images":"4353813,4353810,4172651,4172649,4171730,4171727","id":248664,"singleSection":true});				  						galleries[127431] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Portraits","link":"gallery_127431.html","maxRecords":0.0,"photoIDs":[1923023.0,1923029.0,1923032.0,1923039.0,1923043.0,1923050.0,1923057.0,1923194.0,5384471.0,5384475.0,5384491.0],"skipIndex":0,"section_code":"gallery","featured_images":"5384491,5384475,5384471,1923194,1923057,1923050,1923043,1923039,1923032,1923029","id":127431,"singleSection":false});				  						galleries[127415] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Weddings","link":"gallery_127415.html","maxRecords":0.0,"photoIDs":[1900933.0,1900935.0,1900940.0,1922928.0,1922957.0,1922967.0,1923000.0,1923014.0,1923059.0,1923061.0,1923064.0,1923192.0,1932427.0,2227939.0,2227940.0,2323448.0,2411495.0,2802469.0,3041047.0,8885198.0,8885200.0,8885201.0,8885202.0,8885205.0,8885206.0,8885207.0,8885209.0,1900931.0],"skipIndex":0,"section_code":"gallery","featured_images":"8885198,2227939,1900931","id":127415,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8885198,3041047,2802469,2227939';
imageSets[2] = '8885198,2227939,1900931';
imageSets[3] = '8885209,8885207,8885206,8885205,8885202,8885201,8885200,8885198,5384491,5384475,5384471,4353813,4353810,4172651,4172649,4171730,4171727,3041047,2802469,2411495,2323448,2227940,2227939,1932427,1923194,1923192,1923095,1923064,1923061,1923059,1923057,1923050,1923043,1923039,1923032,1923029,1923023,1923014,1923000,1922967,1922957,1922928,1900940,1900935,1900933,1900931,1900926';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/dlewis15/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/dlewis15/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 = 'Derek Lewis Photography.co.uk: ' + 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;
	}
}

			

