window.thumbnails = new Object();
												thumbnails[3512221] = new thumbnail(3512221,'','','self portrait_thumb.jpg',130, 189,15,'#');
												thumbnails[3541014] = new thumbnail(3541014,'','the cage','the_cage_thumb.jpg',130, 85,15,'#');
												thumbnails[8130090] = new thumbnail(8130090,'213721','four flappers','four_flappers_thumb.jpg',130, 91,15,'photo_8130090.html');
												thumbnails[3512256] = new thumbnail(3512256,'213721','32 Falkner Square','32 falkner square_thumb.jpg',130, 107,15,'photo_3512256.html');
												thumbnails[3512631] = new thumbnail(3512631,'213721','The Kickboxer\'s Wife','kickboxers wife_thumb.jpg',130, 94,15,'photo_3512631.html');
												thumbnails[3512692] = new thumbnail(3512692,'213721','Huge Ballet Dancers','huge ballet dancers_thumb.jpg',130, 186,15,'photo_3512692.html');
												thumbnails[3512695] = new thumbnail(3512695,'213721','The Naked Harpist','the naked harpist_thumb.jpg',130, 184,15,'photo_3512695.html');
												thumbnails[3512699] = new thumbnail(3512699,'213721','Crossroads','crossroads_thumb.jpg',130, 182,15,'photo_3512699.html');
												thumbnails[3512701] = new thumbnail(3512701,'213721','50 Parr Street','50 parr st 2006_thumb.jpg',130, 168,15,'photo_3512701.html');
												thumbnails[3512702] = new thumbnail(3512702,'213721','Boy Racer','boy-racer_thumb.jpg',130, 188,15,'photo_3512702.html');
												thumbnails[3512717] = new thumbnail(3512717,'213721','charlotte and marianna','charlotte and marianna_thumb.jpg',130, 93,15,'photo_3512717.html');
												thumbnails[3512790] = new thumbnail(3512790,'213721','chef and a wok','Chef-and-a-wok_thumb.jpg',130, 94,15,'photo_3512790.html');
												thumbnails[3512799] = new thumbnail(3512799,'213721','the naked bungee jumper','the naked bungee jumper_thumb.jpg',130, 179,15,'photo_3512799.html');
												thumbnails[3512806] = new thumbnail(3512806,'213721','ironing in cuba','ironing in cuba_thumb.jpg',130, 189,15,'photo_3512806.html');
												thumbnails[3512915] = new thumbnail(3512915,'213721','daytime drinking','daytime drinking_thumb.jpg',130, 186,15,'photo_3512915.html');
												thumbnails[3512925] = new thumbnail(3512925,'213721','silver sax','silver sax_thumb.jpg',130, 193,15,'photo_3512925.html');
												thumbnails[3512931] = new thumbnail(3512931,'213721','boxer in grey tights','boxer in grey tights_thumb.jpg',130, 176,15,'photo_3512931.html');
												thumbnails[3512942] = new thumbnail(3512942,'213722','A la Carte','A-la-carte_thumb.jpg',130, 169,15,'photo_3512942.html');
												thumbnails[3512947] = new thumbnail(3512947,'213722','haute coitture','A-number-one_thumb.jpg',130, 177,15,'photo_3512947.html');
												thumbnails[3512954] = new thumbnail(3512954,'213722','art class HMP','art class in glen parva \'94_thumb.jpg',130, 179,15,'photo_3512954.html');
												thumbnails[3512961] = new thumbnail(3512961,'213722','christmas 88','christmas \'87_thumb.jpg',130, 189,15,'photo_3512961.html');
												thumbnails[3512967] = new thumbnail(3512967,'213722','dear john','dear-John_thumb.jpg',130, 88,15,'photo_3512967.html');
												thumbnails[3512972] = new thumbnail(3512972,'213722','the four poster bed','four-poster-bed_thumb.jpg',130, 165,15,'photo_3512972.html');
												thumbnails[3512974] = new thumbnail(3512974,'213722','the last slop out','last-slop-out_thumb.jpg',130, 80,15,'photo_3512974.html');
												thumbnails[3512976] = new thumbnail(3512976,'213722','a no1','no1 sketch_thumb.jpg',130, 90,15,'photo_3512976.html');
												thumbnails[3512980] = new thumbnail(3512980,'213722','heartbeat','on the sick_thumb.jpg',130, 151,15,'photo_3512980.html');
												thumbnails[3512985] = new thumbnail(3512985,'213722','pay day','pay day_thumb.jpg',130, 102,15,'photo_3512985.html');
												thumbnails[3513002] = new thumbnail(3513002,'213722','the piss house','the piss house_thumb.jpg',130, 192,15,'photo_3513002.html');
												thumbnails[3513014] = new thumbnail(3513014,'213721','piano man','piano man_thumb.jpg',130, 78,15,'photo_3513014.html');
												thumbnails[3513020] = new thumbnail(3513020,'213721','jazz piano','jazz-piano-again_thumb.jpg',130, 189,15,'photo_3513020.html');
												thumbnails[3513100] = new thumbnail(3513100,'213722','now then','now then_thumb.jpg',130, 181,15,'photo_3513100.html');
												thumbnails[3513129] = new thumbnail(3513129,'213721','sumo','sumo_thumb.jpg',130, 89,15,'photo_3513129.html');
												thumbnails[3513133] = new thumbnail(3513133,'213721','at sea','at sea_thumb.jpg',130, 89,15,'photo_3513133.html');
												thumbnails[3513135] = new thumbnail(3513135,'213721','potato peelers','peeling potatos_thumb.jpg',130, 181,15,'photo_3513135.html');
												thumbnails[3517771] = new thumbnail(3517771,'213721','oliver','oliver nv_thumb.jpg',130, 190,15,'photo_3517771.html');
												thumbnails[3517774] = new thumbnail(3517774,'213721','rose','rose_thumb.jpg',130, 189,15,'photo_3517774.html');
												thumbnails[3517780] = new thumbnail(3517780,'213721','big issue','big-issue_thumb.jpg',130, 91,15,'photo_3517780.html');
												thumbnails[3517781] = new thumbnail(3517781,'213721','going underground','going-underground_thumb.jpg',130, 186,15,'photo_3517781.html');
												thumbnails[3517786] = new thumbnail(3517786,'213721','bare knuckle breed','Bare-knuckle-breed_thumb.jpg',130, 139,15,'photo_3517786.html');
												thumbnails[3517787] = new thumbnail(3517787,'213721','second time round','second time round_thumb.jpg',130, 191,15,'photo_3517787.html');
												thumbnails[3517790] = new thumbnail(3517790,'213721','scouse girls','Scouse-girls_thumb.jpg',130, 179,15,'photo_3517790.html');
												thumbnails[3527755] = new thumbnail(3527755,'213721','boy shavers','The-shaving-booth1_thumb.jpg',130, 100,15,'photo_3527755.html');
												thumbnails[3527759] = new thumbnail(3527759,'213721','our father','Our-Father_thumb.jpg',130, 185,15,'photo_3527759.html');
												thumbnails[3527769] = new thumbnail(3527769,'213721','our lady of havanna','our lady of havana_thumb.jpg',130, 92,15,'photo_3527769.html');
												thumbnails[3527782] = new thumbnail(3527782,'213721','the naked cellist','The-naked-cellist_thumb.jpg',130, 188,15,'photo_3527782.html');
												thumbnails[3528349] = new thumbnail(3528349,'213721','private function','a private function_thumb.jpg',130, 191,15,'photo_3528349.html');
												thumbnails[3528399] = new thumbnail(3528399,'213721','november','november_thumb.jpg',130, 177,15,'photo_3528399.html');
												thumbnails[3528424] = new thumbnail(3528424,'213721','clovis','clovis1_thumb.jpg',130, 178,15,'photo_3528424.html');
												thumbnails[3541016] = new thumbnail(3541016,'213722','the bathers','the_bathers_thumb.jpg',130, 161,15,'photo_3541016.html');
												thumbnails[3584777] = new thumbnail(3584777,'213721','black and white cat lovers','black_and_white_cat_lovers1_thumb.jpg',130, 188,15,'photo_3584777.html');
												thumbnails[3584849] = new thumbnail(3584849,'213721','a pnk waiting room','a_pink_waiting_room1_thumb.jpg',130, 129,15,'photo_3584849.html');
												thumbnails[3584873] = new thumbnail(3584873,'213721','partial eclipse of the sun','Partial-eclipse-of-the-sun_thumb.jpg',130, 185,15,'photo_3584873.html');
												thumbnails[3643657] = new thumbnail(3643657,'213721','gift of a pineapple','gift_of_a_pineapple_thumb.jpg',130, 201,15,'photo_3643657.html');
												thumbnails[3649980] = new thumbnail(3649980,'213721','sumo  study','solo_sumo_thumb.jpg',130, 172,15,'photo_3649980.html');
												thumbnails[3654168] = new thumbnail(3654168,'213721','a violin player','violin_player_thumb.jpg',130, 185,15,'photo_3654168.html');
												thumbnails[3654187] = new thumbnail(3654187,'213721','the audition','the_audition_thumb.jpg',130, 165,15,'photo_3654187.html');
												thumbnails[3654258] = new thumbnail(3654258,'213721','the liverpool school of dance','the_liverpool_school_of_dance_thumb.jpg',130, 89,15,'photo_3654258.html');
												thumbnails[3654272] = new thumbnail(3654272,'213722','the dishwasher of Glen Parva','the_dishwasher1_thumb.jpg',130, 203,15,'photo_3654272.html');
												thumbnails[3654276] = new thumbnail(3654276,'213721','albert','albert_thumb.jpg',130, 88,15,'photo_3654276.html');
												thumbnails[3665945] = new thumbnail(3665945,'213721','big baby','BIG_BABY_thumb.jpg',130, 98,15,'photo_3665945.html');
												thumbnails[3665997] = new thumbnail(3665997,'213721','five glasses of red','Five_glasses_of_red1_thumb.jpg',130, 172,15,'photo_3665997.html');
												thumbnails[4614306] = new thumbnail(4614306,'213721','the light is on the right side of your head','the_light_is_on_the_right_side_of_your_head_thumb.jpg',130, 191,15,'photo_4614306.html');
												thumbnails[4902904] = new thumbnail(4902904,'213721','wallking the dog at night','walking_the_dog_at_night12_thumb.jpg',130, 177,15,'photo_4902904.html');
												thumbnails[4902908] = new thumbnail(4902908,'213721','five glasses of red 2','five_glasses_of_red_2_thumb.jpg',130, 132,15,'photo_4902908.html');
												thumbnails[4902916] = new thumbnail(4902916,'213721','urban goats','urban_goats1_thumb.jpg',130, 173,15,'photo_4902916.html');
												thumbnails[4902919] = new thumbnail(4902919,'213721','bare knuckle days','bareknuckle_days1_thumb.jpg',130, 183,15,'photo_4902919.html');
												thumbnails[4911266] = new thumbnail(4911266,'213721','Li\'l arthur','Lil_Arthur_thumb.jpg',130, 132,15,'photo_4911266.html');
												thumbnails[5093247] = new thumbnail(5093247,'213721','a fat kickboxer','a_fat_kickboxer_thumb.jpg',130, 174,15,'photo_5093247.html');
												thumbnails[5093248] = new thumbnail(5093248,'213721','yellow umbrella','yellow_umbrella_thumb.jpg',130, 90,15,'photo_5093248.html');
												thumbnails[6278754] = new thumbnail(6278754,'213721','Lucy\'s Last Caigarette.','lucys_last_cigarette_copy_thumb.jpg',130, 131,15,'photo_6278754.html');
												thumbnails[7175281] = new thumbnail(7175281,'213721','duo','duo_thumb.jpg',130, 144,15,'photo_7175281.html');
												thumbnails[7179662] = new thumbnail(7179662,'213721','the four eyed sheriff','the_four_eyed_sheriff_thumb.jpg',130, 194,15,'photo_7179662.html');
												thumbnails[7179671] = new thumbnail(7179671,'213721','anniversary waltz','anniversary_waltz_thumb.jpg',130, 169,15,'photo_7179671.html');

/***************************************************************************
* Create the array of Gallery objects                                      *
***************************************************************************/
var galleries = new Object();
				  					galleries[213721] = new gallery(213721,'8130090,7179671,7179662,7175281,6278754,5093248,5093247,4911266,4902919,4902916','Gallery 1','gallery',[8130090,3512256,3512631,3512692,3512695,3512699,3512701,3512702,3512717,3512790,3512799,3512806,3512915,3512925,3512931,3513014,3513020,3513129,3513133,3513135,3517771,3517774,3517780,3517781,3517786,3517787,3517790,3527755,3527759,3527769,3527782,3528349,3528399,3528424,3584777,3584849,3584873,3643657,3649980,3654168,3654187,3654258,3654276,3665945,3665997,4614306,4902904,4902908,4902916,4902919,4911266,5093247,5093248,6278754,7175281,7179662,7179671],0, 0, '', 'gallery_213721.html',0,0);
				  					galleries[213722] = new gallery(213722,'3654272,3541016,3513100,3513002,3512985,3512980,3512976,3512974,3512972,3512967','happy landings','gallery',[3512942,3512947,3512954,3512961,3512967,3512972,3512974,3512976,3512980,3512985,3513002,3513100,3541016,3654272],0, 0, '', 'gallery_213722.html',0,0);
/***************************************************************************
* Create the array of image sets                                           *
***************************************************************************/
var imageSets = new Object();
imageSets[1] = '3512221';
imageSets[3] = '8130090,7179671,7179662,7175281,6278754,5093248,5093247,4911266,4902919,4902916,4902908,4902904,4614306,3665997,3665945,3654276,3654272,3654258,3654187,3654168,3649980,3643657,3584873,3584849,3584777,3541016,3541014,3528424,3528399,3528349,3527782,3527769,3527759,3527755,3517790,3517787,3517786,3517781,3517780,3517774,3517771,3513135,3513133,3513129,3513100,3513020,3513014,3513002,3512985,3512980';
 /***************************************************************************
* Get a server path given an ID                                            *
***************************************************************************/
function getServerPath(server_id) {
	var val = -1;
		switch (server_id) {
		case 21:
		val = 'http://www6.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 1:
		val = 'http://www1.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 2:
		val = 'http://admin.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 24:
		val = 'http://tpc15/clikpic/rafiki/images';
		break;
	}
		switch (server_id) {
		case 4:
		val = 'http://clikchurch.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 5:
		val = 'http://www2.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 22:
		val = 'http://tpc5/clikpic/rafiki/images';
		break;
	}
		switch (server_id) {
		case 23:
		val = 'http://tpc10/clikpic/rafiki/images';
		break;
	}
		switch (server_id) {
		case 25:
		val = 'http://tpc16/clikpic/rafiki/images';
		break;
	}
		switch (server_id) {
		case 40:
		val = 'http://www11.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 42:
		val = 'db2.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 15:
		val = 'http://www3.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 18:
		val = 'http://www4.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 19:
		val = 'http://www5.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 31:
		val = 'http://www7.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 32:
		val = 'http://admin2.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 33:
		val = 'http://www8.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 34:
		val = 'http://www9.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 35:
		val = 'http://admin3.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 37:
		val = 'http://admin4.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 38:
		val = 'http://admin5.clikpic.com/rafiki/images';
		break;
	}
		switch (server_id) {
		case 39:
		val = 'http://www10.clikpic.com/rafiki/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 && backgrounds[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:'',
                    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 (!basic) {
    if (op.updateHash && clik.getIDInUrl(location.href,'photo') != op.nextPhoto.id) {
		clik.changeHash('photos_id=' + op.nextPhoto.id, true);
    }
				
    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));		  $('body').trigger('clikUpdate');		}, op.onBefore);
      }    }
    	if (op.field) {
		op.field.value = photoId;
	} else {
		op.$photo.data('image_id', photoId);
    }
	    if (op.$title.length > 0) {
  		op.$title.fadeGalleryDetails(photoCaption, op.speed);
    }
        if (op.updateDocumentTitle) {
						  document.title = 'peter Cameron: ' + photoCaption;
			    }
        if (op.$detail.length > 0) {
      temp = op.nextPhoto.fnGetImageDetails();
	    op.$detail.fadeGalleryDetails(temp, op.speed, function(){
	    var options = {};	    	      	      resizePhotoInfo(options);
        if (typeof(backgrounds) != 'undefined' && op.nextPhoto == backgrounds[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(backgrounds);
  	    } else if (typeof(photos) != 'undefined' && op.nextPhoto == photos[op.nextPhoto.id]) {
  	      toggleAddToCartConfirm(photos);
  	    }
	    });
    }
        if (!op.speed) {      clik.doColumnResize(false, op.$photo.add(op.$detail).add(op.$title));      $('body').trigger('clikUpdate');    }        
    return html;			}
	else {
				
		window.location = 'photo_' + nextPhoto.id + '.html';
	}
		
}

/***************************************************************************
* Toggle add to cart confirmation element and set up the click event for   *
* the 'Add to cart' button.                                                *
***************************************************************************/
function toggleAddToCartConfirm(array){
  if (typeof(array) !== 'object' || array == undefined) {
    array = photos;
  }
	if($('#paymentConfirm').length > 0){
		$('#paymentConfirm').hide();
		$('#paymentAddButton')
		.unbind()
		.click(function(){
						form = document.getElementById('paymentForm');
			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').text('Item added to cart').show();}
				else{
					$('#paymentConfirm').text('Item added to cart').fadeIn();
					dspOrderDetails(form.site.value);
				}
			}
			else{
				$('#paymentConfirm').text('Item not added - check cookies are enabled in your browser.').fadeIn();
			}
		});
	}
}
/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetImageDetails = function(){
	var temp = '';
	if (this.description != '') {
		temp = temp +  '<p id="imageDescription">' + this.description + '</p>';
	}
		if (this.photo_ref != '') {
		temp = temp + '<p class="imageinfo" id="imageRef"><strong>Ref: </strong>' + this.photo_ref + '</p>';
	}
		if (this.takendate != '') {
				
		temp = temp + '<p class="imageinfo" id="imageDate"><strong>Date: </strong>' + this.takendate + '</p>';
	}
	
	if (this.location != '') {
				
		temp = temp + '<p class="imageinfo" id="imageLocation"><strong>Location: </strong>' +  this.location + '</p>';
	}
	
	if (this.photographer != '') {
				
		temp = temp + '<p class="imageinfo" id="imagePhotographer"><strong>Photographer: </strong>' + this.photographer + '</p>';
	}
					
				if (temp != '') {
		temp = temp + '<div class="spacer"></div>';
	}
	return temp;
};

/***************************************************************************
* Get payment info for image - add as 'method' to photo object             *
***************************************************************************/
photo.prototype.fnGetPaymentInfo = function(){
	var temp = '';
	if (this.item_price !== '') {
				temp = temp + '<p>Order this print:</p>';
				temp = temp + '<p class="imageinfo" id="imagePrice"><strong>' + this.purchase_instruction + '</strong> ' + (this.item_price).toFixed(2) + '</p>';
		var item_name  = this.purchase_instruction;
		var amount = (this.item_price).toFixed(2);
		var item_option  = 0;
	}
	else if (this.payment_groups_id !== '') {
		temp = temp + '<p>Buy this print online:</p>';
				temp = temp + '<form id="paymentOptions" style="margin:0px;border:0px;" name="paymentOptions">';
											temp = temp + '<select class="paymentlink" name="payment_options_id" onchange="updateItemValues(document.forms.paymentForm,this.form.payment_options_id.options[this.form.payment_options_id.options.selectedIndex].value);">';
				
		temp = temp + getPaymentOptions(this.payment_groups_id);
		temp = temp + '</select>';
		temp = temp + '</form>';
				var item_option  = paymentGroups[this.payment_groups_id].options[0];
		if(paymentOptions[item_option]){
			var item_name  = paymentOptions[item_option].payment_option;
			var amount =  paymentOptions[item_option].price;
		}
			}
	else {
				
	}
	if (this.item_price !== '' || this.payment_groups_id !== '') {
			temp = 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({            href: thumbnails[imageID].fnGalleryLink(gallery_id),            title: galleries[gallery_id].title          });
        }
							}
										}
}

/***************************************************************************
* 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 + ' | ';
				}
				temp = temp + '<a href="' + galleries[i].section_code + '_' + galleries[i].id + '.html">' + galleries[i].title + '</a>';
			}
		}
		document.all.galleryLinks.innerHTML = 'Other galleries: ' + temp;
	}
}

			

