window.thumbnails = {};
															thumbnails[1972941] = clik.newPhoto({"id":1972941,"src":"Ammonites1_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1972941.html","width":130,"caption":"Ammonites","height":133});
															thumbnails[1972998] = clik.newPhoto({"id":1972998,"src":"Shoreline_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1972998.html","width":130,"caption":"Shoreline","height":121});
															thumbnails[1973003] = clik.newPhoto({"id":1973003,"src":"Mooring_West_Bay_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1973003.html","width":130,"caption":"Mooring - West Bay","height":115});
															thumbnails[1973059] = clik.newPhoto({"id":1973059,"src":"Portland_Floats_detail_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1973059.html","width":130,"caption":"Detail of Portland Floats.  ","height":82});
															thumbnails[1973062] = clik.newPhoto({"id":1973062,"src":"Old_Harry_Rocks_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1973062.html","width":130,"caption":"Old Harry Rocks","height":60});
															thumbnails[1973069] = clik.newPhoto({"id":1973069,"src":"Green_Kleefishes_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1973069.html","width":130,"caption":"Detail of Green Kleefishes","height":92});
															thumbnails[1973072] = clik.newPhoto({"id":1973072,"src":"Petroglyph_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1973072.html","width":130,"caption":"Petroglyph","height":131});
															thumbnails[1973079] = clik.newPhoto({"id":1973079,"src":"Weathered_wood_West_Bay_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1973079.html","width":130,"caption":"Weathered wood, West Bay - detail","height":134});
															thumbnails[1973085] = clik.newPhoto({"id":1973085,"src":"Sea_Caves_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1973085.html","width":130,"caption":"Sea Caves","height":93});
															thumbnails[1973090] = clik.newPhoto({"id":1973090,"src":"Red_circles_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1973090.html","width":130,"caption":"Red circles","height":105});
															thumbnails[1977756] = clik.newPhoto({"id":1977756,"src":"Texture_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_1977756.html","width":130,"caption":"Landscape II","height":98});
															thumbnails[2004548] = clik.newPhoto({"id":2004548,"src":"Daisy chain I_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_2004548.html","width":130,"caption":"Daisy Chain","height":151});
															thumbnails[2072726] = clik.newPhoto({"id":2072726,"src":"silverbirches_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_2072726.html","width":130,"caption":"Silver Birch Copse, Wareham Forest.  ","height":89});
															thumbnails[2072736] = clik.newPhoto({"id":2072736,"src":"Portland_floats_III_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_2072736.html","width":130,"caption":"Portland Floats III","height":89});
															thumbnails[2907479] = clik.newPhoto({"id":2907479,"src":"View from St Peter's Church, Eype_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_2907479.html","width":130,"caption":"View from St Peter's Church, Eype","height":58});
															thumbnails[2907619] = clik.newPhoto({"id":2907619,"src":"Rust and Ultramarine I - detail_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_2907619.html","width":130,"caption":"Rust and Ultramarine I - detail. ","height":67});
															thumbnails[2907630] = clik.newPhoto({"id":2907630,"src":"Portland by moonlight_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_2907630.html","width":130,"caption":"Portland by moonlight","height":70});
															thumbnails[3094533] = clik.newPhoto({"id":3094533,"src":"Six Gold Circles_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_3094533.html","width":130,"caption":"Six Gold Circles","height":197});
															thumbnails[3094538] = clik.newPhoto({"id":3094538,"src":"Mooring Chain - West Bay_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_3094538.html","width":130,"caption":"Mooring Chain - West Bay","height":179});
															thumbnails[3094549] = clik.newPhoto({"id":3094549,"src":"Old Harry Rocks trio III_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_3094549.html","width":130,"caption":"Old Harry Rocks Trio III","height":310});
															thumbnails[3094563] = clik.newPhoto({"id":3094563,"src":"St Catherine's Chapel_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_3094563.html","width":130,"caption":"St Catherine's Chapel","height":191});
															thumbnails[3357756] = clik.newPhoto({"id":3357756,"src":"The Owl and the Pussycat - detail_thumb.jpg","galleries_id":313167,"server_id":32,"link":"photo_3357756.html","width":130,"caption":"The Owl and the Pussycat - detail","height":170});
															thumbnails[3391132] = clik.newPhoto({"id":3391132,"src":"Hey diddle - detail_thumb.jpg","galleries_id":313167,"server_id":32,"link":"photo_3391132.html","width":130,"caption":"Hey Diddle Diddle, the Cat & the Fiddle - detail","height":149});
															thumbnails[4631343] = clik.newPhoto({"id":4631343,"src":"Hardy_by_Marnie_Shaw_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_4631343.html","width":130,"caption":"Hardy - mixed media.  Detail.","height":144});
															thumbnails[4632241] = clik.newPhoto({"id":4632241,"src":"Old_Harry_Eype_by_Marnie_Shaw1_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_4632241.html","width":130,"caption":"Old Harry - mixed media.  Detail.","height":128});
															thumbnails[5527938] = clik.newPhoto({"id":5527938,"src":"Red_Pear_-_Green_Circles_s12_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_5527938.html","width":130,"caption":"Red Pear - Green Circles.  ","height":143});
															thumbnails[5527965] = clik.newPhoto({"id":5527965,"src":"OHR_DAW10_web_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_5527965.html","width":130,"caption":"Old Harry Rocks - mixed media","height":98});
															thumbnails[5528009] = clik.newPhoto({"id":5528009,"src":"Storm_over_Portland_s_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_5528009.html","width":130,"caption":"Storm over Portland","height":64});
															thumbnails[6607493] = clik.newPhoto({"id":6607493,"src":"East_Cliff_-_Eype_small1_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_6607493.html","width":130,"caption":"East Cliff","height":196});
															thumbnails[6607656] = clik.newPhoto({"id":6607656,"src":"Old_Harry_Rocks_-_Eype_2010_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_6607656.html","width":130,"caption":"Old Harry Rocks","height":102});
															thumbnails[6607829] = clik.newPhoto({"id":6607829,"src":"Portland_by_Day_small_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_6607829.html","width":130,"caption":"Portland from West Bay","height":79});
															thumbnails[6607841] = clik.newPhoto({"id":6607841,"src":"Portland_by_Night_small_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_6607841.html","width":130,"caption":"Portland by Night","height":80});
															thumbnails[6667494] = clik.newPhoto({"id":6667494,"src":"Pulpit_Rock_small_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_6667494.html","width":130,"caption":"Pulpit Rock.  Mixed media","height":87});
															thumbnails[6667498] = clik.newPhoto({"id":6667498,"src":"Durdle_Door_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_6667498.html","width":130,"caption":"Durdle Door - Mixed media","height":76});
															thumbnails[6667502] = clik.newPhoto({"id":6667502,"src":"Old_Harry_Manga_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_6667502.html","width":130,"caption":"Reflections on Old Harry (detail) - mixed media","height":119});
															thumbnails[7732994] = clik.newPhoto({"id":7732994,"src":"Oldharryrocks_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_7732994.html","width":130,"caption":"Old Harry Rocks - detail","height":145});
															thumbnails[7733014] = clik.newPhoto({"id":7733014,"src":"Birchwoods_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_7733014.html","width":130,"caption":"Silver Birch Wood","height":98});
															thumbnails[8376413] = clik.newPhoto({"id":8376413,"src":"StAlbansFreestoneweb_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_8376413.html","width":130,"caption":"St Albans Freestone","height":173});
															thumbnails[8376415] = clik.newPhoto({"id":8376415,"src":"EastCliffwithgrassweb_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_8376415.html","width":130,"caption":"East Cliff","height":173});
															thumbnails[4631326] = clik.newPhoto({"id":4631326,"src":"From_Highlands_End_by_Marnie_Shaw_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_4631326.html","width":130,"caption":"From Highlands End","height":72});
															thumbnails[7732944] = clik.newPhoto({"id":7732944,"src":"Stormeastcliff_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_7732944.html","width":130,"caption":"Storm over East Cliff - detail","height":240});
															thumbnails[7732976] = clik.newPhoto({"id":7732976,"src":"Bluecircles_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_7732976.html","width":130,"caption":"Blue Circles - detail","height":138});
															thumbnails[2004551] = clik.newPhoto({"id":2004551,"src":"East cliff west bay I_thumb.jpg","galleries_id":132578,"server_id":32,"link":"photo_2004551.html","width":130,"caption":"East Cliff, West Bay","height":360});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[313167] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Nursey rhyme paintings","link":"gallery_313167.html","maxRecords":0.0,"photoIDs":[3357756.0,3391132.0],"skipIndex":0,"section_code":"gallery","featured_images":3391132.0,"id":313167,"singleSection":false});				  						galleries[132578] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Gallery","link":"gallery_132578.html","maxRecords":0.0,"photoIDs":[1972941.0,1972998.0,1973003.0,1973059.0,1973062.0,1973069.0,1973072.0,1973079.0,1973085.0,1973090.0,1977756.0,2004548.0,2072726.0,2072736.0,2907479.0,2907619.0,2907630.0,3094533.0,3094538.0,3094549.0,3094563.0,4631343.0,4632241.0,5527938.0,5527965.0,5528009.0,6607493.0,6607656.0,6607829.0,6607841.0,6667494.0,6667498.0,6667502.0,7732994.0,7733014.0,8376413.0,8376415.0,4631326.0,7732944.0,7732976.0,2004551.0],"skipIndex":0,"section_code":"gallery","featured_images":"6607656,5527965,5527938","id":132578,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8376415,4631326';
imageSets[2] = '6607656,5527965,5527938,3391132';
imageSets[3] = '8376415,8376413,7733014,7732994,7732976,7732944,6667502,6667498,6667494,6607841,6607829,6607656,6607493,5528009,5527965,5527938,4632241,4631343,4631326,3391132,3357756,3094563,3094549,3094538,3094533,2907630,2907619,2907479,2072736,2072726,2004551,2004548,1977756,1973090,1973085,1973079,1973072,1973069,1973062,1973059,1973003,1972998,1972941';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/marnieshaw/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/marnieshaw/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 = 'Marnie Shaw Art: ' + 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;
	}
}

			

