window.thumbnails = {};
															thumbnails[8713379] = clik.newPhoto({"id":8713379,"src":"aa4_copya12_thumb.jpg","galleries_id":"","server_id":5,"link":"#","width":160,"caption":"","height":160});
															thumbnails[7601079] = clik.newPhoto({"id":7601079,"src":"1b_thumb.jpg","galleries_id":273083,"server_id":5,"link":"photo_7601079.html","width":160,"caption":"Wasteland 1","height":160});
															thumbnails[7601080] = clik.newPhoto({"id":7601080,"src":"2b_thumb.jpg","galleries_id":273083,"server_id":5,"link":"photo_7601080.html","width":160,"caption":"Wasteland 2","height":160});
															thumbnails[7601083] = clik.newPhoto({"id":7601083,"src":"3b_thumb.jpg","galleries_id":273083,"server_id":5,"link":"photo_7601083.html","width":160,"caption":"Wasteland 3","height":160});
															thumbnails[7601086] = clik.newPhoto({"id":7601086,"src":"4b_thumb.jpg","galleries_id":273083,"server_id":5,"link":"photo_7601086.html","width":160,"caption":"Wasteland 4","height":160});
															thumbnails[7601087] = clik.newPhoto({"id":7601087,"src":"5b_thumb.jpg","galleries_id":273083,"server_id":5,"link":"photo_7601087.html","width":160,"caption":"Wasteland 5","height":160});
															thumbnails[7601088] = clik.newPhoto({"id":7601088,"src":"6b_thumb.jpg","galleries_id":273083,"server_id":5,"link":"photo_7601088.html","width":160,"caption":"Wasteland 6","height":160});
															thumbnails[7601089] = clik.newPhoto({"id":7601089,"src":"7b_thumb.jpg","galleries_id":273083,"server_id":5,"link":"photo_7601089.html","width":160,"caption":"Wasteland 7","height":160});
															thumbnails[7601090] = clik.newPhoto({"id":7601090,"src":"8b_thumb.jpg","galleries_id":273083,"server_id":5,"link":"photo_7601090.html","width":160,"caption":"Wasteland 8","height":160});
															thumbnails[7601157] = clik.newPhoto({"id":7601157,"src":"1c_thumb.jpg","galleries_id":280769,"server_id":5,"link":"photo_7601157.html","width":160,"caption":"Blinding 1","height":160});
															thumbnails[7601158] = clik.newPhoto({"id":7601158,"src":"2c_thumb.jpg","galleries_id":280769,"server_id":5,"link":"photo_7601158.html","width":160,"caption":"Blinding 2","height":160});
															thumbnails[7601159] = clik.newPhoto({"id":7601159,"src":"3c_thumb.jpg","galleries_id":280769,"server_id":5,"link":"photo_7601159.html","width":160,"caption":"Blinding 3","height":160});
															thumbnails[7601160] = clik.newPhoto({"id":7601160,"src":"4c_thumb.jpg","galleries_id":280769,"server_id":5,"link":"photo_7601160.html","width":160,"caption":"Blinding 4","height":160});
															thumbnails[7601161] = clik.newPhoto({"id":7601161,"src":"5c_thumb.jpg","galleries_id":280769,"server_id":5,"link":"photo_7601161.html","width":160,"caption":"Blinding 5","height":160});
															thumbnails[7601163] = clik.newPhoto({"id":7601163,"src":"6c_thumb.jpg","galleries_id":280769,"server_id":5,"link":"photo_7601163.html","width":160,"caption":"Blinding 6","height":160});
															thumbnails[7601191] = clik.newPhoto({"id":7601191,"src":"7c_thumb.jpg","galleries_id":280769,"server_id":5,"link":"photo_7601191.html","width":160,"caption":"Blinding 7","height":160});
															thumbnails[7601196] = clik.newPhoto({"id":7601196,"src":"8c_thumb.jpg","galleries_id":280769,"server_id":5,"link":"photo_7601196.html","width":160,"caption":"Blinding 8","height":160});
															thumbnails[8701064] = clik.newPhoto({"id":8701064,"src":"1a1_thumb.jpg","galleries_id":201248,"server_id":5,"link":"photo_8701064.html","width":160,"caption":"Ghosts 1","height":160});
															thumbnails[8701066] = clik.newPhoto({"id":8701066,"src":"2a1_thumb.jpg","galleries_id":201248,"server_id":5,"link":"photo_8701066.html","width":160,"caption":"Ghosts 2","height":160});
															thumbnails[8701069] = clik.newPhoto({"id":8701069,"src":"3a1_thumb.jpg","galleries_id":201248,"server_id":5,"link":"photo_8701069.html","width":160,"caption":"Ghosts 3","height":160});
															thumbnails[8701073] = clik.newPhoto({"id":8701073,"src":"4a2_thumb.jpg","galleries_id":201248,"server_id":5,"link":"photo_8701073.html","width":160,"caption":"Ghosts 4","height":160});
															thumbnails[8701275] = clik.newPhoto({"id":8701275,"src":"1ab_thumb.jpg","galleries_id":276657,"server_id":5,"link":"photo_8701275.html","width":160,"caption":"Burial 1","height":160});
															thumbnails[8701305] = clik.newPhoto({"id":8701305,"src":"2ab_thumb.jpg","galleries_id":276657,"server_id":5,"link":"photo_8701305.html","width":160,"caption":"Burial 2","height":160});
															thumbnails[8701308] = clik.newPhoto({"id":8701308,"src":"3ab_thumb.jpg","galleries_id":276657,"server_id":5,"link":"photo_8701308.html","width":160,"caption":"Burial 3","height":160});
															thumbnails[8701310] = clik.newPhoto({"id":8701310,"src":"4ab_thumb.jpg","galleries_id":276657,"server_id":5,"link":"photo_8701310.html","width":160,"caption":"Burial 4","height":160});
															thumbnails[8703668] = clik.newPhoto({"id":8703668,"src":"aa1_copy_thumb.jpg","galleries_id":396782,"server_id":5,"link":"photo_8703668.html","width":160,"caption":"Voyeuristic 1","height":160});
															thumbnails[8703671] = clik.newPhoto({"id":8703671,"src":"aa2_copy_thumb.jpg","galleries_id":396782,"server_id":5,"link":"photo_8703671.html","width":160,"caption":"Voyeuristic 2","height":160});
															thumbnails[8703673] = clik.newPhoto({"id":8703673,"src":"aa3_copy_thumb.jpg","galleries_id":396782,"server_id":5,"link":"photo_8703673.html","width":160,"caption":"Voyeuristic 3","height":160});
															thumbnails[8703674] = clik.newPhoto({"id":8703674,"src":"aa4_copy_thumb.jpg","galleries_id":396782,"server_id":5,"link":"photo_8703674.html","width":160,"caption":"Voyeuristic 4","height":160});
															thumbnails[8713502] = clik.newPhoto({"id":8713502,"src":"aa5_thumb.jpg","galleries_id":396782,"server_id":5,"link":"photo_8713502.html","width":160,"caption":"Voyeuristic 5","height":160});
															thumbnails[8713507] = clik.newPhoto({"id":8713507,"src":"aa6_thumb.jpg","galleries_id":396782,"server_id":5,"link":"photo_8713507.html","width":160,"caption":"Voyeuristic 6","height":160});
															thumbnails[8713509] = clik.newPhoto({"id":8713509,"src":"aa7_thumb.jpg","galleries_id":396782,"server_id":5,"link":"photo_8713509.html","width":160,"caption":"Voyeuristic 7","height":160});
															thumbnails[8713512] = clik.newPhoto({"id":8713512,"src":"aa8_thumb.jpg","galleries_id":396782,"server_id":5,"link":"photo_8713512.html","width":160,"caption":"Voyeuristic 8","height":160});
															thumbnails[9017117] = clik.newPhoto({"id":9017117,"src":"5a_thumb.jpg","galleries_id":201248,"server_id":5,"link":"photo_9017117.html","width":160,"caption":"Ghosts 5","height":160});
															thumbnails[9017126] = clik.newPhoto({"id":9017126,"src":"6a_thumb.jpg","galleries_id":201248,"server_id":5,"link":"photo_9017126.html","width":160,"caption":"Ghosts 6","height":160});
															thumbnails[9017130] = clik.newPhoto({"id":9017130,"src":"7a_thumb.jpg","galleries_id":201248,"server_id":5,"link":"photo_9017130.html","width":160,"caption":"Ghosts 7","height":160});
															thumbnails[9017137] = clik.newPhoto({"id":9017137,"src":"8a_thumb.jpg","galleries_id":201248,"server_id":5,"link":"photo_9017137.html","width":160,"caption":"Ghosts 8","height":160});

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  						galleries[396782] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Voyeuristic","link":"gallery_396782.html","maxRecords":0.0,"photoIDs":[8703668.0,8703671.0,8703673.0,8703674.0,8713502.0,8713507.0,8713509.0,8713512.0],"skipIndex":0,"section_code":"gallery","featured_images":"8713512,8713509,8713507,8713502,8703674,8703673,8703671,8703668","id":396782,"singleSection":false});				  						galleries[276657] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Burial","link":"gallery_276657.html","maxRecords":0.0,"photoIDs":[8701275.0,8701305.0,8701308.0,8701310.0],"skipIndex":0,"section_code":"gallery","featured_images":"8701310,8701308,8701305,8701275","id":276657,"singleSection":false});				  						galleries[280769] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Blinding","link":"gallery_280769.html","maxRecords":0.0,"photoIDs":[7601157.0,7601158.0,7601159.0,7601160.0,7601161.0,7601163.0,7601191.0,7601196.0],"skipIndex":0,"section_code":"gallery","featured_images":"7601196,7601191,7601163,7601161,7601160,7601159,7601158,7601157","id":280769,"singleSection":false});				  						galleries[273083] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Wasteland","link":"gallery_273083.html","maxRecords":0.0,"photoIDs":[7601079.0,7601080.0,7601083.0,7601086.0,7601087.0,7601088.0,7601089.0,7601090.0],"skipIndex":0,"section_code":"gallery","featured_images":"7601090,7601089,7601088,7601087,7601086,7601083,7601080,7601079","id":273083,"singleSection":false});				  						galleries[201248] = clik.newGallery({"parentGallery":"","usePopups":false,"title":"Ghosts","link":"gallery_201248.html","maxRecords":0.0,"photoIDs":[8701064.0,8701066.0,8701069.0,8701073.0,9017117.0,9017126.0,9017130.0,9017137.0],"skipIndex":0,"section_code":"gallery","featured_images":"9017137,9017130,9017126,9017117,8701073,8701069,8701066,8701064","id":201248,"singleSection":false});/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = {};
imageSets[1] = '8713379,8703674';
imageSets[3] = '9017137,9017130,9017126,9017117,8713512,8713509,8713507,8713502,8713379,8703674,8703673,8703671,8703668,8701310,8701308,8701305,8701275,8701073,8701069,8701066,8701064,7601196,7601191,7601163,7601161,7601160,7601159,7601158,7601157,7601090,7601089,7601088,7601087,7601086,7601083,7601080,7601079';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 51:
		val = 'http://www12.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 0:
		val = 'http://www.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 26:
		val = 'http://tpc20/clikpic/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://www8.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 53:
		val = 'http://images.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 52:
		val = 'http://tpc22/clikpic/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/sucksmith/images';
		break;
	}
		switch (server_id) {
		case 50:
		val = '[cliktext value=article.servers_id type=servers_id]/sucksmith/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 = 'PAUL SUCKSMITH  : ARTIST: ' + 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> &pound;' + (this.item_price).toFixed(2) + '</div>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
		else {
		
	}
	if (this.item_price !== '') {
																		temp += '<form id="paymentForm" style="margin:0px;border:0px;" name="paymentForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
			temp += '<input type="hidden" name="item_name" value="'+item_name+'">';
			ref = '';
			if(this.photo_ref != ''){
				ref = this.photo_ref+' - '+this.caption;
			}
			else{
				ref = this.id+' - '+this.caption;
			}
			price = amount;								temp += '<input type="hidden" name="cmd" value="_cart">';
					temp += '<input type="hidden" name="business" value="sucksmithjones@live.co.uk">';
					temp += '<input type="hidden" name="currency_code" value="GBP">';
					temp += '<input type="hidden" name="add" value="1">';
													temp += '<input type="hidden" name="amount" value="'+amount+'">';
					temp += '<input type="hidden" name="item_number" value="'+ref+'">';
													temp += '<input type=\"Submit\" value=\"Add to cart\" id=\"paymentAddButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
										temp += '</form>';
										temp += '<form id="paymentCartForm" style="margin:0px;" name="paymentCartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
				temp += '<input type="hidden" name="cmd" value="_cart">';
				temp += '<input type="hidden" name="business" value="sucksmithjones@live.co.uk">';
				temp += '<input type="hidden" name="display" value="1">';
				temp += '<input type=\"Submit\" value=\"View cart\" id=\"paymentViewButton\" class=\"button\" onmouseover=\"this.className=\'buttonHi\';\" onmouseout=\"this.className=\'button\';\">';
				temp += '</form>';
						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;
	}
}

			

